Add window_title plugin

Sets screen/xterm window title (unfortunately, not the window *name* in
tmux/screen)
This commit is contained in:
Juerd Waalboer 2023-02-02 01:42:41 +01:00
parent 1696028ce3
commit 6b0474818e

14
plugins/window_title Normal file
View file

@ -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("-");
}