unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs for IM: Notification
Date: Thu, 03 Apr 2008 10:37:14 +0200	[thread overview]
Message-ID: <87myob49mt.fsf@member.fsf.org> (raw)
In-Reply-To: d5b69102-3f6e-4974-8aa0-07c3a407300a@s19g2000prg.googlegroups.com

briwood <deweysquare@gmail.com> writes:

Hi!

> I'm trying yod.el to chat via Yahoo.  I'm on GNU Emacs for windows
> 22.1.1.
>
> I would like to find a way to bring the emacs window to the front when
> someone initiates a chat with me.  Is there any way to get emacs to
> interact with either the windows (vista) os or some third party
> software that could notify me of events like this?

I use rcirc (combined with bitlbee) for IRC and IM chat.  I use this
function to get notifications if my nick was mentioned in a channel or I
got a private message.

--8<---------------cut here---------------start------------->8---
(defun th-rcirc-notification (process sender response target text)
  (let ((my-nick (rcirc-nick process))
        (wm (getenv "WINDOW_MANAGER")))
    (when (and (string= response "PRIVMSG")
               (not (string= sender my-nick))
               (or
                ;; BitlBee messages
                (string-match "localhost" (format "%s" process))
                ;; Messages that mention my name
                (string-match my-nick text)))
      (cond
       ;; StumpWM
       ((string= wm "stumpwm")
        (th-notifications-add (concat "rcirc: " target)))
       ;; Other (use libnotifies notify-send)
       (t (start-process "rcirc-notify-send" nil "notify-send" "-t" "172800000"
                         (concat "(rcirc) " target ": " text)))))))

(add-hook 'rcirc-print-hooks 'th-rcirc-notification)
--8<---------------cut here---------------end--------------->8---

Depending on the current window manager the notifications differ.  For
any WM except stumpwm I use libnotify's notify-send command which pops
up a simple message with the text I received.

HTH,
Tassilo





  reply	other threads:[~2008-04-03  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 18:15 Emacs for IM: Notification briwood
2008-04-03  8:37 ` Tassilo Horn [this message]
2008-04-03 13:26 ` Jason Rumney
2008-04-15 19:09   ` briwood

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87myob49mt.fsf@member.fsf.org \
    --to=tassilo@member.fsf.org \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).