From: Tom Tromey <tromey@redhat.com>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: emacs-devel@gnu.org
Subject: Re: RFC: status icon support
Date: Mon, 31 Dec 2007 11:29:51 -0700 [thread overview]
Message-ID: <m3y7bad8f4.fsf@fleche.redhat.com> (raw)
In-Reply-To: <200712311718.lBVHIImK029996@oogie-boogie.ics.uci.edu> (Dan Nicolaescu's message of "Mon\, 31 Dec 2007 09\:18\:18 -0800")
>>>>> "Dan" == Dan Nicolaescu <dann@ics.uci.edu> writes:
Dan> Very interesting idea!
Dan> What would the lisp code for this look like?
Use make-status-icon to make an icon. Then use
modify-status-icon-parameters to change it, or use show-status-icon-message
to display a notification.
E.g., for my ERC module I have the icon blink when someone mentions my
name in a channel. With the current API this would look like:
(modify-status-icon-parameters erc-status-status-icon '((blinking . t)))
It is also set up so that clicking on the status icon will switch to
the first buffer where someone has mentioned my nick:
(modify-status-icon-parameters erc-status-status-icon
'((click-callback . erc-status-select-first-buffer)))
erc-status.el isn't really ready yet though... it is still written
using the old API (using an external program). I didn't want to
rewrite it for real until something goes in.
Dan> Another possible use that comes to mind: emit some kind of notification
Dan> when a (long) compilation finishes.
Yeah. This is easy:
(defvar compilation-status-icon nil)
(defun compilation-finish-notification (buffer status)
(unless compilation-status-icon
;; No need for it to be visible; we just want to post
;; notifications for now.
(setq compilation-status-icon (make-status-icon '((visible . nil)))))
(let ((ok (string-match "finished" status)))
(show-status-icon-message compilation-status-icon
(if ok
"Compilation finished"
"Compilation failed")
:icon (if ok 'info 'warning))))
(add-to-list 'compilation-finish-functions #'compilation-finish-notification)
Currently I have code (using my old zenity-based approach) for ERC,
EMMS (a pause/play button), and calendar (clicking shows the calendar,
and in theory appointments are notifications, though this has never
really worked). Compilation mode would be useful (IMO particularly if
the compilation buffer is not visible; you could also animate the icon
during compilation). Mail notification would be easy. There are
probably other possibilities too; an emacs-based replacement for the
Gnome sticky notes applet, for instance, would be pretty simple.
The other thing I wanted to do is add menu support. This looks kind
of complicated, though. Also there's an oddity in that the current
frame at the time the menu pops up may or may not be related to the
display that the status icon appears on. Maybe this doesn't matter?
This all reminds me, though -- I need to implement status-icon-p and
status-icon-live-p.
A few more specific questions for Emacs maintainers:
* The current code is Gtk-only. Is this ok? Or do I need to get
someone to write Windows and MacOS ports first? (I don't know much
about those platforms and I have no idea whether the same
functionality works there or not.)
* Is the current API ok? modify-status-icon-parameters uses an alist,
like modify-frame-parameters. But show-status-icon-message uses
keyword arguments, since that seemed nicer there. How's that?
What about the names of the keywords and alist keys?
* I considered making a status icon a special kind of frame, but this
looked a lot more difficult. Plus, I wasn't sure what the benefit
would be. The current code is a bit strange though -- a status icon
appears on some display, currently just whatever the default is.
But if you have multiple displays you may want to have a status icon
on each. (It is unclear to me if that is expected to work on the
Gtk side -- the status icon code always seems to use the default
display, so we'd have to switch displays around in the display
manager to get this working.)
I'm not sure what to do about the display-related oddities in
general. x-close-connection should probably close the related
status icons (though we'd have to do the bookkeeping ourselves,
since AFAICT there is no way to get this info out of Gtk). For
things like erc-status or a compile-finish-function, it seems weird
to show status on an icon that may not be readily visible to the
user. (But maybe it is ok to punt on this one.)
* Or, to sum it all up: aside from the configury bits, what do you
want to see before you will check this in?
Tom
next prev parent reply other threads:[~2007-12-31 18:29 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-30 19:56 RFC: status icon support Tom Tromey
2007-12-31 17:18 ` Dan Nicolaescu
2007-12-31 18:29 ` Tom Tromey [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-11 23:28 Tom Tromey
2008-01-12 1:57 ` Dan Nicolaescu
2008-01-12 1:28 ` Tom Tromey
2008-01-12 1:38 ` Tom Tromey
2008-01-12 8:45 ` Ulrich Mueller
2008-01-12 17:45 ` Tom Tromey
2008-01-14 2:01 ` Richard Stallman
2008-01-14 1:35 ` Tom Tromey
2008-01-14 17:26 ` Richard Stallman
2008-01-19 5:18 ` Tom Tromey
2008-01-20 6:14 ` Richard Stallman
2008-01-23 4:00 ` Michael Olson
2008-01-14 1:41 ` Tom Tromey
2008-01-14 1:03 ` Michael Olson
2008-01-14 1:01 ` Tom Tromey
2008-01-14 7:03 ` Jan Djärv
2008-01-15 6:01 ` Michael Olson
2008-01-16 1:10 ` Tom Tromey
2008-01-16 4:10 ` Michael Olson
2008-01-12 11:11 ` Richard Stallman
2008-01-12 11:25 ` David Kastrup
2008-01-12 11:27 ` Andreas Schwab
2008-01-12 11:46 ` David Kastrup
2008-01-12 14:10 ` Andreas Schwab
2008-01-12 14:19 ` David Kastrup
2008-01-12 17:33 ` Andreas Schwab
2008-01-14 2:00 ` Richard Stallman
2008-01-14 2:25 ` Stefan Monnier
2008-01-14 7:05 ` Jan Djärv
2008-01-12 13:52 ` Dan Nicolaescu
2008-01-12 14:13 ` Andreas Schwab
2008-01-12 14:26 ` Dan Nicolaescu
2008-01-12 17:36 ` Andreas Schwab
2008-01-12 18:59 ` Dan Nicolaescu
2008-01-12 14:33 ` David Kastrup
2008-01-12 17:45 ` Andreas Schwab
2008-01-12 18:07 ` David Kastrup
2008-01-12 18:16 ` Andreas Schwab
2008-01-14 2:01 ` Richard Stallman
2008-01-14 2:47 ` Dan Nicolaescu
2008-01-14 17:26 ` Richard Stallman
2008-01-14 9:14 ` David Kastrup
2008-01-14 17:26 ` Richard Stallman
2008-01-14 3:47 ` YAMAMOTO Mitsuharu
2008-01-14 3:49 ` Tom Tromey
2008-01-14 13:35 ` Stefan Monnier
2008-01-14 21:40 ` YAMAMOTO Mitsuharu
2008-01-16 1:17 ` Tom Tromey
2008-01-16 11:55 ` YAMAMOTO Mitsuharu
2008-01-14 17:26 ` Richard Stallman
2008-01-14 17:10 ` Tom Tromey
2008-01-16 2:42 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3y7bad8f4.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.