dotfiles/.local/bin/recordscreen
2025-03-19 22:04:07 -06:00

33 lines
1,015 B
Bash
Executable file

#!/bin/sh -x
#
# Show icon in slstatus: [ 󰕧 + 󱄠 (󰑊) ]
# [ 󰕧 + 󱄠 + 󰍬 (󰑊) ]
# [ 󰕧 (󰑊) ]
#
screencast(){
case $(printf "%s\n" "󰍬 Mic ON" "󰍭 Mic OFF" | fuzzel -d) in
"󰍬 Mic ON")
wf-recorder -D -a -f ~/Videos/Recordings/recording_$(date +"%Y-%m-%d_%H:%M:%S.mp4")
;;
"󰍭 Mic OFF")
wf-recorder -D --audio="$(pactl list short sources | grep output | awk '{print $2}')" -f ~/Videos/Recordings/recording_$(date +"%Y-%m-%d_%H:%M:%S.mp4")
;;
esac
}
video(){
wf-recorder -D -f ~/Videos/Recordings/recording_$(date +"%Y-%m-%d_%H:%M:%S.mp4")
}
kill(){
killall -s SIGINT wf-recorder && \
notify-send "wf-recorder" "recording stopped" || \
notify-send "ERROR" "No recording process found"
}
case $(printf "%s\n" "󰻒 Screencast" "󰕧 Video only" "󰕨 Stop recording" | fuzzel -d) in
"󰻒 Screencast") screencast;;
"󰕧 Video only") video;;
"󰕨 Stop recording") kill;;
*) kill;;
esac