Skip to content

Instantly share code, notes, and snippets.

@Loupax
Created October 4, 2025 21:53
Show Gist options
  • Save Loupax/9b1b79dba028a935c1669d4e4f10dd29 to your computer and use it in GitHub Desktop.
Save Loupax/9b1b79dba028a935c1669d4e4f10dd29 to your computer and use it in GitHub Desktop.
Recording setup for sway and waybar
{
"custom/recorder": {
"return-type": "json",
"format": "{}",
"interval": 1,
"exec": "~/.config/sway/scripts/waybar-recorder-status.sh",
"on-click": "killall -s SIGINT wf-recorder && notify-send 'Recording stopped and saved'"
},
}
#!/bin/bash
output_dir="$HOME/Videos/Screencaps"
mkdir -p "$output_dir"
chosen_option=$(tofi <<EOF
Record Region (MP4)
Record Fullscreen (MP4)
EOF
)
case "$chosen_option" in
"Record Region (MP4)")
geometry=$(slurp)
if [ -z "$geometry" ]; then
exit 0
fi
wf-recorder -g "$geometry" -a -f "$output_dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4" &
;;
"Record Fullscreen (MP4)")
wf-recorder -a -f "$output_dir/$(date +'%Y-%m-%d_%H-%M-%S')-fullscreen.mp4" &
;;
esac
exit 0
#!/bin/bash
# Check if the wf-recorder process is running
if pgrep -x "wf-recorder" > /dev/null; then
echo '{"text": "🔴 STOP", "tooltip": "A recording is in progress.\nClick to stop.", "class": "recording"}'
else
# If wf-recorder is not running, output empty text to hide the module
echo '{"text": ""}'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment