Merge remote-tracking branch 'basbebe/kitty_command'
This commit is contained in:
commit
7f8f748d06
|
@ -8,23 +8,24 @@ evaluate-commands %sh{
|
||||||
[ -z "${kak_opt_windowing_modules}" ] || [ "$TERM" = "xterm-kitty" ] || echo 'fail Kitty not detected'
|
[ -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 '
|
define-command kitty-terminal -params 1.. -shell-completion -docstring '
|
||||||
kitty-terminal <program> [<arguments>]: create a new terminal as a kitty window
|
kitty-terminal <program> [<arguments>]: create a new terminal as a kitty window
|
||||||
The program passed as argument will be executed in the new terminal' \
|
The program passed as argument will be executed in the new terminal' \
|
||||||
%{
|
%{
|
||||||
nop %sh{
|
nop %sh{
|
||||||
local match=""
|
match=""
|
||||||
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||||
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
listen=""
|
||||||
kitty @ new-window --no-response --window-type "$kak_opt_kitty_window_type" --cwd "$PWD" $match "$@"
|
if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||||
else
|
listen="--to=$kak_client_env_KITTY_LISTEN_ON"
|
||||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" new-window --no-response --window-type "$kak_opt_kitty_window_type" --cwd "$PWD" $match "$@"
|
|
||||||
fi
|
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' \
|
The program passed as argument will be executed in the new terminal' \
|
||||||
%{
|
%{
|
||||||
nop %sh{
|
nop %sh{
|
||||||
local match=""
|
match=""
|
||||||
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||||
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
match="--match=id:$kak_client_env_KITTY_WINDOW_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
listen=""
|
||||||
kitty @ new-window --no-response --new-tab --cwd "$PWD" $match "$@"
|
if [ -n "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
||||||
else
|
listen="--to=$kak_client_env_KITTY_LISTEN_ON"
|
||||||
kitty @ --to "$kak_client_env_KITTY_LISTEN_ON" new-window --no-response --new-tab --cwd "$PWD" $match "$@"
|
|
||||||
fi
|
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
|
if [ $# -eq 1 ]; then
|
||||||
printf "evaluate-commands -client '%s' focus" "$1"
|
printf "evaluate-commands -client '%s' focus" "$1"
|
||||||
else
|
else
|
||||||
if [ -z "$kak_client_env_KITTY_LISTEN_ON" ]; then
|
match=""
|
||||||
kitty @ focus-tab --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
if [ -n "$kak_client_env_KITTY_WINDOW_ID" ]; then
|
||||||
kitty @ focus-window --no-response --match=id:$kak_client_env_KITTY_WINDOW_ID
|
match="--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
|
|
||||||
fi
|
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
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,18 @@ define-command -params .. -shell-completion \
|
||||||
else
|
else
|
||||||
cmd="$*"
|
cmd="$*"
|
||||||
fi
|
fi
|
||||||
kitty @ new-window --no-response --window-type $kak_opt_kitty_window_type --title kak_repl_window --cwd "$PWD" $cmd < /dev/null > /dev/null 2>&1 &
|
|
||||||
|
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 launch --no-response --keep-focus --type="$kak_opt_kitty_window_type" --title=kak_repl_window --cwd="$PWD" $match $cmd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +45,7 @@ define-command -hidden -params 0..1 \
|
||||||
else
|
else
|
||||||
text="$1"
|
text="$1"
|
||||||
fi
|
fi
|
||||||
kitty @ send-text -m=title:kak_repl_window "$text"
|
kitty @ send-text --match=title:kak_repl_window "$text"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user