omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Screenshot picker offers rectangles for windows hidden behind a maximized/fullscreen window

Open Ethanxu1 opened this issue 3 months ago • 1 comments

System details

Omarchy: 4.0.0-1 Hyprland: 0.56.2 (v0.56.2, commit efb50993780079460b0cbed1363e2166a2de1d9f), Kernel: 7.1.8-arch1-3

What's wrong?

What happened

When a workspace has a maximized or fullscreened window on top of other windows, omarchy screenshot (and omarchy capture screenshot windows) still lets you select rectangles for the windows underneath, even though they are not visible on screen. The picker "snaps" to a window that is completely covered.

What I expected

Only the maximized/fullscreen window's rectangle should be selectable while it's covering the workspace, since anything underneath isn't actually visible.

Steps to reproduce

  1. Open two or more windows on the same workspace.
  2. Maximize one (SUPER + ALT + F, i.e. hl.dsp.window.fullscreen({ mode = "maximized" })).
  3. Run omarchy screenshot (or the "windows" capture mode) and hover/click where a covered window used to be.
  4. The picker highlights and lets you select the hidden window's old rectangle, not just the maximized window on top.

Root cause

bin/omarchy-capture-region's window_rects() builds selectable rectangles from hyprctl clients -j, filtering only on hidden != true:

window_rects() {
  hyprctl clients -j | jq -r --arg ws "$(active_workspace)" \
    '[.[] | select(.workspace.id == ($ws | tonumber) and .hidden != true) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"] | unique[]'
}

Hyprland's hidden field does not track occlusion by a fullscreen/maximized sibling — a window covered by a maximized window on the same workspace still reports hidden: false in hyprctl clients -j. So window_rects() (used by get_rectangles, geo_at_cursor, and the --select-window Tab-cycling) keeps offering rectangles for windows that aren't actually visible.

Confirmed against the current bin/omarchy-capture-region on the quattro branch — the bug is present in the latest source, not just an older release.

Suggested fix

In window_rects(), when any window on the workspace is fullscreen/maximized, only emit that window's rectangle:

window_rects() {
  hyprctl clients -j | jq -r --arg ws "$(active_workspace)" '
    [ .[] | select(.workspace.id == ($ws | tonumber) and .hidden != true) ] as $ws_windows |
    if ($ws_windows | any(.fullscreen == 1 or .fullscreen == true)) then
      $ws_windows | map(select(.fullscreen == 1 or .fullscreen == true))
    else
      $ws_windows
    end |
    map("\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])") | unique[]
  '
}

(fullscreen is an int in some Hyprland versions and a bool in others, hence checking both.)

Ethanxu1 avatar Aug 25 '26 19:08 Ethanxu1

I checked this against current quattro (c352b62d) and Omasnap main (6771b19) by reading the source. Nothing was run on a worker for this issue. Codex Medium reviewed the same code as a second opinion and reached the same conclusions. It saw mine first, so its independence is not guaranteed.

This bug is still there, but in different code. Since 2026-08-31 (e265934bb, "Use Omasnap for screenshots"), omarchy screenshot and omarchy capture screenshot windows run exec omasnap and no longer go through bin/omarchy-capture-region. Omasnap builds its window list in parseWindows() (src/capture.cpp:449), which keeps every client on the active workspace and checks neither hidden nor visible. So windows covered by a maximized or fullscreen sibling stay in the list:

  • Super+Arrow navigation (src/editor.cpp:2616) considers every window in that list, so it can always land on a covered one.
  • Hover, click and Smart-mode snapping use windowAt() (src/editor.cpp:2606). It returns the last window in hyprctl clients order that contains the pointer, and that order is not stacking order. A covered window opened after the maximized one therefore wins wherever the two overlap.
  • Choosing a covered window captures the maximized window's pixels, cropped to the covered window's rectangle.

#12512 fixes part of this. It changes window_rects() to filter on .visible == true, and that fixes the picker screen recording still uses. Hyprland 0.56.2 reports covered windows as hidden: false, visible: false. That was checked on a worker when #12512 was reviewed. But #12512 does not reach the screenshot picker this issue reports. Omasnap's window discovery needs the same filter, and that change belongs in the Omasnap repository, which omabot does not work in. No issue or pull request for it exists there yet.

This waits on the maintainer to decide where the Omasnap fix gets tracked. #12512 is being handled as its own item.

omarchybot avatar Oct 09 '26 02:10 omarchybot