.agents/
.cargo/
.codex/
.config/
.gnupg/
.local/
.vim/
bin/
ag
189 B
book-counter
112 B
cargo-flow
321 B
cargo-flow-check
422 B
colors
210 B
conky-sync-status
554 B
git-delete-merged
92 B
git-forest
13.1 KiB
haskell-tags
230 B
haskell-watch-build
125 B
haskell-watch-lint
151 B
kitty-reload
35 B
kitty-switch-theme
283 B
lock
288 B
mount-tank
78 B
pinentry
46 B
pkgbuild-dl
87 B
record-window
996 B
refresh-display
38 B
screenshot
127 B
screenshot-region
176 B
seedbox-mount
621 B
seedbox-status
129 B
set-background
90 B
share-sync
577 B
spectrwm-status
22 B
start-streaming
904 B
sync-up
661 B
todo
60 B
todo-widget
235 B
toggle-displays
1.5 KiB
tty-record
200 B
twitch
68 B
waybar-audio-output-selector
2.0 KiB
waybar-clipboard
847 B
waybar-screenshot
554 B
xmobar-brightness
191 B
xmobar-dropbox-status
152 B
xmobar-sync-status
304 B
etc/
images/
.dircolors
4.2 KiB
.fzy.zsh
1.1 KiB
.ghci
501 B
.gitconfig
2.2 KiB
.gitignore
0 B
.gitsigners
282 B
.ignore
136 B
.rgrc
174 B
.vimrc
12.7 KiB
.vimrc.lua
113 B
.wacom
260 B
bin/record-window
raw
| 1 | #!/usr/bin/env sh |
| 2 | set -eu |
| 3 | |
| 4 | FPS=${FPS:-16} |
| 5 | SCALE=${SCALE:-1} |
| 6 | CRF=${CRF:-21} |
| 7 | NAME=${1:-capture} |
| 8 | DISPLAY=${DISPLAY:-:0.0} |
| 9 | SLOP_OPTS=${SLOP_OPTS:-} |
| 10 | |
| 11 | need() { |
| 12 | command -v "$1" >/dev/null 2>&1 || { |
| 13 | printf "fatal: %s not found\n" "$1"; exit 1; |
| 14 | }; |
| 15 | } |
| 16 | |
| 17 | need slop |
| 18 | need ffmpeg |
| 19 | |
| 20 | # Pick region/window: "x y w h" |
| 21 | set -- $(slop $SLOP_OPTS -f '%x %y %w %h') || { printf "aborted\n"; exit 1; } |
| 22 | x=$1 y=$2 w=$3 h=$4 |
| 23 | |
| 24 | VF="crop=iw-2:ih-2:1:1,fps=${FPS},scale=trunc(iw*${SCALE}/2)*2:trunc(ih*${SCALE}/2)*2" |
| 25 | ts=$(date +"%Y%m%d-%H%M%S") |
| 26 | out="${NAME}-${ts}.webm" |
| 27 | |
| 28 | printf "recording… to %s (Ctrl-C)\n" "$out" |
| 29 | |
| 30 | # Run ffmpeg in the foreground so it handles Ctrl-C itself and finalizes cleanly |
| 31 | exec ffmpeg -v warning \ |
| 32 | -video_size "${w}x${h}" \ |
| 33 | -framerate "${FPS}" \ |
| 34 | -f x11grab -i "${DISPLAY}+${x},${y}" \ |
| 35 | -vf "${VF}" \ |
| 36 | -c:v libvpx-vp9 -crf "${CRF}" -b:v 0 \ |
| 37 | -row-mt 1 -tile-columns 2 -tile-rows 1 \ |
| 38 | -pix_fmt yuv420p \ |
| 39 | "${out}" |
| 40 | |
| 41 | # TIP: convert FILE.gif -strip -coalesce -layers Optimize OPTIMIZED.gif |