diff --git a/desktopenvs/hyprlua/hypr/usr/windowrules.lua b/desktopenvs/hyprlua/hypr/usr/windowrules.lua index b12d726..a08a9d7 100644 --- a/desktopenvs/hyprlua/hypr/usr/windowrules.lua +++ b/desktopenvs/hyprlua/hypr/usr/windowrules.lua @@ -73,13 +73,20 @@ hl.window_rule({ size = "(monitor_w*0.2) (monitor_h*0.2)", }) --- filepicker — float near the top-left, sized 5% of the display +-- filepicker — float, fixed 760x460, centred on the cursor. +-- The size and move must be kept in sync by hand: Hyprland evaluates `move` +-- using the window's *natural* size and only then applies `size`, resizing +-- from the top-left. Using cursor_x-(window_w/2) would therefore centre the +-- natural (~1274x714) window and leave the shrunk one off-cursor, so the +-- offsets below are hard-coded to half the final size (380x230). zenity's +-- file chooser ignores --width/--height and has a ~738x363 GTK minimum, so +-- 760x460 is about as small as it goes while landing exactly on the pointer. hl.window_rule({ name = "filepicker", match = { tag = "filepicker" }, float = true, - move = "(monitor_w*0.05) (monitor_h*0.05)", - size = "(monitor_w*0.05) (monitor_h*0.05)", + size = "760 460", + move = "(cursor_x-380) (cursor_y-230)", }) -- spotify floating diff --git a/desktopenvs/hyprlua/scripts/filepicker-clipboard.sh b/desktopenvs/hyprlua/scripts/filepicker-clipboard.sh index 35af8f7..d702063 100755 --- a/desktopenvs/hyprlua/scripts/filepicker-clipboard.sh +++ b/desktopenvs/hyprlua/scripts/filepicker-clipboard.sh @@ -9,6 +9,7 @@ set -euo pipefail mode="${1:-path}" # zenity exits non-zero on cancel/close -> treat as a no-op. +# Float/size/cursor-centering are handled by the +filepicker window rule. file="$(zenity --file-selection --title="Copy file ${mode} to clipboard")" || exit 0 [ -n "$file" ] || exit 0