2017-09-23 17:26:57 +03:00
|
|
|
# http://gnu.org/software/screen/
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2018-05-07 00:29:52 +03:00
|
|
|
hook -group GNUscreen global KakBegin .* %sh{
|
|
|
|
[ -z "${STY}" ] && exit
|
|
|
|
echo "
|
|
|
|
alias global focus screen-focus
|
|
|
|
alias global new screen-new-vertical
|
|
|
|
"
|
2017-09-23 17:26:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-30 14:17:46 +03:00
|
|
|
define-command screen-new-vertical -params .. -command-completion -docstring "Split the current pane into two, left and right" %{
|
2018-05-07 00:29:52 +03:00
|
|
|
nop %sh{
|
2017-09-23 17:26:57 +03:00
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
2017-11-17 22:40:42 +03:00
|
|
|
screen -X eval \
|
|
|
|
'split -h' \
|
|
|
|
'focus down' \
|
|
|
|
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
|
|
|
|
screen -X remove'" \
|
|
|
|
< "/dev/$tty"
|
2017-09-23 17:26:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-30 14:17:46 +03:00
|
|
|
define-command screen-new-horizontal -params .. -command-completion -docstring "Split the current pane into two, top and bottom" %{
|
2018-05-07 00:29:52 +03:00
|
|
|
nop %sh{
|
2017-09-23 17:26:57 +03:00
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
2017-11-17 22:40:42 +03:00
|
|
|
screen -X eval \
|
|
|
|
'split -v' \
|
|
|
|
'focus right' \
|
|
|
|
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
|
|
|
|
screen -X remove'" \
|
|
|
|
< "/dev/$tty"
|
2017-09-23 17:26:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 07:21:42 +03:00
|
|
|
define-command screen-new-window -params .. -command-completion -docstring "Create a new window" %{
|
2018-05-07 00:29:52 +03:00
|
|
|
nop %sh{
|
2017-09-23 17:26:57 +03:00
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
|
|
|
screen -X screen kak -c "${kak_session}" -e "$*" < "/dev/$tty"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-15 07:21:42 +03:00
|
|
|
define-command -docstring %{screen-focus [<client>]: focus the given client
|
2017-09-23 17:26:57 +03:00
|
|
|
If no client is passed then the current one is used} \
|
|
|
|
-params ..1 -client-completion \
|
2018-05-07 00:29:52 +03:00
|
|
|
screen-focus %{ evaluate-commands %sh{
|
2017-09-23 17:26:57 +03:00
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
printf %s\\n "
|
2017-11-17 22:40:42 +03:00
|
|
|
evaluate-commands -client '$1' focus
|
|
|
|
"
|
2017-11-15 17:42:37 +03:00
|
|
|
elif [ -n "${kak_client_env_STY}" ]; then
|
2017-09-23 17:26:57 +03:00
|
|
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
2017-11-17 22:40:42 +03:00
|
|
|
screen -X select "${kak_client_env_WINDOW}" < "/dev/$tty"
|
2017-09-23 17:26:57 +03:00
|
|
|
fi
|
|
|
|
} }
|