From 863add8fd85dc70e00e25ff8d7bf4aef1647fecc Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Thu, 29 May 2025 19:05:14 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-29 19:05:14 --- .config/kak/autoload/title.kak | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.config/kak/autoload/title.kak b/.config/kak/autoload/title.kak index ffcd9172..d7118a1f 100644 --- a/.config/kak/autoload/title.kak +++ b/.config/kak/autoload/title.kak @@ -1,5 +1,6 @@ # TODO: make the operation async! # Is there something we can do with global vs. window scoped title? +declare-option bool bar_debug false declare-option -docstring %{ Format string passed to printf for the bufferlist. It should be set in the global scope. @@ -39,6 +40,9 @@ declare-option -docstring %{ define-command -hidden bar-buflist %{ nop %sh{ { + if [ -z "$kak_client" ]; then + exit + fi list='' index=0 while read buf; do @@ -63,13 +67,18 @@ EOF title="$list - $kak_client@[$kak_session]" # printf "eval -verbatim set-option -add window ui_options %%{terminal_title=%s}" "$title" | kak -p ${kak_session} - printf "eval -try-client '$kak_client' -verbatim set-option -add global ui_options %%{terminal_title=%s}" "$title" | kak -p ${kak_session} - printf "eval -verbatim try %%{ exec -try-client '$kak_client' }" | kak -p ${kak_session} - # printf "echo -debug -- eval -try-client '$kak_client' -verbatim set-option -add global ui_options %%{terminal_title=%s}; exec -try-client '$kak_client' " "$title" | kak -p ${kak_session} + title_cmd=$(printf "eval -try-client '$kak_client' -verbatim set-option -add global ui_options %%{terminal_title=%s}" "$title") + echo "$title_cmd" | kak -p ${kak_session} + refresh_cmd=$(printf "eval -verbatim try %%{ exec -try-client '$kak_client' }") + echo "$refresh_cmd" | kak -p ${kak_session} + if [ "$kak_opt_bar_debug" = "true" ]; then + printf 'echo -debug -- %s' "$title_cmd" | kak -p ${kak_session} + printf 'echo -debug -- %s' "$refresh_cmd" | kak -p ${kak_session} + fi } > /dev/null 2>&1 < /dev/null & } } - +set global bar_debug true hook global WinDisplay .* bar-buflist hook global FocusIn .* bar-buflist # hook global FocusOut .* bar-buflist