client.kak: add a focus command for focusing a certain client.

This commit is contained in:
Maxime Coste 2014-04-07 21:28:40 +01:00
parent 203a7732f5
commit 95f6f0bae9

View File

@ -6,8 +6,25 @@ decl str termcmd %sh{
fi fi
} }
def new -docstring 'create a new kak client for current session' \ def -docstring 'create a new kak client for current session' \
-shell-params %{ nop %sh{ -shell-params \
new %{ nop %sh{
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' \
-shell-params -client-completion \
focus %{ %sh{
if [ $# -gt 1 ]; then
echo "echo -color Error 'too many arguments, use focus [client]'"
elif [ $# -eq 1 ]; then
echo "eval -client '$1' focus"
else
if [ -n "$kak_client_env_TMUX" ]; then
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
} }