WeeChat tips
From FlashTux
English | Français | Español | (+/-)
Remote control
Since version 0.1.1 you can remote control WeeChat, by sending commands or text to a FIFO pipe (you have to enable option "irc_fifo_pipe", it is disabled by default).
The FIFO pipe is located in ~/.weechat/ and is called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of running WeeChat).
So if many WeeChat are running, you have many FIFO pipe, one for each session.
The syntax for the FIFO pipe commands/text is:
server,channel *text or command here
where server and channel are optional, but if channel is here, server should be too.
Some examples:
- change your nick on freenode to "mynick|out":
-
echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345
- display text on #weechat channel:
-
echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345
- display text on current channel (buffer displayed by WeeChat, this is dangerous and you should not do that except if you know what you do!)
-
echo "*hello!" >~/.weechat/weechat_fifo_12345
- send 2 commands to unload/reload Perl scripts (you have to separate them with \n):
-
echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345
You can write a script to send command to all running WeeChat at same time, for example:
#!/bin/sh
if [ $# -eq 1 ]; then
for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do
echo -e "$1" >$fifo
done
fi
If the script is called "auto_weechat_command", you can run it with:
-
./auto_weechat_command "freenode,#weechat *hello"
Written by FlashCode

