hyprland: route shell actions through wrapper

This commit is contained in:
2026-04-29 13:31:48 -07:00
parent d9ebb812c5
commit 52861430da
4 changed files with 106 additions and 11 deletions

View File

@@ -19,8 +19,9 @@ monitor=,preferred,auto,1
# ============================================================================= # =============================================================================
$terminal = ghostty --gtk-single-instance=false $terminal = ghostty --gtk-single-instance=false
$fileManager = dolphin $fileManager = dolphin
$menu = rofi -show drun -show-icons $shellUi = hypr_shell_ui
$runMenu = rofi -show run $menu = $shellUi launcher
$runMenu = $shellUi run
# ============================================================================= # =============================================================================
# ENVIRONMENT VARIABLES # ENVIRONMENT VARIABLES
@@ -245,6 +246,8 @@ $hyper = SUPER CTRL ALT
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
bind = $mainMod, P, exec, $menu bind = $mainMod, P, exec, $menu
bind = $mainMod SHIFT, P, exec, $runMenu bind = $mainMod SHIFT, P, exec, $runMenu
bind = $hyper SHIFT, N, exec, $shellUi control-center
bind = $hyper CTRL, N, exec, $shellUi settings
bind = $mainMod SHIFT, Return, exec, $terminal bind = $mainMod SHIFT, Return, exec, $terminal
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -423,9 +426,9 @@ bind = $mainMod SHIFT, Z, movewindow, mon:+1
# WINDOW MANAGEMENT # WINDOW MANAGEMENT
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
bind = $mainMod, G, exec, hypr_rofi_window go bind = $mainMod, G, exec, $shellUi window go
bind = $mainMod, B, exec, hypr_rofi_window bring bind = $mainMod, B, exec, $shellUi window bring
bind = $mainMod SHIFT, B, exec, hypr_rofi_window replace bind = $mainMod SHIFT, B, exec, $shellUi window replace
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# MEDIA KEYS # MEDIA KEYS

View File

@@ -3,8 +3,9 @@ local mod_alt = "SUPER + ALT"
local hyper = "SUPER + CTRL + ALT" local hyper = "SUPER + CTRL + ALT"
local terminal = "ghostty --gtk-single-instance=false" local terminal = "ghostty --gtk-single-instance=false"
local menu = "rofi -show drun -show-icons" local shell_ui_command = "hypr_shell_ui"
local run_menu = "rofi -show run" local launcher_command = shell_ui_command .. " launcher"
local run_menu = shell_ui_command .. " run"
local max_workspace = 9 local max_workspace = 9
local scratchpad_top_margin = 60 local scratchpad_top_margin = 60
@@ -1486,8 +1487,10 @@ local function apply_rules()
}) })
end end
bind(main_mod .. " + P", exec(menu)) bind(main_mod .. " + P", exec(launcher_command))
bind(main_mod .. " + SHIFT + P", exec(run_menu)) bind(main_mod .. " + SHIFT + P", exec(run_menu))
bind(hyper .. " + SHIFT + N", exec(shell_ui_command .. " control-center"))
bind(hyper .. " + CTRL + N", exec(shell_ui_command .. " settings"))
bind(main_mod .. " + SHIFT + Return", exec(terminal)) bind(main_mod .. " + SHIFT + Return", exec(terminal))
bind(main_mod .. " + Q", exec("hyprctl reload")) bind(main_mod .. " + Q", exec("hyprctl reload"))
bind(main_mod .. " + SHIFT + C", hl.dsp.window.close()) bind(main_mod .. " + SHIFT + C", hl.dsp.window.close())
@@ -1496,9 +1499,9 @@ bind(main_mod .. " + E", exec("emacsclient --eval '(emacs-everywhere)'"))
bind(main_mod .. " + V", exec("wl-paste | xdotool type --file -")) bind(main_mod .. " + V", exec("wl-paste | xdotool type --file -"))
bind(main_mod .. " + Tab", hyprexpo("toggle")) bind(main_mod .. " + Tab", hyprexpo("toggle"))
bind(main_mod .. " + SHIFT + Tab", hyprexpo("bring")) bind(main_mod .. " + SHIFT + Tab", hyprexpo("bring"))
bind(main_mod .. " + G", exec("hypr_rofi_window go")) bind(main_mod .. " + G", exec(shell_ui_command .. " window go"))
bind(main_mod .. " + B", exec("hypr_rofi_window bring")) bind(main_mod .. " + B", exec(shell_ui_command .. " window bring"))
bind(main_mod .. " + SHIFT + B", exec("hypr_rofi_window replace")) bind(main_mod .. " + SHIFT + B", exec(shell_ui_command .. " window replace"))
bind(main_mod .. " + W", function() bind(main_mod .. " + W", function()
focus_direction("up") focus_direction("up")

78
dotfiles/lib/bin/hypr_shell_ui Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -euo pipefail
if command -v desktop_shell_ui >/dev/null 2>&1; then
shell_ui="$(desktop_shell_ui current 2>/dev/null || true)"
else
shell_ui=""
fi
shell_ui="${shell_ui:-${IM_HYPRLAND_SHELL_UI:-taffybar}}"
run_noctalia() {
noctalia-shell ipc --any-display call "$@"
}
run_launcher() {
case "$shell_ui" in
noctalia)
run_noctalia launcher toggle
;;
taffybar|rofi)
exec rofi -show drun -show-icons
;;
*)
echo "unknown IM_HYPRLAND_SHELL_UI: $shell_ui" >&2
exit 2
;;
esac
}
run_window_picker() {
local mode="${1:-}"
case "$mode" in
go|bring|replace) ;;
*)
echo "usage: hypr_shell_ui window {go|bring|replace}" >&2
exit 2
;;
esac
if [[ "$shell_ui" == "noctalia" && "${IM_HYPRLAND_NOCTALIA_WINDOW_PICKER:-0}" == "1" ]]; then
# Future Noctalia launcher-provider hook. Until that plugin exists or if it
# fails to load, keep the existing rofi picker as the working path.
run_noctalia "plugin:hypr-window-picker" "$mode" 2>/dev/null && exit 0
fi
exec hypr_rofi_window "$mode"
}
case "${1:-}" in
launcher)
run_launcher
;;
run)
exec rofi -show run
;;
control-center)
if [[ "$shell_ui" == "noctalia" ]]; then
run_noctalia controlCenter toggle || true
fi
exit 0
;;
settings)
if [[ "$shell_ui" == "noctalia" ]]; then
run_noctalia settings toggle || true
fi
exit 0
;;
window)
shift
run_window_picker "$@"
;;
*)
echo "usage: hypr_shell_ui {launcher|run|control-center|settings|window}" >&2
exit 2
;;
esac

View File

@@ -29,6 +29,16 @@ let
exec python3 ${../dotfiles/lib/bin/hypr_rofi_window} "$@" exec python3 ${../dotfiles/lib/bin/hypr_rofi_window} "$@"
''; '';
}; };
hyprShellUi = pkgs.writeShellApplication {
name = "hypr_shell_ui";
runtimeInputs = [
pkgs.rofi
hyprRofiWindow
];
text = ''
exec ${../dotfiles/lib/bin/hypr_shell_ui} "$@"
'';
};
hyprscratchSettings = { hyprscratchSettings = {
daemon_options = "clean"; daemon_options = "clean";
global_options = ""; global_options = "";
@@ -206,6 +216,7 @@ let
# For scripts # For scripts
hyprRofiWindow hyprRofiWindow
hyprShellUi
jq jq
] ]
++ luaPluginPackages ++ luaPluginPackages