Added screencasting scripts

This commit is contained in:
lanxu 2022-04-24 18:54:27 +03:00
parent 407c93c90d
commit d4273a1609
2 changed files with 23 additions and 1 deletions

21
sway/take_screencast.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
MODE=$1
FILENAME=$(xdg-user-dir VIDEOS)/$(date +%F_%T_wf-recorder.mp4)
TEMP_FILENAME=$(mktemp).mp4
#PARAMS='-c libvpx-vp9'
PARAMS='--audio -o DP-2'
WF_RECORDERS=$(ps -Al | rg 'wf-recorder' | wc -l)
if [ $WF_RECORDERS -gt 0 ]; then
killall -2 wf-recorder
exit 0
fi
case $MODE in
"stop") killall -2 wf-recorder;;
"region-copy") wf-recorder -g "$(slurp)" $PARAMS -f $TEMP_FILENAME && wl-copy --type text/uri-list file://$TEMP_FILENAME;;
"region") wf-recorder -g "$(slurp)" $PARAMS -f $FILENAME && notify-send -i "$FILENAME" "Screencast saved";;
*) wf-recorder $PARAMS -f $FILENAME && notify-send -i "$FILENAME" "Screencast saved";;
esac

View File

@ -3,7 +3,8 @@
MODE=$1
FILENAME=$(xdg-user-dir PICTURES)/$(date +%F_%T_grim.png)
case $MODE in "region-copy") grim -g "$(slurp)" - | wl-copy;;
case $MODE in
"region-copy") grim -g "$(slurp)" - | wl-copy;;
"region") grim -g "$(slurp)" $FILENAME && notify-send -i "$FILENAME" "Screenshot saved";;
*) grim $FILENAME && notify-send -i "$FILENAME" "Screenshot saved";;
esac