revbank/plugins/window_title
Juerd Waalboer 6b0474818e Add window_title plugin
Sets screen/xterm window title (unfortunately, not the window *name* in
tmux/screen)
2023-02-02 01:42:41 +01:00

14 lines
306 B
Text

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