PageRenderTime 19ms CodeModel.GetById 1ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/mode-line/modeline-config.lisp~

http://github.com/joelagnel/stumpwm-goodies
Unknown | 71 lines | 59 code | 12 blank | 0 comment | 0 complexity | 4927c070487e46ac49f83bcdd3f411ee MD5 | raw file
 1(in-package :stumpwm)
 2
 3(load "/home/joel/repository/stumpwm-goodies/modeline-cpu.lisp")
 4;(load (concat *stumpwm-load-path* "notifications.lisp"))
 5
 6(setf *mode-line-screen-position* :bottom)
 7(setf *mode-line-frame-position* :bottom)
 8(setf *mode-line-border-width* 0)
 9(setf *mode-line-border-height* 0)
10(setf *mode-line-pad-x* 0)
11(setf *mode-line-pad-y* 1)
12(setf *mode-line-background-color* "black")
13(setf *mode-line-foreground-color* "blue")
14(setf *mode-line-timeout* 2)
15(setf *mode-line-border-color* "grey30")
16(setf *window-format* "<%n%s%m%30t>")
17
18(defun show-ip-address ()
19  (let ((ip (run-shell-command "ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'" t)))
20    (substitute #\Space #\Newline ip)))
21
22(defun show-battery-charge ()
23  (let ((raw-battery (run-shell-command "acpi | cut -d, -f2" t)))
24    (substitute #\Space #\Newline raw-battery)))
25
26(defun show-hostname ()
27  (let ((host-name (run-shell-command "cat /etc/hostname" t)))
28    (substitute #\Space #\Newline host-name)))
29
30(defun show-battery-state ()
31  (let ((raw-battery (run-shell-command "acpi | cut -d: -f2 | cut -d, -f1" t)))
32    (substitute #\Space #\Newline raw-battery)))
33
34(defun show-kernel ()
35  (let ((ip (run-shell-command "uname -r" t)))
36    (substitute #\Space #\Newline ip)))
37
38(defun show-emacs-jabber-new-message ()
39  (let ((new-message (run-shell-command "cat /home/joel/emacs-jabber.temp" t)))
40;;;     (and (> (length new-message) 0) (stumpwm:message new-message))
41    (substitute #\Space #\Newline new-message)))
42;;;
43
44(defun show-emacs-jabber-new-mail ()
45  (let ((new-mail (run-shell-command "cat /home/joel/emacs-jabber-mail.temp" t)))
46    (if (not (eq (length new-mail) 0))
47        (progn (stumpwm:message new-mail)
48               (run-shell-command "rm /home/joel/emacs-jabber-mail.temp" t)
49               (run-shell-command "touch /home/joel/emacs-jabber-mail.temp" t)))
50    ""))
51
52;; Switch mode-line on
53(toggle-mode-line (current-screen) (current-head))
54
55;; Called from slime
56(setf *JABBER-MODE-LINE* "")
57
58;; Set model-line format
59(setf *screen-mode-line-format*
60      (list
61;;;        "| CPU: "
62       ;;       '(:eval (current-cpu-usage))
63       '(:eval (show-hostname))
64       "| Battery:"
65       '(:eval (show-battery-charge))
66       '(:eval (show-battery-state))
67       "| IP " '(:eval (show-ip-address))
68       "| " '(:eval (run-shell-command "ruby -e \"print Time.now\"" t))))
69;;;        '(:eval (show-emacs-jabber-new-message))
70;;;        '(:eval (show-emacs-jabber-new-mail))
71;;; ))