summaryrefslogtreecommitdiff
path: root/screenrec.sh
blob: 762902934465d148dfff57846a92198a5d931ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

# Wal colors dmenu
. "${HOME}/.cache/wal/colors.sh"

# Alias Dmenu
alias give_to_dmenu='dmenu -c -nf "$color0" -nb "$color15" -sb "$color1" -sf "$color15" -fn "Iosevka-11"'

# Vars
video_output_dir="~/stf/sr"
number_of_displays=$(xrandr | grep " connected" | wc -l)
display_selection=$(xrandr | grep " connected" | awk '{print $1}' | give_to_dmenu -l $number_of_displays -p "Which display would you like to capture?:")
screen_res=$(xrandr | grep "$display_selection" | grep -o '[[:digit:]]\+x[[:digit:]]\+')
screen_coord=$(xrandr | grep "$display_selection" | grep -o '+[[:digit:]]\++[[:digit:]]')
#output_res=$(printf "640:480\n800:600\n1024:768\n852:480\n1280:720\n1600:900\n1920:1080" | give_to_dmenu -l 7 -p "Output Resolution:")
video_name=$(echo "" | give_to_dmenu -p Name:)

# Capture
ffmpeg -f x11grab -s $screen_res -i :0.0$screen_coord -f pulse -i default ~/stf/sr/"$video_name.mp4" \
& dunstify " Recording video in $video_output_dir as $video_name.mp4" \
|| dunstify "ERROR: Video is not being recorded"