.. Original article at http://text.maze.io/2010/02/01/cleanup-dead-irssi-windows _______ ____________ _______ _\__ /_________ ___ _____ | _ _ \ _ | ____\ _ / | |/ _ \ | / / / / | | | /___/ _ | | / / |___/___/ /___/____|________|___ | |_| |___|_____/ \__/ |___| (c) 2010 Wijnand 'maze' Modderman - http://maze.io/ Cleanup dead irssi windows ========================== A quick oneliner to cleanup dead irssi_ windows (split over multiple lines to aid readability):: /script exec foreach $w (sort {$b->{refnum} <=> $a->{refnum}} Irssi::windows()) { if ((!$w->items()) && !($w->{refnum} == 1)) { Irssi::print("window closing " . $w->{refnum}); Irssi::command("window goto $w->{refnum}"); Irssi::command("window close"); } } Please keep in mind that: * application windows will be closed (like twirssi_'s status, etc) * `hint`: ``/window immortal ON`` * dead queries will be closed * you should also take a look at ``/set query_auto_close `` * `hint`: ``/set query_auto_close 86400`` to close a query after a day of inactivity Some quick tips: * use ``/layout save`` if you are happy, it makes irssi_ store your current layout * use ``/foreach query /unquery`` to close all queries * NB: Habbie_ reported that this might crash irssi if you have lots of open queries * use ``/set reuse_unused_windows ON`` to "recycle" windows after they are dead * check out `quick tips for irssi+screen users `_ * check out `irssi keyboard mapping `_ Thanks `#irssi `_ for helping out. Happy chatting! .. _irssi: http://irssi.org/ .. _twirssi: http://twirssi.org/ .. _Habbie: http://blog.dataloss.nl/