mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-23 23:34:12 +03:00
use kitty launch command, make commands consistent
`new-window` is a legacy command (see https://github.com/kovidgoyal/kitty/issues/2708). `KITTY_WINDOW_ID` should be set for any kitty window anyways.
This commit is contained in:
parent
66dddc0d67
commit
8d5d0d7d90
@ -8,23 +8,24 @@ evaluate-commands %sh{
|
||||
[ -z "${kak_opt_windowing_modules}" ] || [ "$TERM" = "xterm-kitty" ] || echo 'fail Kitty not detected'
|
||||
}
|
||||
|
||||
declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty
|
||||
declare-option -docstring %{window type that kitty creates on new and repl calls (window|os-window)} str kitty_window_type window
|
||||
|
||||
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{
|
||||
local match=""
|
||||
match=""
|
||||
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
||||
fi
|
||||
|
||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
kitty @ new-window --no-response --window-type "$kak_opt_kitty_window_type" --cwd "$PWD" $match "$@"
|
||||
else
|
||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" new-window --no-response --window-type "$kak_opt_kitty_window_type" --cwd "$PWD" $match "$@"
|
||||
listen=""
|
||||
if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
listen="--to=$kak_client_env_KITTY_LISTEN_ON"
|
||||
fi
|
||||
|
||||
kitty @ $listen launch --no-response --type="$kak_opt_kitty_window_type" --cwd="$PWD" $match "$@"
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,16 +34,17 @@ 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{
|
||||
local match=""
|
||||
match=""
|
||||
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
||||
fi
|
||||
|
||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
kitty @ new-window --no-response --new-tab --cwd "$PWD" $match "$@"
|
||||
else
|
||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" new-window --no-response --new-tab --cwd "$PWD" $match "$@"
|
||||
listen=""
|
||||
if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
listen="--to=$kak_client_env_KITTY_LISTEN_ON"
|
||||
fi
|
||||
|
||||
kitty @ $listen launch --no-response --type=tab --cwd="$PWD" $match "$@"
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,13 +56,17 @@ If no client is passed then the current one is used' \
|
||||
if [ $# -eq 1 ]; then
|
||||
printf "evaluate-commands -client '%s' focus" "$1"
|
||||
else
|
||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
kitty @ focus-tab --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
||||
kitty @ focus-window --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
||||
else
|
||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" focus-tab --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" focus-window --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
||||
match=""
|
||||
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
||||
fi
|
||||
|
||||
listen=""
|
||||
if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||
listen="--to=$kak_client_env_KITTY_LISTEN_ON"
|
||||
fi
|
||||
|
||||
kitty @ $listen focus-window --no-response $match
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user