[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] Different task bar icons?

From: Simon Green
Subject: Re: [h-e-w] Different task bar icons?
Date: Thu, 5 Dec 2002 16:22:24 +0000

>>>>> "TJ" == Thomas Johnsson <address@hidden> writes:

 TJ> I often find myself having a large number of icons on the taskbar, many of 
 TJ> are emacs frames, of which one is the VM frame I'm looking for...

 TJ> Is it possible to have different taskbar icons for different emacs frames?

Hi Thomas,

I use the following function to change the icon associated with a frame, having
previously set up skg-icon-directory to point to somewhere containing my icons.

(defvar skg-icon-directory "c:\\some\\directory\\with\\icons\\")

(defun skg-set-frame-icon (icon &optional frame)
         (or frame (selected-frame))
         (list (cons 'icon-type (concat skg-icon-directory icon)))))

 TJ> Especially, I'd like feature for the VM frame. Even better would be if the
 TJ> icon could be different depending on whether I have unread mail or not.

I do this by knowing what frame vm is running in: (skg-vm-frame) returns the
frame if it's there already, else creates it (for first time call, or frame

(defvar skg-vm-frame-var nil)

(defun skg-vm-frame ()
  (if (not (and skg-vm-frame-var (frame-live-p skg-vm-frame-var)))
        (setq skg-vm-frame-var (make-frame-command))
        (skg-set-frame-icon "mail21a.ico" skg-vm-frame-var)))

Where mail21a.ico happens to be a mailbox icon (from visual studio iirc) with a
lowered flag.

vm gets started something like this in my startup to make sure it's in the
right frame.  Doubtless there are some vm specific frame creation parameters
that may interefere with this, depending how you have vm set up YMMV:

          (select-frame (skg-vm-frame))

To change the icon when mail is waiting:

(add-hook 'vm-spooled-mail-waiting-hook 'skg-new-mail-hookfn)
(add-hook 'vm-arrived-messages-hook 'skg-got-new-mail-hookfn)

(defvar skg-mail-pending nil)
(defun skg-new-mail-hookfn ()
        (setq skg-mail-pending t)
        (skg-set-frame-icon "mail21b.ico" (skg-vm-frame))

(defun skg-got-new-mail-hookfn ()
        (setq skg-mail-pending nil)
        (skg-set-frame-icon "mail21a.ico" (skg-vm-frame))

(setq display-time-string-forms
                        '((format-time-string "%-I:%M%p" now)
                                (if skg-mail-pending " Mail" "")))

This only works because I _don't_ use vm-auto-get-new-mail, so when I manually
fetch mail (which causes vm-arrived-messages-hook to be run) I deem it save to
swap the mailbox icon.

Hope some of that helps,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]