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