omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

[hyprland] `omarchy-hyprland-window-pop` state desync on already-floating windows

Open on370 opened this issue 3 months ago • 3 comments

System details

2012 MBP i7 4 GB RAM

What's wrong?

Metadata

  • Date: 2026-08-31
  • Component: hyprland (/usr/share/omarchy/bin/omarchy-hyprland-window-pop, SUPER + O)
  • Severity: Medium
  • Reproducibility: Deterministic (100% reproducible on any app with +floating-window tag)
  • Status: Checked & locally verified (Fix ready)
  • Upstream Issue / PR: Ready for upstream submission

System Environment

  • Distribution: Omarchy Quattro
  • Version: 4.0.2 (/usr/share/omarchy/version)
  • Desktop / Compositor: Hyprland
  • Affected Applications: All windows pre-configured as floating (Bitwarden, 1Password, About, org.omarchy.about, Tensaku, dialogs)

Problem Description

The keybinding SUPER + O invokes /usr/share/omarchy/bin/omarchy-hyprland-window-pop to "pop out" a tiled window into a larger, centered, and pinned (sticky across all workspaces) floating window.

However, when SUPER + O is used on a window that is already floating by default (such as Bitwarden or 1Password), the script's logic desynchronizes:

  1. 1st press: Window turns into a tiled (fullscreen-sized) window instead of popping out.
  2. 2nd press: Window turns into a medium-sized floating window (1300x900) but becomes pinned across all virtual workspaces, obscuring applications on every other workspace.
  3. The toggle behavior is inverted and requires multiple presses to cycle out of the corrupted state.

Steps to Reproduce

  1. Open Bitwarden (or any pre-configured floating app) on an empty workspace.
    • Initial state: floating = true, pinned = false, size = 875x600.
  2. Press SUPER + O (1st time).
    • Observe: Bitwarden expands to fill the workspace as a tiled window. It is NOT pinned because Hyprland ignores pin requests on tiled windows.
  3. Switch to another workspace — Bitwarden stays on its original workspace.
  4. Press SUPER + O (2nd time).
    • Observe: Bitwarden becomes floating at 1300x900.
  5. Switch to other virtual workspaces.
    • Bug: Bitwarden is now pinned and follows the user across ALL workspaces, sitting on top of other running applications.

Technical Context & Root Cause Analysis

Code in /usr/share/omarchy/bin/omarchy-hyprland-window-pop:

active=$(hyprctl activewindow -j)
pinned=$(echo "$active" | jq ".pinned")
addr=$(echo "$active" | jq -r ".address")
window="address:$addr"

if [[ $pinned == "true" ]]; then
  hypr_dispatch "hl.dsp.window.pin({ window = \"$window\" })" pin "$window"
  hypr_dispatch "hl.dsp.window.float({ window = \"$window\", action = \"toggle\" })" togglefloating "$window"
  hypr_dispatch "hl.dsp.window.tag({ window = \"$window\", tag = \"-pop\" })" tagwindow -pop "$window"
elif [[ -n $addr ]]; then
  hypr_dispatch "hl.dsp.window.float({ window = \"$window\", action = \"toggle\" })" togglefloating "$window"
  hypr_dispatch "hl.dsp.window.resize({ window = \"$window\", x = $width, y = $height })" resizeactive exact "$width" "$height" "$window"
  # ...
  hypr_dispatch "hl.dsp.window.pin({ window = \"$window\" })" pin "$window"
  hypr_dispatch "hl.dsp.window.alter_zorder({ window = \"$window\", mode = \"top\" })" alterzorder top "$window"
  hypr_dispatch "hl.dsp.window.tag({ window = \"$window\", tag = \"+pop\" })" tagwindow +pop "$window"
fi

Why the logic breaks:

  1. Flawed Assumption: The script assumes that if pinned == false, the window MUST be a tiled window, so it unconditionally calls togglefloating.
  2. First invocation on a floating window:
    • Because pinned == false, it enters the elif branch.
    • togglefloating toggles the already-floating window into a tiled window!
    • It then attempts pin "$window". However, in Hyprland, the pin dispatcher is only valid for floating windows. Hyprland rejects pinning the tiled window, leaving pinned: false.
  3. Second invocation:
    • Since pinned is STILL false, it enters the elif branch AGAIN.
    • togglefloating toggles the tiled window back to floating.
    • resize sets size to 1300x900.
    • pin "$window" now succeeds because the window is floating.
    • Result: The window is now floating and pinned across all virtual workspaces.

Proposed & Verified Fix

Track pop-out state via the pop tag or pinned status, strip Hyprland's active tag asterisks (*), and check whether the application is marked with the floating-window tag:

#!/bin/bash

# omarchy:summary=Toggle to pop-out a tile to stay fixed on a display basis.
# omarchy:args=[width height x y]

width=${1:-1300}
height=${2:-900}
x=${3:-}
y=${4:-}

active=$(hyprctl activewindow -j)
addr=$(echo "$active" | jq -r ".address // empty")
[[ -n $addr ]] || exit 0

window="address:$addr"
pinned=$(echo "$active" | jq -r ".pinned")
floating=$(echo "$active" | jq -r ".floating")
tags_clean=$(echo "$active" | jq -r ".tags[]?" 2>/dev/null | tr -d '*' || true)

is_popped=false
if echo "$tags_clean" | grep -qx "pop" || [[ $pinned == "true" ]]; then
  is_popped=true
fi

is_default_floating=false
if echo "$tags_clean" | grep -qx "floating-window"; then
  is_default_floating=true
fi

hypr_dispatch() {
  local lua="$1"
  shift

  hyprctl dispatch "$lua" >/dev/null 2>&1 || hyprctl dispatch "$@" >/dev/null
}

if [[ $is_popped == "true" ]]; then
  # --- UNPOP ---
  if [[ $pinned == "true" ]]; then
    hypr_dispatch "hl.dsp.window.pin({ window = \"$window\" })" pin "$window"
  fi
  hypr_dispatch "hl.dsp.window.tag({ window = \"$window\", tag = \"-pop\" })" tagwindow -pop "$window"

  if [[ $is_default_floating == "true" ]]; then
    # Default floating app: restore default size (875x600) and ensure floating
    if [[ $floating != "true" ]]; then
      hypr_dispatch "hl.dsp.window.float({ window = \"$window\", action = \"toggle\" })" togglefloating "$window"
    fi
    hypr_dispatch "hl.dsp.window.resize({ window = \"$window\", x = 875, y = 600 })" resizeactive exact 875 600 "$window"
    hypr_dispatch "hl.dsp.window.center({ window = \"$window\" })" centerwindow "$window"
  else
    # Tiled app: return to tiled
    if [[ $floating == "true" ]]; then
      hypr_dispatch "hl.dsp.window.float({ window = \"$window\", action = \"toggle\" })" togglefloating "$window"
    fi
  fi
else
  # --- POP OUT ---
  if [[ $floating != "true" ]]; then
    hypr_dispatch "hl.dsp.window.float({ window = \"$window\", action = \"toggle\" })" togglefloating "$window"
  fi

  hypr_dispatch "hl.dsp.window.resize({ window = \"$window\", x = $width, y = $height })" resizeactive exact "$width" "$height" "$window"

  if [[ -n $x && -n $y ]]; then
    hypr_dispatch "hl.dsp.window.move({ window = \"$window\", x = $x, y = $y })" moveactive "$x" "$y" "$window"
  else
    hypr_dispatch "hl.dsp.window.center({ window = \"$window\" })" centerwindow "$window"
  fi

  hypr_dispatch "hl.dsp.window.pin({ window = \"$window\" })" pin "$window"
  hypr_dispatch "hl.dsp.window.alter_zorder({ window = \"$window\", mode = \"top\" })" alterzorder top "$window"
  hypr_dispatch "hl.dsp.window.tag({ window = \"$window\", tag = \"+pop\" })" tagwindow +pop "$window"
fi

on370 avatar Aug 31 '26 17:08 on370

This looks covered by open PR #7910 (window-pop: don't tile an already-floating window), which reads floating and skips togglefloating when the window is already floating.

Leaving this here rather than opening a second PR on bin/omarchy-hyprland-window-pop.

Elshayib avatar Aug 31 '26 18:08 Elshayib

#7910 covers the first-press tile of an already-floating window (skip togglefloating when floating is already true). It still leaves unpop as pinned==true only: a default-floating app (floating-window tag) that got pinned still unpops by togglefloating, so Bitwarden/1Password become tiled instead of restoring ~875x600 unpinned.

If #7910 lands as-is, a follow-up should skip tiling on unpop when the window is tagged floating-window (or was floating at pop). I am not opening a second PR on bin/omarchy-hyprland-window-pop while #7910 is open.

kvnloo avatar Sep 04 '26 19:09 kvnloo

Thanks for the detailed write-up. I checked it against bin/omarchy-hyprland-window-pop on quattro, and the mechanism is as you describe. The script runs togglefloating whenever the window isn't pinned, so on an already-floating window the first SUPER+O tiles it and the pin is dropped, and the second press floats and pins it.

That part is fixed by open pull request #7910, which skips the toggle when the window is already floating. It already lists this issue as one it closes. An earlier review verified it on a worker running a stock Omarchy install: the bug reproduces on quattro, and with the branch the window pops out floating, pinned and at 1300x900. #7721 reports the same first-press behaviour with Steam. #5884 and #9968 make the same guard, and choosing between the three is up to the maintainer.

One part of your report isn't covered by any of them. With #7910 or #9968, popping Bitwarden back in with SUPER+O leaves it tiled rather than floating at 875x600. #9968 says explicitly that leaving pop always tiles. Whether a default-floating app should go back to floating is a behaviour decision for the maintainer, so I haven't opened a fix for it. If they want it, the proposed script in the issue needs two changes first. It treats any pinned window as popped, so a window pinned by hand would be unpinned and tiled. And floating-window doesn't record the window's state before it was popped: Steam floats without that tag, a tagged app the user had tiled would come back floating, and org.omarchy.about opens at 920x480 rather than 875x600.

I read the script and the three pull requests against this report, and ran nothing for this issue. Codex Medium reviewed it as a second opinion and agreed that #7910 fixes the reproduction. The points about the proposed script are its findings, which I checked against default/hypr/apps/. Its independence from this review is not guaranteed. This now waits on the maintainer: which of the three pull requests to take, and whether popping back in should restore a default-floating app.

omarchybot avatar Oct 09 '26 11:10 omarchybot