Monument (marnanel) wrote,

Command-line notifications

The other day, over porter somewhere in Dublin, we were discussing people who run curses-based applications in the X terminal under Maemo, rather than using the GUI. (For example, some people run mutt rather than modest, irssi rather than xchat, and so on.) Sometimes people do this because they want or need to run the client on a remote machine, and they don't want to bother with X forwarding. Sometimes they just prefer the character interface.

The idea was then floated of having an escape sequence which caused the client to pop up a notification, so that even a curses-based application running on a remote server could alert you that you had new mail, or that someone had just said your name in channel.

So on the plane home, I hacked up an example implementation:

You can find the patches here:Further thoughts:
  • it still needs osso-xterm integration, but that should be easy
  • patches to mutt, irssi, and so on to produce these sequences would be useful
  • we need to work out something to do with terminfo to report that this sequence may be generated
  • it uses OSC code 55, which is otherwise unused in gnome-terminal, but I don't know whether anyone else uses it for anything.  (The relevant spec, ECMA-48, says that OSC codes are user-defined, but I'd still rather not tread on anyone's toes.)
  • it only allows the sequence to be terminated by BEL; this is traditional, but ECMA-48 actually requires ST instead.  This will be trivial to allow as well.
  • I'm not at all sure about min/max versions of libnotify
(Of course, there are also other ways to get the same effect.  But I think this is a good general solution.)

(Edit: naltrexone suggests appropriate Flann O'Brien parody.)

Your thoughts (and patches) are welcome, as always.
Tags: pgo, pmo
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded