Don't understand german? Read or subscribe to my english-only feed.

centericq – displaying hint when new message arrives

I wanted to have this feature for quite some time. Today I realized it with osdsh. osdsh in combination with osdctl now displays a blue text in the centre and top of X (when it’s running) on every virtual desktop. So I don’t have to check for new messages such often (centericq is running inside a screen-session). I receive this message only in online-mode so it won’t disturb while playing dvds, working,…

# snippet of ~/.centericq/external
%action display-message-via-X
event msg
proto all
status online
options nowait
%exec
#!/bin/sh
if [ -z $(ps aux | grep "[X]11/X") ] ; then
  exit 0;
else
  nname=`head -n 46 $CONTACT_INFODIR/info | tail -n 1`
  if [ -z $(ps aux | grep "[o]sd") ] ; then
    DISPLAY=:0.0 osdsh -c blue -n 19 -o 1 --a 1 && sleep 3 &&
    osdctl -s "centericq: $nname,"
  else
    osdctl -s "centericq: $nname,"
  fi
fi

What I’d like to have is using such a feature while sitting on remote hosts. Any ideas? 8-)

Update: Changed the osdctl-command due to it expects two lines in any case, seperated by a comma. Thanks for the hint to Karl Voit.

2nd Update: corrected a spelling-error in the commented line of the script, of course it’s ~/.centericq/external and not external’s’ ;)

5 Responses to “centericq – displaying hint when new message arrives”

  1. olaf Says:

    Hi, Mika! Is ‘externals’ a standard configuration file provided with your centericq installation?

  2. olaf Says:

    See http://www.centericq.de/docs/readme.php?mode=2#9.3 – but on my debian sid box ‘externals’ didn’t exist…

  3. mika Says:

    Just create the file ~/.centericq/external (where your centericq-config is located) and edit it. You even don’t need to restart centericq. Have fun :)

  4. oblivion Says:

    Yeah !

  5. Andre Says:

    I had to modify this script in order to get it working:

    %action display-message-via-X
    event msg
    proto all
    status online
    options nowait
    %exec
    #!/bin/sh
    xinf=`ps aux | grep “\[X\]11/X”`
    if [ “$?” -eq 0 ] ; then
    exit 0;
    else
    nname=`head -n 46 $CONTACT_INFODIR/info | tail -n 1`
    osd=`ps aux | grep “\[o\]sd”`
    if [ “$?” -eq 0 ] ; then
    DISPLAY=:0.0 osdsh -c blue -n 19 -o 1 -a 1 && sleep 3 &&
    osdctl -s “centericq: $nname,”
    else
    osdctl -s “centericq: $nname,”
    fi
    fi