2014-04-10 22:40:52 +04:00
|
|
|
# termcmd should be set such as the next argument is the whole
|
|
|
|
# command line to execute
|
2013-03-03 20:25:40 +04:00
|
|
|
decl str termcmd %sh{
|
2015-11-06 10:14:50 +03:00
|
|
|
for termcmd in 'termite -e ' \
|
|
|
|
'urxvt -e sh -c' \
|
|
|
|
'rxvt -e sh -c' \
|
|
|
|
'xterm -e sh -c' \
|
|
|
|
'roxterm -e sh -c' \
|
|
|
|
'mintty -e sh -c' \
|
2015-11-17 16:40:28 +03:00
|
|
|
'sakura -e ' \
|
2015-11-06 10:14:50 +03:00
|
|
|
'gnome-terminal -e ' \
|
|
|
|
'xfce4-terminal -e ' ; do
|
|
|
|
terminal=${termcmd%% *}
|
|
|
|
if which $terminal > /dev/null 2>&1; then
|
|
|
|
echo "'$termcmd'"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
done
|
2012-12-26 20:52:17 +04:00
|
|
|
}
|
|
|
|
|
2014-04-08 00:28:40 +04:00
|
|
|
def -docstring 'create a new kak client for current session' \
|
|
|
|
-shell-params \
|
2015-06-26 15:52:01 +03:00
|
|
|
-command-completion \
|
2014-04-10 22:40:52 +04:00
|
|
|
new %{ %sh{
|
2015-11-06 10:14:50 +03:00
|
|
|
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 20:52:17 +04:00
|
|
|
}}
|
2014-04-08 00:28:40 +04:00
|
|
|
|
|
|
|
def -docstring 'focus given client' \
|
|
|
|
-shell-params -client-completion \
|
2015-11-06 10:14:50 +03:00
|
|
|
focus-default %{ %sh{
|
2014-04-08 00:28:40 +04:00
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
echo "echo -color Error 'too many arguments, use focus [client]'"
|
|
|
|
elif [ $# -eq 1 ]; then
|
|
|
|
echo "eval -client '$1' focus"
|
|
|
|
else
|
2015-11-06 10:14:50 +03:00
|
|
|
xdotool windowactivate $kak_client_env_WINDOWID > /dev/null
|
2014-04-08 00:28:40 +04:00
|
|
|
fi
|
|
|
|
} }
|
2015-11-06 10:14:50 +03:00
|
|
|
## Create an alias to the default focus callback to allow overriding from custom scripts (i.e. tmux)
|
|
|
|
alias global focus focus-default
|