From 7cdef97e2fda69c6615211bb6ddc606dc36aa13d Mon Sep 17 00:00:00 2001 From: Emil Johansson Date: Sun, 23 Aug 2026 17:41:04 +0200 Subject: [PATCH] adv_windowlist: add /awl visible toggle to show/hide the whole list Add an awl_visible ON/OFF setting and an /awl visible command to show or hide the entire window list at once, so it can be bound to a key. When awl_visible is OFF, remake() produces no items, which makes the existing machinery remove all the status bars awl created (or blank the viewer). The state lives in a setting, so it persists across reloads and restarts and can be driven with /set as well as the command. /awl visible with no argument toggles; "show"/"on" and "hide"/"off" force a state, e.g. /bind meta-w command awl visible Co-Authored-By: Claude Opus 4.8 --- scripts/adv_windowlist.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scripts/adv_windowlist.pl b/scripts/adv_windowlist.pl index 839814ec3..a383cb6cb 100644 --- a/scripts/adv_windowlist.pl +++ b/scripts/adv_windowlist.pl @@ -182,6 +182,12 @@ # last status bar it created if it is empty. # As you might guess, this only makes sense with awl_hide_data > 0 ;) # +# /set awl_visible +# * show or hide the whole window list. When OFF, awl removes all the +# status bars it created (or blanks the viewer). The state is saved, +# so it persists across restarts. See also /awl visible below to +# toggle this from a key binding. +# # /set awl_viewer # * enable the external viewer script # @@ -277,6 +283,11 @@ # # /awl restart # * restart the connection to the viewer script. +# +# /awl visible [show|hide] +# * toggle the whole window list on or off (updates awl_visible). With +# no argument it toggles; "show"/"on" or "hide"/"off" force a state. +# Handy to put on a key, e.g. /bind meta-w command awl visible # Viewer script # ============= @@ -1052,6 +1063,11 @@ sub _spread_items { } sub remake { + unless ($S{visible}) { + @actString = (); + @win_items = (); + return; + } my %abbrevList; my @wins = window_list(); if ($VIEWER_MODE or $S{sbar_maxlen} or $S{block} < 0) { @@ -1361,6 +1377,7 @@ sub reset_awl { maxlines => Irssi::settings_get_int( set 'maxlines'), maxcolumns => Irssi::settings_get_int( set 'maxcolumns'), all_disable => Irssi::settings_get_bool(set 'all_disable'), + visible => Irssi::settings_get_bool(set 'visible'), height_adjust => Irssi::settings_get_int( set 'height_adjust'), mouse_offset => Irssi::settings_get_int( set 'mouse_offset'), mouse_scroll => Irssi::settings_get_int( 'mouse_scroll'), @@ -1521,6 +1538,22 @@ package $script_pkg; $CHANGED{AWINS} = 1; } +sub toggle_visibility { + my ($data) = @_; + $data =~ s/^\s+//; $data =~ s/\s+$//; + my $visible; + if (lc $data eq 'show' || lc $data eq 'on') { + $visible = 1; + } + elsif (lc $data eq 'hide' || lc $data eq 'off') { + $visible = 0; + } + else { + $visible = $S{visible} ? 0 : 1; + } + Irssi::command('^set '.(set 'visible').' '.($visible ? 'ON' : 'OFF')); +} + sub hide_window { my ($data) = @_; my $ent; @@ -1979,6 +2012,7 @@ sub runsub { Irssi::settings_add_str( setc, set 'placement', 'bottom'); # Irssi::settings_add_int( setc, set 'position', 0); # Irssi::settings_add_bool(setc, set 'all_disable', 1); # +Irssi::settings_add_bool(setc, set 'visible', 1); # Irssi::settings_add_bool(setc, set 'viewer', 1); # Irssi::settings_add_str( setc, set 'shared_sbar', 'OFF'); # Irssi::settings_add_bool(setc, set 'mouse', 0); # @@ -2025,6 +2059,7 @@ sub runsub { Irssi::command_bind( setc() . ' attach' => 'unhide_window' ); Irssi::command_bind( setc() . ' detach' => 'hide_window' ); Irssi::command_bind( setc() . ' ack' => 'ack_window' ); +Irssi::command_bind( setc() . ' visible' => 'toggle_visibility' ); { my $l = set 'shared';