Created
December 21, 2020 14:08
-
-
Save gingkapls/33f7567900a32ceed4b27f0eae1ffcd8 to your computer and use it in GitHub Desktop.
Wayland recording with waybar indicator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"custom/wf-recorder": { | |
"format": "{}", | |
"interval": "once", | |
"exec": "echo ''", | |
"tooltip": "false", | |
"exec-if": "pgrep 'wf-recorder'", | |
"on-click": "exec $HOME/.scripts/wlrecord.sh", | |
"signal": 8 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#custom-wf-recorder { | |
padding: 0 20px; | |
color: @base07; | |
border-bottom: 4px solid @base01; | |
background-color: @base00; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
active=$(pacmd list-sources | awk 'c&&!--c;/* index*/{c=1}' | awk '{gsub(/<|>/,"",$0); print $NF}') | |
filename=$(date +%F_%T.mkv) | |
echo active sink: $active | |
echo $filename | |
if [ -z $(pgrep wf-recorder) ]; | |
then notify-send "Recording Started ($active)" | |
if [ "$1" == "-s" ] | |
then wf-recorder -f $HOME/Videos/Recordings/$filename -a "$active" -g "$(slurp -c "#FFFFFF")" >/dev/null 2>&1 & | |
sleep 2 | |
while [ ! -z $(pgrep -x slurp) ]; do wait; done | |
pkill -RTMIN+8 waybar | |
else if [ "$1" == "-w" ] | |
then wf-recorder -f $HOME/Videos/Recordings/$filename -a "$active" -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp -c "#FFFFFF" )" >/dev/null 2>&1 & | |
sleep 2 | |
while [ ! -z $(pgrep -x slurp) ]; do wait; done | |
pkill -RTMIN+8 waybar | |
else | |
wf-recorder -f $HOME/Videos/Recordings/$filename -a "$active" >/dev/null 2>&1 & | |
pkill -RTMIN+8 waybar | |
fi | |
fi | |
else | |
killall -s SIGINT wf-recorder | |
notify-send "Recording Complete" | |
while [ ! -z $(pgrep -x wf-recorder) ]; do wait; done | |
pkill -RTMIN+8 waybar | |
name="$(zenity --entry --text "enter a filename")" | |
perl-rename "s/\.(mkv|mp4)$/ $name $&/" $(ls -d $HOME/Videos/Recordings/* -t | head -n1) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment