Emacs verus notification area, again

Ages and ages I wrote about letting Emacs code access the notification area.  I have more to say about it now, but first I want to bore you with some rambling thoughts and some history.

The “notification area” is also called the “status icon area” or the “systray” — it is a spot that holds some icons that are under control of various applications.

I was a fan of the notification area since it first showed up in Gnome.  I recognized it instantly as the thing I wanted that I hadn’t realized I wanted.

Now, as you know, the notification area has fallen on hard times.  It’s been removed in Gnome 3… I searched a bit for the rationale for this deletion, which as far as I can tell is just that some applications abused it, whatever that means; or that it was used inconsistently, which I think the web has conclusively proven is fine by users.  Coming from the Emacs perspective, where one can customize the somewhat-equivalent of the status area (see those recent posts on diminishing minor-mode lighters in the mode line…), and where a certain amount of per-mode idiosyncrasy is the norm, these seem like an inadequate reasons.

However, the reason doesn’t really matter.  I love the notification area!  When I moved more of my daily desktop use back into Emacs (the tides are strong but slow, and take years to come in or go out), I hooked Emacs up to it, and made it a part of my basic configuration.

It’s indispensable now.  What I particularly like about it is that it is both noticeable and unobtrusive — the former because I can have the icons blink on important events, and the latter because the icons don’t move around or obscure other windows.

Ok!  You should use it!  And I totally plan to tell you how, but first some boring history.

My original post relied on a hacked version of the Gnome zenity utility.  This turned out to be a real pain over time.  I had to rebuild it periodically, adding hacks (once removing chunks), etc.  Sharing it with others was hard.  And, for whatever reason, the patches in Gnome bugzilla were completely ignored.  Bah.

A bit later I wrote a big patch to Emacs to put all this into the core.  That patch was rejected, more or less.  Bah two.

Then even later I flirted with KDE for a bit.  Yes.  KDE had the nice idea to expose the notification area via dbus, and Emacs could talk dbus… so I did the obvious thing in elisp.  However the KDE notification area was pretty buggy and in the end I had to abandon it as well.

So, it was back to zenity… until this week, during my funemployment.  I rewrote my hacks in Python.  This was so easy I wish I’d done it years and years ago.

I’m not sure what the moral of this story is.  Maybe that my obsession is your gain.  Or maybe that I have trouble letting go.

Anyway, the result is here, on github, or in marmalade.  You’ll need Python and the new (introspection-based) Python Gtk interfaces.  This of course is no trouble to install.  The package includes the base status icon API, plus basic UIs for ERC and EMMS.  Try it out and let me know what you think.

6 Comments

  • How about a screenshot or two, showing what it looks like? 🙂

  • Nice that you got this working again!

    Out of curiousity, did you ever investigate a pure-Emacs solution to the notification problem, i.e., implementing a notification area on the mode-line? If Nyan Cat can appear in the mode-line then it should be possible to replicate the graphical part of the systray UI. I prefer to run Emacs fullscreen so I mostly don’t see the systray, which is why I ask.

    For ERC, except for an obscure situation related to multiple clients connected to emacs –daemon, ERC’s built-in mode-line notifications have worked well for me.

    Another question; do you plan to implement a “You’ve Got Mail” notification for Gnus? That would be useful enough that I would probably switch to running Emacs maximized to keep the notification area visible. Though the Gnus notification problem seems hard because in general Gnus needs to block the UI to check for mail (that’s why I found the display-time-mode mail flag unsatisfactory).

  • [new version without linebreaks]

    What is the main difference from notifications.el?

    I get neither icon nor tooltip in Gnome3 when I try your emms-example. Here’s a screenshot. I did the following to get it to work

    (add-to-list 'load-path "/tmp/download/emacs-status-master/")
    (load "/tmp/download/emacs-status-master/status.el")
    (setq status-python "python2")
    (with-eval-after-load 'emms (require 'emms-status) (emms-status-start))

    Thomas, for mail notifications one can use gnus-notifications.el shipped with Emacs, e.g. (add-hook 'gnus-after-getting-new-news-hook 'gnus-notifications). It uses the notifications.el which sends notidications via dbus. There’s a screenshot on the author’s page. For periodic checking of gnus you can use the gnus-demon, (gnus-demon-add-handler 'gnus-demon-scan-mail 3 1). offlineimap, which supports IDLE, can be used to download mail.

  • I didn’t ever consider putting the notifications into the mode-line. Historically I avoided the mode line since it was already too crowded; and I didn’t revisit this part after my recent mode-line hacks. It seems pretty easy to do, though — just a bit of hacking in status.el, I suppose. You could keep the same API but have it load the image in Emacs and stuff it into the appropriate part of the mode line. The only oddity here is that I don’t know of a good way to make it blink, so you’d have to mess around with timers.

    I wasn’t planning to implement a mail notification thing. I stopped using one of these because I just always had mail, and so it didn’t tell me anything.

  • rasmus – as far as I know notifications.el doesn’t make a status icon. It emits a notification, which is totally different. I do use notifications a little (there’s some code in status.el too) but I don’t like them as much, because they are more intrusive.

    Sorry it didn’t work for you. There must be some bug. It does actually work! But I will try to see what I can do.

  • I agree to your argument that the web prooved that inconsiststently is “accepted” by users, but thats more or less only because they had never a choice.

    I hate the browser, its just so retarded to render images of text in a way my eyes hurt.

    Instead of everything looks like I want it like I themed it, every sites looks completly different, some ok many horrific different from my taste.

    They did not even fix the passwort problem, so u have to type in your passwort everytime or save it in the web browser what makes it horrific if you use different pcs or u save all your passworts directly on the nsa spaces by google or facebook.

    The only reason the web exists in the way it does, is that companies can brand their “content” and they can blend in advertisement in the most anoying way possible.

    I will not even want to konw how many plants we could shut down if we would not use this waste of useless processor time killer technic.

    Even a black google alone could save many of them, and I think not using this inefficient dumb technic would be even worth more.

    So back to notification, they replaced it with something similar, as far as I understand the other commands, its that what us used here.

    So where is the problem? U can use some notifications and all is fine. No big fight against windmills.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.