- SUPER+PRINT records an area, SUPER+SHIFT+PRINT the monitor; the same keys stop it (scripts/record.sh, wf-recorder, saved to ~/Videos/Recordings) - SUPER+SHIFT+C picks a colour to the clipboard (hyprpicker) - SUPER+SHIFT+F maximizes inside the hull, SUPER+O pins, SUPER+ALT+hjkl resizes - rules for browser Picture-in-Picture, the GTK portal file chooser, the polkit prompt and Steam games; dialogs open at 1100x720 instead of 800x600 - three-finger horizontal swipe between workspaces on the touchpad - the KBD67 resolves binds by symbol like the other keyboards, so binds stay put when switching between dvorak and us-intl
57 lines
1.7 KiB
Bash
Executable File
57 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Screen recording as a toggle: the first press picks an area and starts
|
|
# wf-recorder, the next press stops it and answers with a notification that
|
|
# opens the file or its folder.
|
|
#
|
|
# record.sh region pick an area (the default)
|
|
# record.sh screen the focused monitor
|
|
#
|
|
# Recordings land in ~/Videos/Recordings. Cancelling the picker does nothing.
|
|
|
|
set -eu
|
|
|
|
dir="$HOME/Videos/Recordings"
|
|
pidfile="${XDG_RUNTIME_DIR:-/tmp}/record.pid"
|
|
lastfile="${XDG_RUNTIME_DIR:-/tmp}/record.last"
|
|
|
|
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
|
# SIGINT lets wf-recorder finish the container instead of leaving a
|
|
# truncated file.
|
|
kill -INT "$(cat "$pidfile")"
|
|
while kill -0 "$(cat "$pidfile")" 2>/dev/null; do sleep 0.1; done
|
|
rm -f "$pidfile"
|
|
file=$(cat "$lastfile")
|
|
(
|
|
choice=$(notify-send -a Recorder --action=open=Open --action=folder=Folder \
|
|
"Recording saved" "${file#"$HOME"/}") || exit 0
|
|
case "$choice" in
|
|
open) xdg-open "$file" ;;
|
|
folder) xdg-open "$dir" ;;
|
|
esac
|
|
) >/dev/null 2>&1 &
|
|
exit 0
|
|
fi
|
|
|
|
case "${1:-region}" in
|
|
region)
|
|
geometry=$(slurp) || exit 0
|
|
set -- -g "$geometry"
|
|
;;
|
|
screen)
|
|
output=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')
|
|
set -- -o "$output"
|
|
;;
|
|
*)
|
|
echo "usage: record.sh region|screen" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
mkdir -p "$dir"
|
|
file="$dir/$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
|
printf '%s\n' "$file" > "$lastfile"
|
|
|
|
wf-recorder "$@" -f "$file" >/dev/null 2>&1 &
|
|
echo $! > "$pidfile"
|
|
notify-send -a Recorder -t 2000 "Recording" "Press the same keys again to stop."
|