Skip to content

Commit ee23c00

Browse files
committed
Merge remote-tracking branch 'erikeah/master'
2 parents 8001b87 + e17a811 commit ee23c00

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

rc/windowing/detection.kak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ declare-option -docstring \
2323
"Ordered list of windowing modules to try and load. An empty list disables
2424
both automatic module loading and environment detection, enabling complete
2525
manual control of the module loading." \
26-
str-list windowing_modules 'tmux' 'screen' 'zellij' 'kitty' 'iterm' 'appleterminal' 'sway' 'wayland' 'x11' 'wezterm'
26+
str-list windowing_modules 'tmux' 'screen' 'zellij' 'kitty' 'iterm' 'appleterminal' 'sway' 'hyprland' 'wayland' 'x11' 'wezterm'
2727

2828
declare-option -docstring %{
2929
windowing module to use in the 'terminal' command

rc/windowing/hyprland.kak

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# https://hypr.land
2+
provide-module hyprland %{
3+
4+
# Ensure we're actually in Hyprland
5+
evaluate-commands %sh{
6+
[ -z "${kak_opt_windowing_modules}" ] ||
7+
[ "$XDG_CURRENT_DESKTOP" == "Hyprland" ] &&
8+
[ -n "$HYPRLAND_INSTANCE_SIGNATURE" ] ||
9+
echo 'fail hyprland not detected'
10+
}
11+
12+
require-module 'wayland'
13+
14+
alias global hyprland-terminal-window wayland-terminal-window
15+
16+
define-command hyprland-focus-pid -hidden %{
17+
evaluate-commands %sh{
18+
pid=$kak_client_pid
19+
while [ "$(hyprctl dispatch focuswindow pid:$pid)" != "ok" ]; do
20+
pid=$(ps -p $pid -o ppid= | tr -d " ")
21+
if [ -z $pid ] || [ $pid -le 1 ]; then
22+
echo "fail Can't find PID for Sway window to focus"
23+
break
24+
fi
25+
done
26+
}
27+
}
28+
29+
define-command hyprland-focus -params ..1 -docstring '
30+
hyprland-focus [<kakoune_client>]: focus a given client''s window.
31+
If no client is passed, then the current client is used' \
32+
%{
33+
evaluate-commands %sh{
34+
if [ $# -eq 1 ]; then
35+
printf "evaluate-commands -client '%s' hyprland-focus-pid" "$1"
36+
else
37+
echo hyprland-focus-pid
38+
fi
39+
}
40+
}
41+
complete-command -menu hyprland-focus client
42+
43+
alias global focus hyprland-focus
44+
45+
}

0 commit comments

Comments
 (0)