diff options
| -rw-r--r-- | .config/cow/cow.conf | 12 | ||||
| -rwxr-xr-x | .local/bin/screenrecord.sh | 21 |
2 files changed, 33 insertions, 0 deletions
diff --git a/.config/cow/cow.conf b/.config/cow/cow.conf index f001bbf..d86b0f2 100644 --- a/.config/cow/cow.conf +++ b/.config/cow/cow.conf @@ -333,6 +333,18 @@ bind L+Print exec sh "$HOME/.local/bin/screenshot.sh selected-region" # Take a screenshot and save it to the clipboard bind LS+Print exec sh "$HOME/.local/bin/screenshot.sh save-to-clipboard" +# Take a recording of the focused output +bind C+Print exec sh "$HOME/.local/bin/screenrecord.sh" + +# Take a recording of the focused window +bind CS+Print exec sh "$HOME/.local/bin/screenrecord.sh focused-window" + +# Take a recording of the selected region +bind CL+Print exec sh "$HOME/.local/bin/screenrecord.sh selected-region" + +# Stop all screen recording +bind CS+r exec "pkill -SIGINT wf-recorder" + # Raise cowpager and cowbuttons bind LS+b script { for w in (windows where w.app_id == "cowpager") { diff --git a/.local/bin/screenrecord.sh b/.local/bin/screenrecord.sh new file mode 100755 index 0000000..c60d46c --- /dev/null +++ b/.local/bin/screenrecord.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Get focused output +output="$( moocow show windows | jq -r '.data[] | select(.focused == true) | .output')" + +case $1 in + selected-region) + # Record the selected region + wf-recorder -g "$(slurp)" -f ~/Videos/"$(date +%Y-%m-%d_%H-%m-%s)".mkv + ;; + focused-window) + # Record the focused window + geometry=$(moocow winops -I | jq -r '.data.frame | "\(.x),\(.y) \(.width)x\(.height)"') + echo "$geometry" + wf-recorder -g "$geometry" -f ~/Videos/"$(date +%Y-%m-%d_%H-%m-%s)".mkv + ;; + *) + # Record the currently focused output and save it into Screenrecordings + wf-recorder -o "$output" -f ~/Videos/"$(date +%Y-%m-%d_%H-%m-%s)".mkv + ;; +esac |
