home/rc/windowing/kitty.kak

49 lines
1.5 KiB
Plaintext
Raw Normal View History

2018-09-23 22:15:29 +02:00
hook -group kitty-hooks global KakBegin .* %sh{
2018-06-23 07:55:38 +02:00
if [ "$TERM" = "xterm-kitty" ] && [ -z "$TMUX" ]; then
2019-03-13 22:00:59 +01:00
echo "require-module kitty"
fi
}
2019-03-13 22:00:59 +01:00
provide-module kitty %{
declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty
define-command kitty-terminal -params 1.. -shell-completion -docstring '
kitty-terminal <program> [<arguments>]: create a new terminal as a kitty window
The program passed as argument will be executed in the new terminal' \
%{
nop %sh{
kitty @ new-window --no-response --window-type $kak_opt_kitty_window_type --cwd "$PWD" "$@"
}
}
define-command kitty-terminal-tab -params 1.. -shell-completion -docstring '
kitty-terminal-tab <program> [<arguments>]: create a new terminal as kitty tab
The program passed as argument will be executed in the new terminal' \
%{
nop %sh{
kitty @ new-window --no-response --new-tab --cwd "$PWD" "$@"
}
}
define-command kitty-focus -params ..1 -client-completion -docstring '
kitty-focus [<client>]: focus the given client
If no client is passed then the current one is used' \
%{
evaluate-commands %sh{
if [ $# -eq 1 ]; then
printf "evaluate-commands -client '%s' focus" "$1"
else
2018-09-24 06:12:07 +02:00
kitty @ focus-tab --no-response -m=id:$kak_client_env_KITTY_WINDOW_ID
kitty @ focus-window --no-response -m=id:$kak_client_env_KITTY_WINDOW_ID
fi
}
}
2019-03-13 22:00:59 +01:00
alias global terminal kitty-terminal
alias global terminal-tab kitty-terminal-tab
alias global focus kitty-focus
}