From feebad14b057b216449b63485a35d831e9a7859f Mon Sep 17 00:00:00 2001 From: codesoap Date: Tue, 18 Jun 2019 09:54:19 +0200 Subject: [PATCH 1/3] Set the REPL window title using xdotool As mentioned in issue #2973, the -t argument for setting the terminal title was not very portable. --- rc/windowing/repl/x11.kak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rc/windowing/repl/x11.kak b/rc/windowing/repl/x11.kak index 54966c2a..1fcea07b 100644 --- a/rc/windowing/repl/x11.kak +++ b/rc/windowing/repl/x11.kak @@ -15,7 +15,9 @@ All optional parameters are forwarded to the new window} \ exit fi if [ $# -eq 0 ]; then cmd="${SHELL:-sh}"; else cmd="$@"; fi - setsid ${kak_opt_termcmd} ${cmd} -t kak_repl_window < /dev/null > /dev/null 2>&1 & + setsid ${kak_opt_termcmd} \ + "xdotool getactivewindow set_window --name kak_repl_window \ + && exec \"${cmd}\"" < /dev/null > /dev/null 2>&1 & }} define-command x11-send-text -docstring "send the selected text to the repl window" %{ From 9d8fb8bc31a1ec7fecc0b6e938b30d2278021e48 Mon Sep 17 00:00:00 2001 From: codesoap Date: Tue, 18 Jun 2019 11:41:59 +0200 Subject: [PATCH 2/3] Print escape sequence to set the window title Using xdotool was probably a little less portable, because it relied on the newly created window to be activated by the window manager. --- rc/windowing/repl/x11.kak | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rc/windowing/repl/x11.kak b/rc/windowing/repl/x11.kak index 1fcea07b..451259bc 100644 --- a/rc/windowing/repl/x11.kak +++ b/rc/windowing/repl/x11.kak @@ -15,9 +15,8 @@ All optional parameters are forwarded to the new window} \ exit fi if [ $# -eq 0 ]; then cmd="${SHELL:-sh}"; else cmd="$@"; fi - setsid ${kak_opt_termcmd} \ - "xdotool getactivewindow set_window --name kak_repl_window \ - && exec \"${cmd}\"" < /dev/null > /dev/null 2>&1 & + setsid ${kak_opt_termcmd} "printf '\e]2;kak_repl_window\a' \ + && ${cmd}" < /dev/null > /dev/null 2>&1 & }} define-command x11-send-text -docstring "send the selected text to the repl window" %{ From df03a8850c17e32236c2a94986f9f4c64b27ea5e Mon Sep 17 00:00:00 2001 From: codesoap Date: Tue, 18 Jun 2019 11:52:33 +0200 Subject: [PATCH 3/3] Comment on the escape sequence for setting the terminal's title --- rc/windowing/repl/x11.kak | 1 + 1 file changed, 1 insertion(+) diff --git a/rc/windowing/repl/x11.kak b/rc/windowing/repl/x11.kak index 451259bc..908645d5 100644 --- a/rc/windowing/repl/x11.kak +++ b/rc/windowing/repl/x11.kak @@ -15,6 +15,7 @@ All optional parameters are forwarded to the new window} \ exit fi if [ $# -eq 0 ]; then cmd="${SHELL:-sh}"; else cmd="$@"; fi + # The escape sequence in the printf command sets the terminal's title: setsid ${kak_opt_termcmd} "printf '\e]2;kak_repl_window\a' \ && ${cmd}" < /dev/null > /dev/null 2>&1 & }}