diff options
| author | Erik Alonso <erikeah@protonmail.com> | 2025-06-20 23:39:35 +0100 |
|---|---|---|
| committer | Erik Alonso <erikeah@protonmail.com> | 2025-06-20 23:43:38 +0100 |
| commit | a9b87c32fb8a06c15563594adcef7e1dd275e771 (patch) | |
| tree | 3adf7fc339bd9e562f090e3fde2e65ece0d40ab3 | |
| parent | e3b002d014ce89474154317f4e8739e7561d5774 (diff) | |
rc windowing hyprland: init
| -rw-r--r-- | rc/windowing/detection.kak | 2 | ||||
| -rw-r--r-- | rc/windowing/hyprland.kak | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/rc/windowing/detection.kak b/rc/windowing/detection.kak index 2fde81cd..36b0398f 100644 --- a/rc/windowing/detection.kak +++ b/rc/windowing/detection.kak @@ -23,7 +23,7 @@ declare-option -docstring \ "Ordered list of windowing modules to try and load. An empty list disables both automatic module loading and environment detection, enabling complete manual control of the module loading." \ -str-list windowing_modules 'tmux' 'screen' 'zellij' 'kitty' 'iterm' 'appleterminal' 'sway' 'wayland' 'x11' 'wezterm' +str-list windowing_modules 'tmux' 'screen' 'zellij' 'kitty' 'iterm' 'appleterminal' 'sway' 'hyprland' 'wayland' 'x11' 'wezterm' declare-option -docstring %{ windowing module to use in the 'terminal' command diff --git a/rc/windowing/hyprland.kak b/rc/windowing/hyprland.kak new file mode 100644 index 00000000..27ad16c2 --- /dev/null +++ b/rc/windowing/hyprland.kak @@ -0,0 +1,45 @@ +# https://hypr.land +provide-module hyprland %{ + +# Ensure we're actually in Hyprland +evaluate-commands %sh{ + [ -z "${kak_opt_windowing_modules}" ] || + [ "$XDG_CURRENT_DESKTOP" == "Hyprland" ] && + [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ] || + echo 'fail hyprland not detected' +} + +require-module 'wayland' + +alias global hyprland-terminal-window wayland-terminal-window + +define-command hyprland-focus-pid -hidden %{ + evaluate-commands %sh{ + pid=$kak_client_pid + while [ "$(hyprctl dispatch focuswindow pid:$pid)" != "ok" ]; do + pid=$(ps -p $pid -o ppid= | tr -d " ") + if [ -z $pid ] || [ $pid -le 1 ]; then + echo "fail Can't find PID for Sway window to focus" + break + fi + done + } +} + +define-command hyprland-focus -params ..1 -docstring ' +hyprland-focus [<kakoune_client>]: focus a given client''s window. +If no client is passed, then the current client is used' \ +%{ + evaluate-commands %sh{ + if [ $# -eq 1 ]; then + printf "evaluate-commands -client '%s' hyprland-focus-pid" "$1" + else + echo hyprland-focus-pid + fi + } +} +complete-command -menu hyprland-focus client + +alias global focus hyprland-focus + +} |
