From 6b0474818e13aacc613638084832f97ca6312515 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Thu, 2 Feb 2023 01:42:41 +0100 Subject: [PATCH] Add window_title plugin Sets screen/xterm window title (unfortunately, not the window *name* in tmux/screen) --- plugins/window_title | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/window_title diff --git a/plugins/window_title b/plugins/window_title new file mode 100644 index 0000000..6f6d586 --- /dev/null +++ b/plugins/window_title @@ -0,0 +1,14 @@ +sub _set_title($title) { + my $term = $ENV{TERM} or return; + print "\e]2;$title\a" if $term =~ /^xterm|^rxvt/; + print "\e]2;$title\e\\" if $term =~ /^screen/; # includes tmux +} + +sub hook_prompt($class, $cart, $prompt, @) { + _set_title($cart->size ? "*RevBank" : "RevBank"); +} + +END { + _set_title("-"); +} +