15

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.

Frew Schmidt
  • 1,301

4 Answers4

18

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.

alexjj
  • 23
Frew Schmidt
  • 1,301
5

WeeChat 3.5 (released on 2022-03-27) has introduced a built-in /autojoin command. If you are running version 3.5 or above, the autojoin.py script mentioned in Frew's answer is no longer needed. The updated steps are as follows:

  1. Run /autojoin apply to set the currently joined channels in the autojoin option.
  2. Run /layout store to store the order of the channels.
  3. Run /save to save your settings to a file.

The 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.

ntwk
  • 51
2

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.

ComFreek
  • 591
0

I'm using Weechat 3.8 and had some trouble making the built in /autojoin command work with the cron.py script.

  • /autojoin apply needs to be ran on an irc buffer (server, channel, or private).

  • To save all channels on all servers you can run /allserv /autojoin apply from anywhere.

  • The cron job mentioned by ComFreek should now read:

    /cron add 0 1 * * * * core.weechat commands /allserv /autojoin apply;/layout store;/save