1 ;; jabber-wmii.el - emacs-jabber interface to wmii -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2007 - Detlev Zundel - dzu@gnu.org
5 ;; This file is a part of jabber.el.
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program; if not, write to the Free Software
19 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 (eval-when-compile (require 'jabber-alert))
23 (defvar jabber-wmii-color "#ffffff #335577 #447799"
24 "Color specification as needed by the wmii window manager for the jabber alert messages.")
26 (defvar jabber-wmii-reset-time "20 sec"
27 "If non-nil time to reset wmii message. If nil the message has to be cleared by other means, i.e. from wmiirc.")
29 (defvar jabber-wmii-timer nil
30 "Timer to clear wmii message.")
32 (defun jabber-wmii-clear ()
33 "Clear any previous message output through wmii window manager."
35 (call-process "wmiir" nil nil nil "remove" "/rbar/jabber")
38 (defun jabber-wmii-message (text &optional title)
40 (when jabber-wmii-timer
41 (cancel-timer jabber-wmii-timer))
42 (let ((tmp (make-temp-file temporary-file-directory)))
44 (insert jabber-wmii-color " " (or title text)))
45 ;; Possible errors include not finding the wmiir binary, and
46 ;; too many pipes open because of message flood.
48 (call-process "wmiir" tmp nil nil "create" "/rbar/jabber")
51 (when jabber-wmii-reset-time
52 (setq jabber-wmii-timer
53 (run-at-time jabber-wmii-reset-time nil 'jabber-wmii-clear))))
55 (define-jabber-alert wmii "Show a message through the wmii window manager."
58 (provide 'jabber-wmii)