Compare commits

..

6 Commits

Author SHA1 Message Date
Amir Alexander Abdelbaki 654606df86 fix(hyprlua): spawn filepicker floating, compact, centred on the cursor
The dialog was landing off-cursor and at ~half-screen. Two Hyprland
gotchas were fighting each other: `move` is evaluated against the
window's natural size and `size` is applied afterwards from the top-left,
so a cursor_x-(window_w/2) move centred the pre-shrink window. zenity's
file chooser also ignores --width/--height and has a ~738x363 GTK
minimum.

Fix the size at 760x460 and hard-code the move offsets to half that
(380x230) so the shrunk window lands exactly on the pointer. Drop the
dead zenity --width/--height sizing from the script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 15:06:37 +02:00
Amir Alexander Abdelbaki 54338f3602 feat(hyprlua): size filepicker dialog to 5% of the display
Add a size rule alongside the move so the zenity dialog no longer opens
at its default ~50% size. zenity clamps to its GTK minimum (~738x363),
which is well under half the screen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:58:06 +02:00
Amir Alexander Abdelbaki d9e6ee0f10 feat(hyprlua): move filepicker dialog to 5% of the display
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:52:52 +02:00
Amir Alexander Abdelbaki 8900fe0004 feat(hyprlua): spawn filepicker dialog at 10% of the display
Rename the at-cursor rule to filepicker and move the dialog to a fixed
position 10% into the display (from the top-left) instead of following
the cursor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:51:55 +02:00
Amir Alexander Abdelbaki 3324e669bb feat(hyprlua): spawn filepicker dialog at cursor via +at-cursor tag
Add a dedicated at-cursor window rule (float + move to cursor) and point
the Super+F / Super+Shift+F filepicker binds at it, so the zenity dialog
opens centered on the mouse instead of mid-screen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:50:10 +02:00
Amir Alexander Abdelbaki 403023c096 feat(hyprlua): float filepicker-to-clipboard dialog via +centered tag
Prefix the Super+F / Super+Shift+F filepicker binds with [tag +centered]
so the zenity dialog spawns as a centered floating window (60% x 60%),
matching the centered rule in windowrules.lua. Same tagged-spawn
mechanism as Super+U.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 14:48:49 +02:00
3 changed files with 19 additions and 2 deletions

View File

@ -52,8 +52,8 @@ hl.bind(mainMod .. " + SHIFT + R", hl.dsp.exec_cmd("wofi --show drun"))
hl.bind("CTRL + SHIFT + R", hl.dsp.exec_cmd(menu))
-- File picker dialog -> clipboard (path / contents)
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/scripts/filepicker-clipboard.sh path"))
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("~/.config/scripts/filepicker-clipboard.sh content"))
hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("[tag +filepicker] ~/.config/scripts/filepicker-clipboard.sh path"))
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("[tag +filepicker] ~/.config/scripts/filepicker-clipboard.sh content"))
-- old:
-- hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/scripts/wofi-file-search.sh"))
-- hl.bind(mainMod .. " + SHIFT + F", hl.dsp.exec_cmd("~/.config/scripts/foldersearch.sh"))

View File

@ -73,6 +73,22 @@ hl.window_rule({
size = "(monitor_w*0.2) (monitor_h*0.2)",
})
-- 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,
size = "760 460",
move = "(cursor_x-380) (cursor_y-230)",
})
-- spotify floating
hl.window_rule({
name = "spotify-float",

View File

@ -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