Update rc/client.kak to fit the tmux changes

Trim the script to remove any reference to tmux, and reflect the changes
made in the previous commit.
This commit is contained in:
Frank LENORMAND 2015-11-06 10:14:50 +03:00
parent 678acd32bc
commit 284a40f681

View File

@ -1,50 +1,44 @@
# termcmd should be set such as the next argument is the whole # termcmd should be set such as the next argument is the whole
# command line to execute # command line to execute
decl str termcmd %sh{ decl str termcmd %sh{
if [ -n "$TMUX" ]; then for termcmd in 'termite -e ' \
echo "'tmux split-window -h'" 'urxvt -e sh -c' \
else 'rxvt -e sh -c' \
for termcmd in 'termite -e ' \ 'xterm -e sh -c' \
'urxvt -e sh -c' \ 'roxterm -e sh -c' \
'rxvt -e sh -c' \ 'mintty -e sh -c' \
'xterm -e sh -c' \ 'gnome-terminal -e ' \
'roxterm -e sh -c' \ 'xfce4-terminal -e ' ; do
'mintty -e sh -c' \ terminal=${termcmd%% *}
'gnome-terminal -e ' \ if which $terminal > /dev/null 2>&1; then
'xfce4-terminal -e ' ; do echo "'$termcmd'"
terminal=${termcmd%% *} exit
if which $terminal > /dev/null 2>&1; then fi
echo "'$termcmd'" done
exit
fi
done
fi
} }
def -docstring 'create a new kak client for current session' \ def -docstring 'create a new kak client for current session' \
-shell-params \ -shell-params \
-command-completion \ -command-completion \
new %{ %sh{ new %{ %sh{
if [ -z "${kak_opt_termcmd}" ]; then if [ -z "${kak_opt_termcmd}" ]; then
echo "echo -color Error 'termcmd option is not set'" echo "echo -color Error 'termcmd option is not set'"
exit exit
fi fi
if [ $# -ne 0 ]; then kakoune_params="-e '$@'"; fi if [ $# -ne 0 ]; then kakoune_params="-e '$@'"; fi
setsid ${kak_opt_termcmd} "kak -c ${kak_session} ${kakoune_params}" < /dev/null > /dev/null 2>&1 & setsid ${kak_opt_termcmd} "kak -c ${kak_session} ${kakoune_params}" < /dev/null > /dev/null 2>&1 &
}} }}
def -docstring 'focus given client' \ def -docstring 'focus given client' \
-shell-params -client-completion \ -shell-params -client-completion \
focus %{ %sh{ focus-default %{ %sh{
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
echo "echo -color Error 'too many arguments, use focus [client]'" echo "echo -color Error 'too many arguments, use focus [client]'"
elif [ $# -eq 1 ]; then elif [ $# -eq 1 ]; then
echo "eval -client '$1' focus" echo "eval -client '$1' focus"
else else
if [ -n "$kak_client_env_TMUX" ]; then xdotool windowactivate $kak_client_env_WINDOWID > /dev/null
TMUX="$kak_client_env_TMUX" tmux select-pane -t "$kak_client_env_TMUX_PANE" > /dev/null
else
xdotool windowactivate $kak_client_env_WINDOWID > /dev/null
fi
fi fi
} } } }
## Create an alias to the default focus callback to allow overriding from custom scripts (i.e. tmux)
alias global focus focus-default