irssi and X aware autoaway

kategorie: howto
publikoval: robo
datum a čas: 26-11-2006 22:40:07

I use irssi mainly to connect to bitlbee. It's a gateway which provides you with IRC like access to ICQ network. You can use whatever IRC client to get connected to ICQ network. Nice isn't it?. (Yeah, I connect to real IRC sometimes too ;). The annoying thing is that you have to set your away status manually or you can use autoaway script which sets you away after irssi inactivity period. So for example you are doing some other stuff while irssi is running in background and you are set away. I don't like this. I want to be marked away when I'm really away (like most graphical clients do, eg. gaim comes to mind). (Please, let me know if I'm reinventing the wheel here).

I have irssi running all the time on my home machine where I connect to from various places. Remote functionality is important to me.

What do we need? 1. Some way to get notified about user inactivity in X. 2. Some way to let the running instance of irssi know about our away status.

After some searching I found xlock & xlockmore. This combo can be used to do exactly our first part of the job.

$ emerge xlock

(xlock installs xlockmore as a dependency)

Until recently I didn't know about a simple way to send commands to irssi remotely. I thought I'd write an script for irssi to do that. Then I found this script which accepts commands on local unix socket. There is also script for sending those commands to running irssi instance. Scripts are written by f0rked who's got a lot of interesting things about irssi, bitlbee & co on his homepage. Go check them out.

Download above scripts. Put into .irssi/scripts/ directory and somewhere on your $PATH. Load script to irssi using /script load Try to run commands via

$ "/away a"

(I still don't know what to pass to /away so I use whatever is near my finger. Explanation someone?)

I wrote following helper scripts:



~/bin/ "/away a"



~/bin/ "/away"

Now the only missing part has been xlock stuff. This is rather simple:

$ xautolock -time 4 -locker "xlock -mode blank -lockdelay 600 -startCmd set_irssi_away -endCmd set_irssi_online"

time - start locker after this time; locker - command; mode - you can choose whatever mode you like, I like blank; lockdelay - password is put to effect after this period; startCmd - command to run when locking; endCmd - command to run when unlocking

If you want to know more about these commands see their corresponding man pages. I put this line into ~/.xinitrc file. For some people there could be one downside. After some time (for me it's 4 mins + 600 secs = 14 mins) the screen gets locked and you'll need a password to unlock (yep, xautolock and xlock are for screen locking after all).

Now wait 4 minutes or time you set to test your setup. Machine doesn't react to mouse movements use keyboard instead.

As about remote setup I haven't had a chance to test it yet as this all happened just today. I'll update as soon as I have it tested. Basically this should be as simple as setting the right $DISPLAY and maybe disabling xlock-ing on localhost but it may not be necessary.

Let me know down here how stupid or genial I am. Obligatory info: Yes, I know my English is horrible. Thanks for reading.

Přidej příprcek:

Ochrana proti spamu. Napište prosím číslo tisíc-dvě stě-třicet čtyři:

08-06-2010 13:44:24 Σ B @ 56758 #^

Your English is excellent, not horrible.