3

I'm writing a simple osd_cat-based utility to display messages received through libpurple (via Finch or Pidgin, for example).

As of now, this is what I have managed to create:

dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | awk '/string/ && (NR%2==1) {split($0, sender, "\"") }; /string/ && (NR%2==0) {print sender[2] ": " substr($0,11) }' | osd_cat --pos=top --align=right --indent=8 -O 4 -u white

Or split into multiple lines for enhanced reading pleasure:

dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg"
 | awk '/string/ && (NR%2==1) {split($0, sender, "\"") };
        /string/ && (NR%2==0) {print sender[2] ": " substr($0,11) }'
 | osd_cat --pos=top --align=right --indent=8 -O 4 -u white

I did some experimenting, and found following to work:

yes | osd_cat
echo "text" | osd_cat
dbus-monitor | osd_cat
dbus-monitor | awk '{print $0}' | osd_cat
dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | osd_cat

But following do not work:

dbus-monitor | awk '{print $1 $2}' | osd_cat
dbus-monitor "interface=im.pidgin.purple.PurpleInterface, member=ReceivedImMsg" | awk '{print $0}' |osd_cat

I am completely lost.

  • What do you mean by “do not work”? Do you get an error message? Or do you just see no output? – Gilles Dec 2 '11 at 1:03
  • @Gilles I simply do not see any output. – Llamageddon Dec 2 '11 at 13:46
2

Old question, but for googlers:

I was having similar problems, but on a much simpler scale. I was simply trying to do

echo "Some string\nWith a bunch of chars" | osd_cat

What I found is that osd_cat seems to have some issues with either lagging detection of availability of the OSD mechanism, or input buffering problems.

If the input string is too long (it varies between 7 and 11 printable characters on my system), it will hang for the delay time and then exit without ever showing anything.

My issues disappeared if I used the --wait option to osd_cat.
The side effect however is that it can take more than 5 seconds for the message to appear (on my system). Any delay times you specify for osd_cat only start once the message is visible at least, but that can mean a message meant to be displayed for the default 5 seconds will take 5 seconds to show up, and then be visible for another 5 before disappearing.

On a related note this seems to be a problem with all tools built on top of osd_cat as well, and none of them account for it. The list of these tools from the original author are on his page (as listed on the man page for osd_cat) at: http://ignavus.net/xosd
This includes the more common osdsh, which is what I was trying to find an alternative for, since it would intermittently display nothing on invocation, when I stumbled on osd_cat.

  • It took me a while to even remember what this was all about. Quite late, but nonetheless, thank you for your answer! I'm accepting it. – Llamageddon Oct 13 '17 at 0:58
  • You have written the longest accepted answer on the whole site. – peterh Apr 21 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.