From 4ccab0b91652dcfb27a3fe807b2c981de412f765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Sat, 7 Sep 2024 10:03:45 +0200 Subject: [PATCH] wm: screen grabbing --- bin/executable_recordcurrwin | 23 +++++++++++++++++++ .../herbstluftwm/executable_autostart.tmpl | 1 + 2 files changed, 24 insertions(+) create mode 100644 bin/executable_recordcurrwin diff --git a/bin/executable_recordcurrwin b/bin/executable_recordcurrwin new file mode 100644 index 0000000..6c3beaa --- /dev/null +++ b/bin/executable_recordcurrwin @@ -0,0 +1,23 @@ +#!/bin/zsh + + +pidfile=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/recording.status +win=$(xdotool getactivewindow) + +if [[ -e $pidfile ]] +then + read pid file < $pidfile + kill -INT $pid + xclip <<<$file + notify-send "Recording stopped" + rm $pidfile + exit +fi + +file=~/Videos/screengrab-$(date +%FT%T).ogv + +recordmydesktop --windowid=$win --no-sound -o $file --on-the-fly-encoding & + +echo $! $file> $pidfile + +notify-send "Recording window $(xdotool getwindowname $win)" diff --git a/dot_config/herbstluftwm/executable_autostart.tmpl b/dot_config/herbstluftwm/executable_autostart.tmpl index 6b1831f..17b9116 100644 --- a/dot_config/herbstluftwm/executable_autostart.tmpl +++ b/dot_config/herbstluftwm/executable_autostart.tmpl @@ -146,6 +146,7 @@ hc keybind Print spawn systemd-run --scope --user sh -c 'maim --hidecursor | xcl hc keybind Shift-Print spawn systemd-run --scope --user sh -c 'maim --select --hidecursor | xclip -t image/png -selection clip' # shellcheck disable=SC2016 hc keybind Ctrl-Print spawn systemd-run --scope --user sh -c 'maim -i $(xdotool getactivewindow) | xclip -t image/png -selection clip' +hc keybind Ctrl-Print spawn systemd-run --scope --user sh -c "$HOME/bin/recordcurrwin"f=documents recordmydesktop --windowid=$(xdotool getactivewindow) | xclip -t image/png -selection clip # theme hc attr theme.tiling.reset 1