irssi is probably the most popular commandline IRC client out there. It has a well established userbase, lots of plugins and can be extended to support other protocols (XMPP and SILC are documented here).
Contents
General configuration
See CommentSeConnecterSurIrc#Avec_irssi.
Tips
Hilighting your nick
Use /hilight -nick your_nick to highlight your nick regardless of where it appears on the line (by default it will be highlighted just at the beginning of a line)
Switching to another window by name or number
When you start having lots of windows, it becomes really interesting to be able to jump directly to another window. To do that, you can use the command "window go <name-or-number>" (abbreviated as "win ..." in the examples below) with either a window name or its number:
/win go 13
/win go LeLutin
/win go #koumbit
The window name is a person's nickname if it's a private chat, or the channel name (including the leading hash sign).
renumbering windows
Yeah, like when you need to connect to some other server after netsplit:
/set windows_auto_renumber off
Protip: if you have window numbers in irssi above 100, you look super 733t.
/window number 666
Ignoring channel noise
You can get rid of join and part messages, making busy channels readable again. See /help ignore for details, or follow the instructions here.
If you don't want to RTFM, just type this: /ignore * JOINS PARTS QUITS MODES NICKS
History search
You can search in your irssi history using ctrl-R like in bash with this script: http://scripts.irssi.org/scripts/history_search.pl
You can also use /lastlog: https://irssi.org/documentation/help/lastlog/
Adding colour to messages
To add colours to things you say in irssi, you can hit Ctrl-C, followed by the color code and then type your message.
The following script will show a popup with colour codes when you hit Ctrl-C so you can know which ones to use: https://scripts.irssi.org/scripts/mirc_colour_popup.pl
UTF-8 Emojis
This is kind of just silly really.. but with this plugin you can show UTF-8 emojis with simple ascii tags like :coffee: and :fire:
https://github.com/cespgoespoop/irssi-emojis
SSL certificate authentication
You can also create a secure certificate to authenticate to NickServ without a password (details)
Graphical popup notifications
anarcat technique: complicated proxy
This allows you to connect transparently to your home server that's already connected to your channels, and to have your local irssi running as if it was on your server, yet still have local popups that show up on your desktop. It's made of two parts, the configuration of the proxy/client and the notification configuration.
Proxy configuration
This is an extension of the official documentation.
configure irssi to load the proxy module on a long-running server (shell.koumbit.net or home server), then configure the proxy settings:
echo load proxy >> ~/.irssi/startup
- run irssi in a screen on that server and configure the proxy settings
/set irssiproxy_password CHANGE THIS PASSOWRD, IDIOT! /set irssiproxy_ports freenode=7777 IMC=7778 /set irssiproxy_bind 127.0.0.1 /save
note that you need to change that password! Also, you should have one port per IRC server you are configured to connect to on the server in the second line (irssiproxy_ports). Also note that this makes irssi behave as an IRC server on localhost!!
setup tunneling for those ports, in ~/.ssh/config:
Host shell.koumbit.net LocalForward 7777 localhost:7777 LocalForward 7778 localhost:7778
You can also use -L7777:localhost:7777 -L7778:localhost:7778 on the commandline if you don't want to edit your .ssh/config but the advantage here is that any connexion you make to the server will open the tunnel, regardless of wrapper script, which can avoid the need to start multiple SSH connexions.
- setup a wrapper script (optional):
host=${1:-anarcat.ath.cx} cd $HOME if nc -z localhost 7777; then echo "tunnel already started on port 7777" else echo starting ssh tunnel ssh -a -f -NT $host if !nc -z localhost 7777; then echo "tunnel cannot be started on port 7777, aborting" echo "make sure .ssh/config is configured with lines like this:" echo "Host $host" echo " LocalForward 7777 localhost:7777" echo " LocalForward 7778 localhost:7778" echo "..." exit 1 else echo "tunnel opened" fi fi irssi --config=.irssi/config.proxy
Note that this script checks if the tunnel is already started and avoid starting it if so
- run and configure irssi on the client:
/server add -auto -network freenode localhost 7777 "CHANGE THIS PASSOWRD, IDIOT!" /server add -auto -network IMC localhost 7778 "CHANGE THIS PASSOWRD, IDIOT!"
Notification configuration
This configures notifications on your desktop.
sudo apt-get install libnotify-bin cd .irssi/scripts wget http://irssi-libnotify.googlecode.com/svn/trunk/notify.pl ln -s ../notify.pl autorun/ wget http://dev.ufsoft.org/projects/irssi-notifier/repository/revisions/master/entry/irssinotifier/data/irssi_mini.png # optional
In irssi:
/load perl /script load notify /set notify_icon /home/anarcat/.irssi/scripts/irssi_mini.png # optional (yes, need the full freaking path) /save /msg anarcat test # should "just work"
Regular workflow
When I come into the office, I login on my home server using:
workstation$ ssh shell.koumbit.net
... and open my screen session to see if anybody left me messages, and to check my mail:
shell$ screen -R
Obviously, if my irssi session has terminated because of a crash or a return from vacation, i need to start it again:
shell$ irssi
I usually leave that session opened to check my mail, but then for IRC, i start the proxy client using the above script, which provides for notifications:
workstation$ ./bin/irssi_proxy
This just starts irssi in client mode. I can also run just the latter script without launching ssh manually if i'm in a hurry.
Note that contrary to scyrma's technique, I do not get messages through mail while I'm gone, I go through my screen session manually.
mvc technique: simple script
To get gnome to notify me with a graphical popup when I'm mentioned in irc, I used this tutorial: http://pthree.org/2007/03/21/irssi-gui-notify/
The steps are:
- run irssi on shell.koumbit.net
make sure notify-send is installed locally (provided by libnotify-bin on debian and ubuntu)
place fnotify.pl in ~/.irssi/scripts/autorun/fnotify.pl on shell.k.n
if you want to run the script without restarting irssi, copy it to ~/.irssi/scripts/fnotify.pl and type /RUN fnotify.pl
place irssi-notify.sh in ~/bin/irssi-notify.sh on your local machine
in irssi-notify.sh change your.ssh.host to shell.koumbit.net and change the notify-send invocation line to notify-send -i gtk-dialog-info -- "${heading}" "${message}"
- make sure that your ssh key is on shell.koumbit.net
start this script at session login ( go to System > Preferences > Startup Applications and select bin/irssi-notify.sh)
Copies of the above scripts in case the links go stale:
At step 8 if you're using gnome 3, you need to create a file ~/.config/autostart/irssi-notify.desktop with content similar to this:
[Desktop Entry] Type=Application Exec=/home/youruser/bin/irssi-notify.sh Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true Name[en_CA]=irssi-notify Name=irssi-notify Comment[en_CA]=Irssi notifications Comment=Irssi notifications
debugging the mvc technique
- Testing
Either get someone to ping you, or /msg goumbot ping - the resulting pong should trigger a notify for most irssi configs
- Starting fnotify manually
- I've noticed that fnotify does not always start automatically when placed in autorun - so try the instructions in step 4 to be sure you are not affected by this issue.
emm technique for OSX (Yosemite)
Same as mvc with a twist! Read mvc technique first and then come back here.
- run irssi on shell.koumbit.net
place fnotify.pl in ~/.irssi/scripts/autorun/fnotify.pl on shell.k.n
install Growl (not free)
install growlnotify
install Keyboard Maestro (not free)
Since I have already Growl and Keyboard Maestro, it's not a problem for me to use these paid applications. But I will try later to show how to replace these with free alternatives (using osascript -e to call the display notification command to replace Growl, and cron to replace Keyboard Maestro).
Instead of Growl and Keyboard Maestro you can use these two free solutions:
Use AppleScript on the terminal: http://apple.stackexchange.com/questions/57412/how-can-i-trigger-a-notification-center-notification-from-an-applescript-or-shel
osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title"'
Use terminal-notifier (Ruby): https://github.com/julienXX/terminal-notifier
Here's the script you have to install on your Mac in ~/bin/irssi_growlnotifier.sh (this is based on this excellent tutorial find here.
# irssi_growlnotifier.sh # based on http://www.matthewhutchinson.net/2010/8/21/irssi-screen-fnotify-and-growl-on-osx SCRIPT_NOT_RUNNING=`ps aux|grep -i ssh|grep "emmanuel@shell.koumbit.net -o PermitLocalCommand"` if [ -z "$SCRIPT_NOT_RUNNING" ] then (ssh emmanuel@shell.koumbit.net -o PermitLocalCommand=no ": > .irssi/fnotify ; tail -f .irssi/fnotify " | \ while read heading message; do \ /usr/local/bin/growlnotify -s -t "${heading}" -m "${message}"; \ done)& else exit fi
Since ssh is not mosh, and Yosemite is quite aggressive terminating non active connections, we use Keyboard Maestro to relaunch the script irssi_growlnotifier.sh when you log in your Mac, or when the Mac wake up from sleep.
Create a new macro in Keyboard Maestro called Launch irssi_growler.sh.
Add the trigger At system wake
Add the trigger At login
Add the trigger The status item is selected: this is for launching the script from the Keyboard Maestro menu if both triggers don't work.
Add the action Execute a shell script with Execute script file and point this action to ~/bin/irssi_growlnotifier.sh
Start a screen session and connect to shell.koumbit.net and launch irssi.
Launch the ~/bin/irssi_growlnotifier.sh script either via your local shell or the Keyboard Maestro menu.
You are now all set!
-- EmmanuelDecarie 2015-03-26 05:42:11
Pancake technique - start shell and notify with keyboard shortcut
One keyboard shortcut to do the following:
- Start fnotify.pl
- Start a quake terminal (or a regular terminal window)
- Start ssh session to shell.k and attach the screen running irssi
First create a script to initiate the ssh session. and place it somewhere like ~/bin/ssh_kshell.sh (chmod 700)
# # start an ssh session and attach the screen running irssi ssh -t pancake@shell.koumbit.net "screen -Dr irssi" # Detach the screen first!
Then add this to your irssi-notify.sh file after the ICON Variable
... ICON="$HOME/.local/share/icons/irssi-icon.png" # on local host deepin-terminal -q -e $HOME/bin/ssh_kshell.sh | notify-send -i gtk-dialog-info -i ... ...
I'm using deepin terminal, but options for other terminals should be similar.
Next, just bind ~/bin/irrsi-notify.sh to a keyboard shortcut!
ET VOILÀ!
<SUPER> + i : exec irssi-notify.sh
<SUPER> + t : show / hide quake terminal
Tor
Il est possible camoufler l'origine de sa connexion sur un réseau irc avec Tor.
Méthode A
Pour sécuriser la connexion, on utilise l'authentification avec sals. http://www.andrews-corner.org/irssi.html
Sous Debian, on a besoin des paquets suivants aussi: libcrypt-openssl-bignum-perl, libcrypt-dh-perl, libcrypt-blowfish-perl
$ mkdir -pv $HOME/.irssi/scripts/autorun && cd $HOME/.irssi/scripts $ wget http://freenode.net/sasl/cap_sasl.pl $ cd autorun $ ln -sv ../cap_sasl.pl
bientôt le reste de la configuration.
$ torify irssi
Note, le tls/ssl ne passe pas sur le torsock voir https://trac.torproject.org/projects/tor/wiki/doc/TorifyHOWTO/irssi
Méthode B
Installer torsocks et rouler:
env -i TERM=$TERM torsocks irssi --config=/dev/null -\!
env -i flushes your environment to make sure your identity doesn't through to the server.