2018-04-19 20:28:32 +03:00
|
|
|
# termcmd should be set such as the next argument is the whole
|
2014-04-10 22:40:52 +04:00
|
|
|
# command line to execute
|
2017-11-03 10:34:41 +03:00
|
|
|
declare-option -docstring %{shell command run to spawn a new terminal
|
2018-04-19 20:28:32 +03:00
|
|
|
A shell command is appended to the one set in this option at runtime} \
|
2017-05-16 14:35:43 +03:00
|
|
|
str termcmd %sh{
|
2017-06-08 20:02:44 +03:00
|
|
|
for termcmd in 'alacritty -e sh -c' \
|
|
|
|
'termite -e ' \
|
2015-11-06 10:14:50 +03:00
|
|
|
'urxvt -e sh -c' \
|
|
|
|
'rxvt -e sh -c' \
|
|
|
|
'xterm -e sh -c' \
|
|
|
|
'roxterm -e sh -c' \
|
|
|
|
'mintty -e sh -c' \
|
2017-07-25 11:26:52 +03:00
|
|
|
'sakura -x ' \
|
2015-11-06 10:14:50 +03:00
|
|
|
'gnome-terminal -e ' \
|
|
|
|
'xfce4-terminal -e ' ; do
|
|
|
|
terminal=${termcmd%% *}
|
2017-05-16 15:18:45 +03:00
|
|
|
if command -v $terminal >/dev/null 2>&1; then
|
2016-04-23 08:47:01 +03:00
|
|
|
printf %s\\n "'$termcmd'"
|
2015-11-06 10:14:50 +03:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
done
|
2012-12-26 20:52:17 +04:00
|
|
|
}
|
|
|
|
|
2017-11-03 10:34:41 +03:00
|
|
|
define-command -docstring %{x11-new [<command>]: create a new kak client for the current session
|
2016-10-11 10:03:41 +03:00
|
|
|
The optional arguments will be passed as arguments to the new client} \
|
2015-12-01 17:00:55 +03:00
|
|
|
-params .. \
|
2015-06-26 15:52:01 +03:00
|
|
|
-command-completion \
|
2015-11-18 01:25:33 +03:00
|
|
|
x11-new %{ %sh{
|
2015-11-06 10:14:50 +03:00
|
|
|
if [ -z "${kak_opt_termcmd}" ]; then
|
2018-04-19 20:28:32 +03:00
|
|
|
echo "echo -markup '{Error}termcmd option is not set'"
|
2015-11-06 10:14:50 +03:00
|
|
|
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
|
|
|
|
2017-11-03 10:34:41 +03:00
|
|
|
define-command -docstring %{x11-focus [<client>]: focus a given client's window
|
2016-10-11 10:03:41 +03:00
|
|
|
If no client is passed, then the current client is used} \
|
|
|
|
-params ..1 -client-completion \
|
2015-11-18 01:25:33 +03:00
|
|
|
x11-focus %{ %sh{
|
2016-10-11 10:03:41 +03:00
|
|
|
if [ $# -eq 1 ]; then
|
2017-11-03 11:09:45 +03:00
|
|
|
printf %s\\n "evaluate-commands -client '$1' focus"
|
2015-11-18 01:25:33 +03:00
|
|
|
else
|
|
|
|
xdotool windowactivate $kak_client_env_WINDOWID > /dev/null
|
|
|
|
fi
|
2014-04-08 00:28:40 +04:00
|
|
|
} }
|
2015-11-18 01:25:33 +03:00
|
|
|
|
|
|
|
alias global focus x11-focus
|
|
|
|
alias global new x11-new
|