From ca0cf8bff9defc9eed66c12a7f39c9ba39bf6c5f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 17 Jul 2026 18:16:53 -0700 Subject: [PATCH] Fix webcam resize controls and placement --- bin/omarchy-capture-screenrecording | 3 +-- default/hypr/apps/webcam-overlay.lua | 20 +++++++++++++++++--- default/hypr/bindings/utilities.lua | 4 ++-- test/shell.d/screenrecording-test.sh | 16 ++++++++++++++-- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index b41b93b2..478c93f7 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -86,11 +86,10 @@ start_webcam_overlay() { --profile=low-latency --untimed --no-cache \ --demuxer-lavf-o="$capture_options" \ '--vf=lavfi=[crop=ih*8/9:ih]' \ - --title="WebcamOverlay" \ + --title="WebcamOverlay" --wayland-app-id="WebcamOverlay-$WEBCAM_SIZE" \ --no-border --no-audio --no-osc --osd-level=0 \ --really-quiet &>/dev/null & sleep 1 - omarchy-capture-webcam-resize "$WEBCAM_SIZE" } cleanup_webcam() { diff --git a/default/hypr/apps/webcam-overlay.lua b/default/hypr/apps/webcam-overlay.lua index 4e0ce501..27fcc64d 100644 --- a/default/hypr/apps/webcam-overlay.lua +++ b/default/hypr/apps/webcam-overlay.lua @@ -1,10 +1,24 @@ --- Webcam overlay window. -o.window({ title = "WebcamOverlay" }, { +-- Initial sizes mirror the live presets in omarchy-capture-webcam-resize. +o.window("^WebcamOverlay-small$", { + size = { 240, 270 }, + move = { "(monitor_w-240-40)", "(monitor_h-270-40)" }, +}) +o.window("^WebcamOverlay-medium$", { + size = { 360, 405 }, + move = { "(monitor_w-360-40)", "(monitor_h-405-40)" }, +}) +o.window("^WebcamOverlay-large$", { + size = { 480, 540 }, + move = { "(monitor_w-480-40)", "(monitor_h-540-40)" }, +}) + +-- The dedicated app id keeps this out of mpv's generic centered floating rules, +-- so the camera appears at its final corner position. +o.window({ class = "^WebcamOverlay-(small|medium|large)$", title = "^WebcamOverlay$" }, { tag = "-default-opacity", float = true, pin = true, no_initial_focus = true, no_dim = true, opacity = "1 1", - move = { "(monitor_w-window_w-40)", "(monitor_h-window_h-40)" }, }) diff --git a/default/hypr/bindings/utilities.lua b/default/hypr/bindings/utilities.lua index 482ceb4f..8a948ec0 100644 --- a/default/hypr/bindings/utilities.lua +++ b/default/hypr/bindings/utilities.lua @@ -38,8 +38,8 @@ o.bind("switch:off:Lid Switch", nil, "omarchy-hyprland-monitor-clamshell", { loc o.bind("PRINT", "Screenshot", "omarchy-capture-screenshot") o.bind("ALT + PRINT", "Screenrecording", "omarchy-capture-screenrecording --stop-recording || omarchy-menu toggle trigger.capture.screenrecord") -o.bind("SUPER + ALT + code:26", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller") -o.bind("SUPER + ALT + code:27", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger") +o.bind("SUPER + ALT + code:34", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller") +o.bind("SUPER + ALT + code:35", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger") o.bind("SUPER + PRINT", "Color picker", "pkill hyprpicker || hyprpicker -a") o.bind("SUPER + CTRL + PRINT", "Extract text (OCR) from screenshot", "omarchy-capture-text") diff --git a/test/shell.d/screenrecording-test.sh b/test/shell.d/screenrecording-test.sh index c32a502f..2e8ec40b 100644 --- a/test/shell.d/screenrecording-test.sh +++ b/test/shell.d/screenrecording-test.sh @@ -119,8 +119,20 @@ if [[ -s $OMARCHY_TEST_HYPRCTL_ARGS ]]; then fi pass "webcam resize ignores other windows" -grep -F 'o.bind("SUPER + ALT + code:26", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller")' \ +grep -F 'o.bind("SUPER + ALT + code:34", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller")' \ "$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam smaller hotkey is configured" -grep -F 'o.bind("SUPER + ALT + code:27", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger")' \ +grep -F 'o.bind("SUPER + ALT + code:35", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger")' \ "$ROOT/default/hypr/bindings/utilities.lua" >/dev/null || fail "webcam larger hotkey is configured" pass "webcam resize hotkeys are configured" + +grep -F -- '--wayland-app-id="WebcamOverlay-$WEBCAM_SIZE"' \ + "$ROOT/bin/omarchy-capture-screenrecording" >/dev/null || fail "webcam uses a dedicated size-specific app id" + +webcam_rules="$ROOT/default/hypr/apps/webcam-overlay.lua" +grep -F 'move = { "(monitor_w-240-40)", "(monitor_h-270-40)" }' "$webcam_rules" >/dev/null || \ + fail "small webcam starts at its final corner position" +grep -F 'move = { "(monitor_w-360-40)", "(monitor_h-405-40)" }' "$webcam_rules" >/dev/null || \ + fail "medium webcam starts at its final corner position" +grep -F 'move = { "(monitor_w-480-40)", "(monitor_h-540-40)" }' "$webcam_rules" >/dev/null || \ + fail "large webcam starts at its final corner position" +pass "webcam size rules place the initial window in its final corner"