[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs for IM: Notification
From: |
Tassilo Horn |
Subject: |
Re: Emacs for IM: Notification |
Date: |
Thu, 03 Apr 2008 10:37:14 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) |
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