diff --git a/dotfiles/config/hypr/hyprland.conf b/dotfiles/config/hypr/hyprland.conf index 89bbc4fa..2e51d68c 100644 --- a/dotfiles/config/hypr/hyprland.conf +++ b/dotfiles/config/hypr/hyprland.conf @@ -19,8 +19,9 @@ monitor=,preferred,auto,1 # ============================================================================= $terminal = ghostty --gtk-single-instance=false $fileManager = dolphin -$menu = rofi -show drun -show-icons -$runMenu = rofi -show run +$shellUi = hypr_shell_ui +$menu = $shellUi launcher +$runMenu = $shellUi run # ============================================================================= # ENVIRONMENT VARIABLES @@ -245,6 +246,8 @@ $hyper = SUPER CTRL ALT # ----------------------------------------------------------------------------- bind = $mainMod, P, exec, $menu 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 # ----------------------------------------------------------------------------- @@ -423,9 +426,9 @@ bind = $mainMod SHIFT, Z, movewindow, mon:+1 # WINDOW MANAGEMENT # ----------------------------------------------------------------------------- -bind = $mainMod, G, exec, hypr_rofi_window go -bind = $mainMod, B, exec, hypr_rofi_window bring -bind = $mainMod SHIFT, B, exec, hypr_rofi_window replace +bind = $mainMod, G, exec, $shellUi window go +bind = $mainMod, B, exec, $shellUi window bring +bind = $mainMod SHIFT, B, exec, $shellUi window replace # ----------------------------------------------------------------------------- # MEDIA KEYS diff --git a/dotfiles/config/hypr/hyprland.lua b/dotfiles/config/hypr/hyprland.lua index cc818dd2..bda6c71b 100644 --- a/dotfiles/config/hypr/hyprland.lua +++ b/dotfiles/config/hypr/hyprland.lua @@ -3,8 +3,9 @@ local mod_alt = "SUPER + ALT" local hyper = "SUPER + CTRL + ALT" local terminal = "ghostty --gtk-single-instance=false" -local menu = "rofi -show drun -show-icons" -local run_menu = "rofi -show run" +local shell_ui_command = "hypr_shell_ui" +local launcher_command = shell_ui_command .. " launcher" +local run_menu = shell_ui_command .. " run" local max_workspace = 9 local scratchpad_top_margin = 60 @@ -1486,8 +1487,10 @@ local function apply_rules() }) end -bind(main_mod .. " + P", exec(menu)) +bind(main_mod .. " + P", exec(launcher_command)) 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 .. " + Q", exec("hyprctl reload")) 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 .. " + Tab", hyprexpo("toggle")) bind(main_mod .. " + SHIFT + Tab", hyprexpo("bring")) -bind(main_mod .. " + G", exec("hypr_rofi_window go")) -bind(main_mod .. " + B", exec("hypr_rofi_window bring")) -bind(main_mod .. " + SHIFT + B", exec("hypr_rofi_window replace")) +bind(main_mod .. " + G", exec(shell_ui_command .. " window go")) +bind(main_mod .. " + B", exec(shell_ui_command .. " window bring")) +bind(main_mod .. " + SHIFT + B", exec(shell_ui_command .. " window replace")) bind(main_mod .. " + W", function() focus_direction("up") diff --git a/dotfiles/lib/bin/hypr_shell_ui b/dotfiles/lib/bin/hypr_shell_ui new file mode 100755 index 00000000..230f1f52 --- /dev/null +++ b/dotfiles/lib/bin/hypr_shell_ui @@ -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 diff --git a/nixos/hyprland.nix b/nixos/hyprland.nix index 9549cf4e..cac2e782 100644 --- a/nixos/hyprland.nix +++ b/nixos/hyprland.nix @@ -29,6 +29,16 @@ let 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 = { daemon_options = "clean"; global_options = ""; @@ -206,6 +216,7 @@ let # For scripts hyprRofiWindow + hyprShellUi jq ] ++ luaPluginPackages