summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-12-04 18:21:53 +0100
committerGravatar Tom Willemsen2012-12-04 18:21:53 +0100
commit14c4a15682df9af4f06571d843821e1664e87ce6 (patch)
treead716fbe530cfd4753e428ba65e289ad29cccddf
parent77c8d5e8650e4c22738c1b1cb92edb384a02df75 (diff)
downloaddotfiles-14c4a15682df9af4f06571d843821e1664e87ce6.tar.gz
dotfiles-14c4a15682df9af4f06571d843821e1664e87ce6.zip
.emacs.d/site-lisp/dzen.el
-rw-r--r--.emacs.d/site-lisp/dzen.el61
1 files changed, 61 insertions, 0 deletions
diff --git a/.emacs.d/site-lisp/dzen.el b/.emacs.d/site-lisp/dzen.el
new file mode 100644
index 0000000..a28418b
--- /dev/null
+++ b/.emacs.d/site-lisp/dzen.el
@@ -0,0 +1,61 @@
+;;; dzen.el --- Control DZEN2 from emacs
+
+;; Copyright (C) 2012 Tom Willemsen
+
+;; Author: Tom Willemsen <slash@drd>
+;; Keywords: convenience
+
+;; This program 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 3 of the License, or
+;; (at your option) any later version.
+
+;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'newst-backend)
+(require 'sawfish)
+
+(defun get-mail-count (account)
+ (length (directory-files (concat "/home/slash/documents/mail/"
+ account "/inbox/new") nil "^[^.]")))
+
+(defun dzen-start ()
+ (interactive)
+ (let ((proc (start-process "dzen2" "*dzen2*" "dzen2"
+ "-w" "1920"
+ "-fn" "Monaco-12"
+ "-bg" "#222224"
+ "-fg" "#eeeeec"))
+ (strl (format
+ "%s"
+ (sawfish-eval-expression '(window-name (input-focus)))))
+ (strr (format
+ "jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n"
+ (oni:current-jabber-status)
+ (get-mail-count "ryuslash.org")
+ (get-mail-count "gmail")
+ (get-mail-count "aethon")
+ (get-mail-count "ninthfloor")
+ (newsticker--stat-num-items-total 'new))))
+ (process-send-string
+ proc (format "^p(_LEFT)%s^p(_RIGHT)^p(-%d)%s"
+ strl (+ 9 (* 9 (length strr))) strr))))
+
+(defun dzen-stop ()
+ (interactive)
+ (kill-process "dzen2"))
+
+(provide 'dzen)
+;;; dzen.el ends here