diff --git a/.config/ags/scripts/record-script.sh b/.config/ags/scripts/record-script.sh index f9dd16dc7..b838dab62 100755 --- a/.config/ags/scripts/record-script.sh +++ b/.config/ags/scripts/record-script.sh @@ -10,20 +10,30 @@ getactivemonitor() { hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name' } -mkdir -p "$(xdg-user-dir VIDEOS)" -cd "$(xdg-user-dir VIDEOS)" || exit +xdgvideo="$(xdg-user-dir VIDEOS)" +if [[ $xdgvideo = "$HOME" ]]; then + unset xdgvideo +fi +mkdir -p "${xdgvideo:-$HOME/Videos}" +cd "${xdgvideo:-$HOME/Videos}" || exit + if pgrep wf-recorder > /dev/null; then notify-send "Recording Stopped" "Stopped" -a 'record-script.sh' & pkill wf-recorder & else + if ! region="$(slurp 2>&1)"; then + notify-send "Recording Cancelled" "Selection was Cancelled" -a 'record-script.sh' + exit 1 + fi + notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'record-script.sh' if [[ "$1" == "--sound" ]]; then - wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$(slurp)" --audio="$(getaudiooutput)" & disown + wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" --audio="$(getaudiooutput)" & disown elif [[ "$1" == "--fullscreen-sound" ]]; then wf-recorder -o $(getactivemonitor) --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --audio="$(getaudiooutput)" & disown elif [[ "$1" == "--fullscreen" ]]; then wf-recorder -o $(getactivemonitor) --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t & disown else - wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$(slurp)" & disown + wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" & disown fi fi