diff options
| author | 2026-02-11 02:47:33 +0000 | |
|---|---|---|
| committer | 2026-02-11 02:47:33 +0000 | |
| commit | 2c485ce2b43bd810a88278215b771136a2a17881 (patch) | |
| tree | 3fb74338b87553d898af7b1795de7322cbc5af63 /private_dot_local/bin/executable_toggle-screen-capture | |
| parent | add xdg (diff) | |
| download | dotfiles-2c485ce2b43bd810a88278215b771136a2a17881.tar.gz | |
add scripts
Diffstat (limited to 'private_dot_local/bin/executable_toggle-screen-capture')
| -rw-r--r-- | private_dot_local/bin/executable_toggle-screen-capture | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/private_dot_local/bin/executable_toggle-screen-capture b/private_dot_local/bin/executable_toggle-screen-capture new file mode 100644 index 0000000..10dff96 --- /dev/null +++ b/private_dot_local/bin/executable_toggle-screen-capture | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | PID=`pgrep wf-recorder` | ||
| 4 | FILE="$HOME/multimedia/screencasts/`date '+%Y%m%d-%H%M%S'`.mkv" | ||
| 5 | |||
| 6 | if [ "$PID" ]; then | ||
| 7 | kill -INT $PID | ||
| 8 | for module in `pactl list short modules | grep wf-recorder | cut -f1`; do | ||
| 9 | pactl unload-module $module | ||
| 10 | done | ||
| 11 | while `pgrep wf-recorder`; do sleep 0.01; done | ||
| 12 | pkill -SIGRTMIN+8 waybar | ||
| 13 | sleep 0.01 | ||
| 14 | pkill -SIGRTMIN+8 waybar | ||
| 15 | else | ||
| 16 | TYPE=${1:-output} | ||
| 17 | case $TYPE in | ||
| 18 | output) | ||
| 19 | GEOMETRY=`slurp -o -b "303030AA" -B "303030AA"` | ||
| 20 | ;; | ||
| 21 | window) | ||
| 22 | GEOMETRY=`swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x+.window_rect.x),\(.rect.y+.window_rect.y) \(.window_rect.width)x\(.window_rect.height)"' | slurp -b "303030AA" -B "303030AA"` | ||
| 23 | ;; | ||
| 24 | *) | ||
| 25 | echo "Usage: $0 [output|window]" | ||
| 26 | exit 1 | ||
| 27 | ;; | ||
| 28 | esac | ||
| 29 | if [ -z "$GEOMETRY" ]; then exit; fi | ||
| 30 | pactl load-module module-null-sink sink_name=wf-recorder | ||
| 31 | pactl load-module module-loopback sink=wf-recorder source=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | ||
| 32 | pactl load-module module-loopback sink=wf-recorder source=alsa_input.pci-0000_00_1b.0.analog-stereo | ||
| 33 | wf-recorder --audio=wf-recorder.monitor \ | ||
| 34 | --geometry="$GEOMETRY" \ | ||
| 35 | --pixel-format=yuv420p \ | ||
| 36 | --file="$FILE" & | ||
| 37 | disown $! | ||
| 38 | pkill -SIGRTMIN+8 waybar | ||
| 39 | fi | ||
