Cleanup dead irssi windows

Filed under tips & tricks on feb 01, 2010

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 <SECONDS>

    • 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!

Add to

Feedback

No feedback has been posted.

Post your feedback

You can use this form to leave your feedback. Your insights are always appreciated.

Tools

View document source in text/plain