From 995944557a53d401eb6565b77a3924edf26565c9 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Tue, 16 Dec 2025 21:32:15 +0100 Subject: kak --- .config/kak/autoload/connect/aliases/:f | 2 +- .config/kak/autoload/connect/aliases/f | 2 +- .config/kak/autoload/ghostty-mac.kak | 46 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .config/kak/autoload/ghostty-mac.kak diff --git a/.config/kak/autoload/connect/aliases/:f b/.config/kak/autoload/connect/aliases/:f index ea2ede0..4c31940 100755 --- a/.config/kak/autoload/connect/aliases/:f +++ b/.config/kak/autoload/connect/aliases/:f @@ -3,7 +3,7 @@ # Edit fifo buffer in a client mkfifo buffer.fifo trap 'rm buffer.fifo' EXIT -:send edit! -fifo "$PWD/buffer.fifo" '*fifo*' +:send evaluate-commands -try-client tools %{edit! -fifo "$PWD/buffer.fifo" '*fifo*'} # Send to fifo buffer the output of the given command, # or read from stdin if available. diff --git a/.config/kak/autoload/connect/aliases/f b/.config/kak/autoload/connect/aliases/f index ea2ede0..4c31940 100755 --- a/.config/kak/autoload/connect/aliases/f +++ b/.config/kak/autoload/connect/aliases/f @@ -3,7 +3,7 @@ # Edit fifo buffer in a client mkfifo buffer.fifo trap 'rm buffer.fifo' EXIT -:send edit! -fifo "$PWD/buffer.fifo" '*fifo*' +:send evaluate-commands -try-client tools %{edit! -fifo "$PWD/buffer.fifo" '*fifo*'} # Send to fifo buffer the output of the given command, # or read from stdin if available. diff --git a/.config/kak/autoload/ghostty-mac.kak b/.config/kak/autoload/ghostty-mac.kak new file mode 100644 index 0000000..036b260 --- /dev/null +++ b/.config/kak/autoload/ghostty-mac.kak @@ -0,0 +1,46 @@ +provide-module ghostty-mac %{ + +# termcmd should be set such as the next argument is the whole +# command line to execute +declare-option -docstring %{shell command run to spawn a new terminal +A shell command is appended to the one set in this option at runtime} \ + str termcmd 'open-ghostty' + +define-command ghostty-mac-terminal-window -params 1.. -docstring ' +ghostty-mac-terminal-window []: create a new terminal as an X11 window +The program passed as argument will be executed in the new terminal' \ +%{ + evaluate-commands -save-regs 'a' %{ + set-register a %arg{@} + evaluate-commands %sh{ + if [ -z "${kak_opt_termcmd}" ]; then + echo "fail 'termcmd option is not set'" + exit + fi + termcmd=$kak_opt_termcmd + args=$kak_quoted_reg_a + unset kak_opt_termcmd kak_quoted_reg_a + setsid ${termcmd} "$args" < /dev/null > /dev/null 2>&1 & + } + } +} +complete-command ghostty-mac-terminal-window shell + +define-command ghostty-mac-focus -params ..1 -docstring ' +ghostty-mac-focus []: focus a given client''s window +If no client is passed, then the current client is used' \ +%{ + evaluate-commands %sh{ + if [ $# -eq 1 ]; then + printf "evaluate-commands -client '%s' focus" "$1" + else + xdotool windowactivate $kak_client_env_WINDOWID > /dev/null || + echo 'fail failed to run ghostty-mac-focus, see *debug* buffer for details' + fi + } +} +complete-command -menu ghostty-mac-focus client + +alias global focus ghostty-mac-focus + +} -- cgit v1.2.3