feat(hyprlua): float xdg portal dialogs above their parent

Portal-backed file/app choosers (xdg-desktop-portal-gtk) — e.g. Steam's
"select library folder" picker, plus Chromium/Electron/Flatpak dialogs —
run in a separate process and open as parentless top-levels with no
xdg-dialog or X11-dialog hint. Hyprland can't tell they're dialogs and
tiles them, unlike in-process xdg dialogs which it auto-floats. Match the
portal backend's class and float + centre it so it lands above its parent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-07-11 04:28:42 +02:00
parent 05693a71b7
commit bdecba0cf3
1 changed files with 15 additions and 0 deletions

View File

@ -89,6 +89,21 @@ hl.window_rule({
move = "(cursor_x-380) (cursor_y-230)",
})
-- xdg portal dialogs — float, centred on the monitor (i.e. above the parent).
-- The GTK portal backend (xdg-desktop-portal-gtk) serves native file/app/print
-- choosers for portal-driven apps: Steam ("select library folder"), Chromium/
-- Electron, Flatpak apps, etc. It runs in its *own* process, so the dialog opens
-- as a parentless top-level with no xdg-dialog/X11-dialog hint — Hyprland has no
-- signal that it's a dialog and would otherwise tile it (unlike in-process xdg
-- dialogs, which it auto-floats). Natural size is kept, so the centre offsets use
-- the real window_w/window_h (no `size` to skew them; see the filepicker note).
hl.window_rule({
name = "xdg-portal-dialog",
match = { class = "xdg-desktop-portal-gtk" },
float = true,
move = "(monitor_w/2 - window_w/2) (monitor_h/2 - window_h/2)",
})
-- spotify floating
hl.window_rule({
name = "spotify-float",