2014-04-10 20:40:52 +02:00
|
|
|
# termcmd should be set such as the next argument is the whole
|
|
|
|
# command line to execute
|
2013-03-03 17:25:40 +01:00
|
|
|
decl str termcmd %sh{
|
2014-03-06 04:35:38 +01:00
|
|
|
if [ -n "$TMUX" ]; then
|
2012-12-26 17:52:17 +01:00
|
|
|
echo "'tmux split-window -h'"
|
|
|
|
else
|
2014-07-04 15:43:54 +02:00
|
|
|
for termcmd in 'termite -e ' \
|
|
|
|
'urxvt -e sh -c' \
|
2014-07-04 15:41:49 +02:00
|
|
|
'rxvt -e sh -c' \
|
|
|
|
'xterm -e sh -c' \
|
|
|
|
'roxterm -e sh -c' \
|
|
|
|
'mintty -e sh -c' \
|
|
|
|
'gnome-terminal -e ' \
|
|
|
|
'xfce4-terminal -e ' ; do
|
|
|
|
terminal=${termcmd%% *}
|
2014-04-10 20:40:52 +02:00
|
|
|
if which $terminal > /dev/null 2>&1; then
|
2014-07-04 15:41:49 +02:00
|
|
|
echo "'$termcmd'"
|
2014-04-10 20:40:52 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
done
|
2012-12-26 17:52:17 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-07 22:28:40 +02:00
|
|
|
def -docstring 'create a new kak client for current session' \
|
|
|
|
-shell-params \
|
2015-06-26 14:52:01 +02:00
|
|
|
-command-completion \
|
2014-04-10 20:40:52 +02:00
|
|
|
new %{ %sh{
|
|
|
|
if [ -z "${kak_opt_termcmd}" ]; then
|
|
|
|
echo "echo -color Error 'termcmd option is not set'"
|
|
|
|
exit
|
|
|
|
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 &
|
2012-12-26 17:52:17 +01:00
|
|
|
}}
|
2014-04-07 22:28:40 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
} }
|