1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 13:02:01 +03:00

* Crude implementation of focus: use the current region to switch to the desired window.

- The proper way to do this would be to switch focus to the target client's region but GNU Screen offers no obvious way to do that.

- Remove screen region after client is closed.

- Assumed: Kak server runs in screen.
This commit is contained in:
Nicholas Ochiel 2017-11-17 22:40:42 +03:00
parent 7d32b3fc36
commit 908e0c1f8c

View File

@ -1,9 +1,9 @@
# http://gnu.org/software/screen/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook global KakBegin .* %{
hook -group GNUscreen global KakBegin .* %{
%sh{
[ -z "${kak_client_env_STY}" ] && exit
[ -z "${STY}" ] && exit
echo "
alias global focus screen-focus
alias global new screen-new-vertical
@ -15,14 +15,24 @@ hook global KakBegin .* %{
define-command screen-new-vertical -params .. -command-completion -docstring "Create a new vertical region" %{
%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"
screen -X eval \
'split -h' \
'focus down' \
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
screen -X remove'" \
< "/dev/$tty"
}
}
define-command screen-new-horizontal -params .. -command-completion -docstring "Create a new horizontal region" %{
%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"
screen -X eval \
'split -v' \
'focus right' \
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
screen -X remove'" \
< "/dev/$tty"
}
}
@ -39,11 +49,10 @@ If no client is passed then the current one is used} \
screen-focus %{ %sh{
if [ $# -eq 1 ]; then
printf %s\\n "
evaluate-commands -client '$1' %{ %sh{
screen -X focus
}}"
evaluate-commands -client '$1' focus
"
elif [ -n "${kak_client_env_STY}" ]; then
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
screen -X select "$kak_client_env_WINDOW" < "/dev/$tty"
screen -X select "${kak_client_env_WINDOW}" < "/dev/$tty"
fi
} }