From 4a27844508c4b5d2937ea41dc838313fa3cf665e Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Tue, 3 Nov 2026 17:38:54 +0300 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! fixup! Install lucid --- modules/user/hyprland.nix | 2 +- modules/user/hyprland/lua.nix | 6 ++++++ modules/user/walker.nix | 6 ++++-- user/sweetbread/modules/hyprland.nix | 2 +- user/sweetbread/modules/lucid.nix | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/modules/user/hyprland.nix b/modules/user/hyprland.nix index 5712afd..56d5e8c 100644 --- a/modules/user/hyprland.nix +++ b/modules/user/hyprland.nix @@ -153,7 +153,7 @@ in { bind = [ (bind "SUPER + V" (exec "ghostty --title=clipse -e clipse")) - (bind "SUPER + SHIFT + V" (exec "qs ipc call launcher clipboard")) + (hyprLua.bind "SUPER + SHIFT + V" (hyprLua.execLauncher "qs ipc call launcher clipboard")) (bind "Print" (exec "qs ipc call snap toggle")) (bind "SUPER + Print" (exec "qs ipc call screenshot full")) (bind "CTRL + Print" (exec "qs ipc call snap region")) diff --git a/modules/user/hyprland/lua.nix b/modules/user/hyprland/lua.nix index b704222..e9581f8 100644 --- a/modules/user/hyprland/lua.nix +++ b/modules/user/hyprland/lua.nix @@ -7,6 +7,12 @@ in rec { exec = command: "hl.dsp.exec_cmd(${quote command})"; + # Hyprland 0.57 can leave exclusive layer-shell launchers unfocused when + # follow_mouse = 1 and the pointer is already over a regular window. + execLauncher = command: '' + hl.dsp.exec_cmd(${quote ("hyprctl eval 'hl.config({ input = { follow_mouse = 2 } })' && " + command)}) + ''; + bind = keys: dispatcher: { _args = [ keys diff --git a/modules/user/walker.nix b/modules/user/walker.nix index 020f5f5..8b7b317 100644 --- a/modules/user/walker.nix +++ b/modules/user/walker.nix @@ -189,7 +189,9 @@ in { }; wayland.windowManager.hyprland.settings.bind = [ - (hyprLua.bind "SUPER + D" (hyprLua.exec - (if config.home.username == "sweetbread" then "qs ipc call launcher toggle" else "walker"))) + (hyprLua.bind "SUPER + D" + (if config.home.username == "sweetbread" + then hyprLua.execLauncher "qs ipc call launcher toggle" + else hyprLua.exec "walker")) ]; } diff --git a/user/sweetbread/modules/hyprland.nix b/user/sweetbread/modules/hyprland.nix index b4bcb88..8dac53c 100644 --- a/user/sweetbread/modules/hyprland.nix +++ b/user/sweetbread/modules/hyprland.nix @@ -199,7 +199,7 @@ ]; bind = [ - (hyprLua.bind "SUPER + W" (hyprLua.exec "qs ipc call launcher wallpaper")) + (hyprLua.bind "SUPER + W" (hyprLua.execLauncher "qs ipc call launcher wallpaper")) (hyprLua.bind "SUPER + SHIFT + W" (hyprLua.exec "${lib.getExe wallpaper_changer}")) ]; }; diff --git a/user/sweetbread/modules/lucid.nix b/user/sweetbread/modules/lucid.nix index 4c34a94..39ebed8 100644 --- a/user/sweetbread/modules/lucid.nix +++ b/user/sweetbread/modules/lucid.nix @@ -146,6 +146,25 @@ in { echo "Lucid launcher application scan pattern changed; refusing to skip Nix profiles" >&2 exit 1 fi + keyboard_focus='WlrLayershell.keyboardFocus: dockWindow.menuOpen ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None' + keyboard_focus_fixed='WlrLayershell.keyboardFocus: dockWindow.menuOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None' + if grep -Fq "$keyboard_focus" "$dock_qml"; then + $DRY_RUN_CMD sed -i \ + 's/WlrLayershell.keyboardFocus: dockWindow.menuOpen ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None/WlrLayershell.keyboardFocus: dockWindow.menuOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None/' \ + "$dock_qml" + elif ! grep -Fq "$keyboard_focus_fixed" "$dock_qml"; then + echo "Lucid launcher keyboard focus pattern changed; refusing to skip focus fix" >&2 + exit 1 + fi + if ! grep -Fq 'Nix focus workaround for Hyprland 0.57' "$dock_qml"; then + if [ "$(grep -Fxc ' onMenuOpenChanged: {' "$dock_qml")" -ne 1 ]; then + echo "Lucid menu-open handler changed; refusing to skip focus workaround" >&2 + exit 1 + fi + $DRY_RUN_CMD sed -i '/ onMenuOpenChanged: {/a\ + // Nix focus workaround for Hyprland 0.57: detach pointer and keyboard focus while menus are open.\ + Quickshell.execDetached(["hyprctl", "eval", "hl.config({ input = { follow_mouse = " + (dockWindow.menuOpen ? 2 : 1) + " } })"]);' "$dock_qml" + fi $DRY_RUN_CMD install -m644 ${../../../modules/user/lucid-shell.qml} "$target/shell.qml" $DRY_RUN_CMD install -m644 ${../../../modules/user/LucidBar.qml} "$target/LucidBar.qml" $DRY_RUN_CMD mkdir -p "${wallpaperDir}" \