2017-09-23 16:26:57 +02:00
|
|
|
# http://gnu.org/software/screen/
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global KakBegin .* %{
|
|
|
|
%sh{
|
2017-11-15 15:42:37 +01:00
|
|
|
[ -z "${kak_client_env_STY}" ] && exit
|
2017-09-23 16:26:57 +02:00
|
|
|
echo "
|
|
|
|
alias global focus screen-focus
|
|
|
|
alias global new screen-new-vertical
|
|
|
|
"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-15 05:21:42 +01:00
|
|
|
define-command screen-new-vertical -params .. -command-completion -docstring "Create a new vertical region" %{
|
2017-09-23 16:26:57 +02:00
|
|
|
%sh{
|
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
|
|
|
screen -X eval 'split -h' 'focus down' "screen kak -c \"${kak_session}\" -e \"$*\"" < "/dev/$tty"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 05:21:42 +01:00
|
|
|
define-command screen-new-horizontal -params .. -command-completion -docstring "Create a new horizontal region" %{
|
2017-09-23 16:26:57 +02:00
|
|
|
%sh{
|
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
|
|
|
screen -X eval 'split -v' 'focus right' "screen kak -c \"${kak_session}\" -e \"$*\"" < "/dev/$tty"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 05:21:42 +01:00
|
|
|
define-command screen-new-window -params .. -command-completion -docstring "Create a new window" %{
|
2017-09-23 16:26:57 +02:00
|
|
|
%sh{
|
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
|
|
|
screen -X screen kak -c "${kak_session}" -e "$*" < "/dev/$tty"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 05:21:42 +01:00
|
|
|
define-command -docstring %{screen-focus [<client>]: focus the given client
|
2017-09-23 16:26:57 +02:00
|
|
|
If no client is passed then the current one is used} \
|
|
|
|
-params ..1 -client-completion \
|
|
|
|
screen-focus %{ %sh{
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
printf %s\\n "
|
|
|
|
evaluate-commands -client '$1' %{ %sh{
|
|
|
|
screen -X focus
|
|
|
|
}}"
|
2017-11-15 15:42:37 +01:00
|
|
|
elif [ -n "${kak_client_env_STY}" ]; then
|
2017-09-23 16:26:57 +02:00
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
2017-11-15 15:42:37 +01:00
|
|
|
screen -X select "$kak_client_env_WINDOW" < "/dev/$tty"
|
2017-09-23 16:26:57 +02:00
|
|
|
fi
|
|
|
|
} }
|