;; duckie.el --- soooo cuuuuuuute ;; Author: Mark Triggs ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;;; Code: (defun make-duckie (colour) (create-image (format "/* XPM */ static char * duckie_xpm[] = { \"30 18 2 1\", \" c None\", \". c %s\", \" ... \", \" ...... \", \" ....... \", \" ........... \", \" ........... \", \" ........... \", \" ......... \", \" ....... \", \" ...... \", \" . ....... \", \" ... ............ \", \" ................... \", \" .................... \", \" .................... \", \" .................... \", \" ................... \", \" ................. \", \" ............... \"};" colour) 'xpm t :ascent 'center)) (defvar *duckie* (make-duckie "#FFFFFF")) (defun duckie-show () (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-1] (lambda () (interactive) (start-process "duckie" nil "play" (expand-file-name "~/.elisp/homebrew/squeak.wav")) (setq *duckie* (make-duckie "#FFFF40")) (tooltip-show "Quack!") (run-at-time 0.5 nil (lambda () (setq *duckie* (make-duckie "#FFFFFF")) (force-mode-line-update))))) `(:propertize "!" display ,*duckie* keymap ,map))) (defvar *have-duckie* nil) (unless *have-duckie* (setq *have-duckie* t) (push '(:eval (duckie-show)) global-mode-string)) (provide 'duckie)