How do I join all the channels in my weechat layout?

Sometimes I need to reboot my linode, which includes my IRC client, weechat, running in tmux. When I do this, I prefer to save all the buffers that are running and rejoin them. I was under the impression that:

 /layout save
 /save

Would store the appropriate information and

 /layout apply

Would... well apply it. Unfortunately, while it correctly places new channels, it does not in any way rejoin the ones I was connected to before. I understand that I can manually add a list of channels to autojoin, for each network, but if I have to do that tedious process each time I need to close and reopen weechat... well that would be a drag at the very least.

Any ideas? I am sure I've done this before.


Okay, after asking around in the freenode #weechat channel a bit I finally got this:

  • Download the autojoin.py script to ~/.weechat/python/autoload
  • Run /python autoload to load the script
  • Run /autojoin --run to store the channels to join
  • Run /layout store to store the order of the channels
  • Run /save to save your settings to a file

Next time you start weechat and connect to a server the channels you were connected to when you did these steps will be joined for you.


Here is how you can automate the other answer such that your buffer layout is saved to disk every hour:

  1. Get the cron.py user script:

    • Run /script (e.g. in the weechat.core buffer)
    • Type cron, press Enter in the buffer which was just opened
    • Select cron.py via cursors, type i and press Enter for installation.
  2. In the weechat.core buffer, execute the following command:

    /cron add 0 1 * * * * core.weechat commands /autojoin --run;/layout store;/save
    

    This adds an hourly cron job running the commands the other answer suggested. Note that the commands are separated by ; without trailing spaces! Execute /cron help for more information.

  3. Test this by first executing /cron list, remembering the number of the cron job you just added (e.g. 001), and then running /cron exec 001.