stumpwm.stumpwm-contrib/minor-mode/notifications
2018-03-15 22:34:26 -04:00
..
notifications.asd Added meaningful descriptions to all non-documented modules 2018-03-15 22:34:26 -04:00
notifications.lisp Use ADD-SCREEN-MODE-LINE-FORMATTER 2016-09-29 15:16:15 -05:00
package.lisp Export *NOTIFICATIONS-MAP* from notifications 2014-07-26 14:56:43 +02:00
README.org Updated readme 2014-03-16 14:51:42 -04:00

Usage

This StumpWM module acts as notification monitor for external applications. They can send messages via `stumpish' which will be displayed in the mode-line. (Thus `stumpish' has to be in your PATH.)

To use it add this to your ~/.stumpwmrc.lisp:

(load-module "notifications")

Then add the formatter %N to your mode-line spec, i.e. like this:

   (setf *screen-mode-line-format* "[%W] {%g} (%N)")

You might want to bind notifications-map to a key:

   (define-key *root-map* (kbd "N") '*notifications-map*)

With this map you can add notifications with a, reset them with r, delete the first/last with d/D or show them in a popup with s.

External applications can add notification messages using stumpish:

   $ stumpish notifications-add 'Foo Bar Baz'

For example this is the elisp code that I use to let rcirc (an Emacs IRC client) notify me when a message with my nickname or a IM message arrives:

 (defun th-rcirc-notification (process sender response target text)
   (let ((my-nick (rcirc-nick process)))
     (when (and (string= response "PRIVMSG")
                (not (string= sender my-nick))
                (or
                 ;; BitlBee IM messages
                 (string-match "localhost" (format "%s" process))
                 ;; Messages that mention my name
                 (string-match my-nick text)))
       (th-notifications-add (concat "rcirc: " target)))))

 (add-hook 'rcirc-print-hooks 'th-rcirc-notification)

 (defun th-notifications-add (str)
   (interactive "sNotification: ")
   (start-process "notifications-add" nil
                  "stumpish" "notifications-add" str))