2020-07-05 05:02:59 +03:00
|
|
|
# https://sw.kovidgoyal.net/kitty/index.html
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
2018-06-19 12:39:45 +03:00
|
|
|
|
2019-03-14 00:00:59 +03:00
|
|
|
provide-module kitty %{
|
|
|
|
|
2020-07-05 05:02:59 +03:00
|
|
|
# ensure that we're running on kitty
|
|
|
|
evaluate-commands %sh{
|
|
|
|
[-z "${kak_opt_windowing_modules}" ] || [ "$TERM" = "xterm-kitty" ] || echo 'fail Kitty not detected'
|
|
|
|
}
|
|
|
|
|
2019-03-14 00:00:59 +03:00
|
|
|
declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty
|
|
|
|
|
2018-12-21 20:14:28 +03:00
|
|
|
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' \
|
2018-12-02 15:59:45 +03:00
|
|
|
%{
|
|
|
|
nop %sh{
|
2019-03-28 16:28:40 +03:00
|
|
|
kitty @ new-window --no-response --window-type $kak_opt_kitty_window_type --cwd "$PWD" "$@"
|
2018-12-02 15:59:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-21 20:14:28 +03:00
|
|
|
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' \
|
2018-12-02 15:59:45 +03:00
|
|
|
%{
|
|
|
|
nop %sh{
|
2019-03-28 16:28:40 +03:00
|
|
|
kitty @ new-window --no-response --new-tab --cwd "$PWD" "$@"
|
2018-12-02 15:59:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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{
|
2018-06-19 12:39:45 +03:00
|
|
|
if [ $# -eq 1 ]; then
|
2018-12-02 15:59:45 +03:00
|
|
|
printf "evaluate-commands -client '%s' focus" "$1"
|
2018-06-19 12:39:45 +03:00
|
|
|
else
|
2018-09-24 07:12:07 +03:00
|
|
|
kitty @ focus-tab --no-response -m=id:$kak_client_env_KITTY_WINDOW_ID
|
2018-09-01 22:14:33 +03:00
|
|
|
kitty @ focus-window --no-response -m=id:$kak_client_env_KITTY_WINDOW_ID
|
2018-06-19 12:39:45 +03:00
|
|
|
fi
|
2018-12-02 15:59:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-14 00:00:59 +03:00
|
|
|
alias global terminal kitty-terminal
|
|
|
|
alias global terminal-tab kitty-terminal-tab
|
|
|
|
alias global focus kitty-focus
|
|
|
|
|
|
|
|
}
|