diff --git a/.config/i3/config b/.config/i3/config index 26734833a429ccff735aa502e926453a0558e429..33b1b12383e6a92f8baead3793f852c32d677925 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -164,9 +164,9 @@ client.unfocused $dark $dark $light $light client.focused_inactive $dark $dark $light $light client.urgent $secondary $secondary $light $light -# Workspace 1 only has floating windows -for_window [workspace="1"] floating enable +# Workspaces with only floating windows +for_window [workspace="^(1|5)$"] floating enable # Expections for opening in floating mode where XSetClassHint is set to floating -for_window [class="^(mpv|SimpleScreenRecorder|Thunar|transmission|Xmagnify)$"] floating enable +for_window [class="^(floating|mpv|SimpleScreenRecorder|Thunar|transmission|Xmagnify)$"] floating enable for_window [title="^(Stalag|game)$"] floating enable diff --git a/.shenanigans.sh b/.shenanigans.sh index ebd0b68047706eb5ee27e35ac8239a5e64f4c33f..d409727d0889c90d97d305ec095cf26695d8c176 100755 --- a/.shenanigans.sh +++ b/.shenanigans.sh @@ -1,5 +1,5 @@ # Software list: -# xss-lock xkbset xclip xsel cifs-utils picom +# xss-lock xkbset xclip xsel xwininfo cifs-utils picom ffmpeg # vim git tmux maim mc htop entr rsync jq rofi stow newsboat # st rsync curl hstr tree make gdb nvtop ctags mpv lazygit fd @@ -83,3 +83,29 @@ printf "%-18s %s\n" "Brisbane:" "$(TZ='Australia/Brisbane' date +'%a %H:%M')" printf "%-18s %s\n" "San Francisco:" "$(TZ='America/Los_Angeles' date +'%a %H:%M')" printf "%-18s %s\n" "New York:" "$(TZ='America/New_York' date +'%a %H:%M')" } + +record() { + mkdir -p "$HOME/Videos" + win=$(xwininfo -int | awk '/Window id:/{print $4; exit}') + [ -z "$win" ] && { echo "no window picked"; exit 1; } + + eval $( + xwininfo -id "$win" | awk ' + /Absolute upper-left X:/{x=$4} + /Absolute upper-left Y:/{y=$4} + /Width:/{w=$2} + /Height:/{h=$2} + END{printf("X=%s;Y=%s;W=%s;H=%s\n", x, y, w, h)} + ' + ) + + if [ -z "$W" ] || [ -z "$H" ]; then + echo "failed to get geometry"; exit 1 + fi + + ts=$(date '+%F-%H-%M-%S') + out="$HOME/Videos/record-${ts}.mp4" + echo "Recording ${W}x${H}+${X},${Y} -> ${out}" + + ffmpeg -y -f x11grab -video_size "${W}x${H}" -framerate 60 -i "${DISPLAY:-:0.0}+${X},${Y}" -c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p "$out" +}