visual.lisp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ;;; visual.lisp --- Visual appearance: colors, fonts, mode line, resizing, ...
  2. ;; Copyright © 2013-2016 Alex Kost <alezost@gmail.com>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;;
  8. ;; This program is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;;
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Code:
  16. (in-package :stumpwm)
  17. ;;; Colors
  18. ;; Yellow and magenta are swapped to show keys in yellow.
  19. (setf *colors*
  20. '("black" "red" "green" "magenta" "blue" "yellow" "cyan" "white"))
  21. (update-color-map (current-screen))
  22. (defmacro al/set-color (val color)
  23. "Similar to `set-any-color', but without updating colors."
  24. `(dolist (s *screen-list*)
  25. (setf (,val s) (alloc-color s ,color))))
  26. (al/set-color screen-fg-color (hex-to-xlib-color "#e5e8ef"))
  27. (al/set-color screen-bg-color "gray15")
  28. (al/set-color screen-focus-color "DeepSkyBlue")
  29. (al/set-color screen-border-color "ForestGreen")
  30. (al/set-color screen-float-focus-color "DeepSkyBlue")
  31. (al/set-color screen-float-unfocus-color "gray15")
  32. (update-colors-all-screens)
  33. ;;; Grabbed pointer
  34. (setq
  35. *grab-pointer-character* 40
  36. *grab-pointer-character-mask* 41
  37. *grab-pointer-foreground* (hex-to-xlib-color "#3db270")
  38. *grab-pointer-background* (hex-to-xlib-color "#2c53ca"))
  39. ;;; Visual appearance and the mode-line
  40. (load-module "cpu")
  41. (load-module "net")
  42. (load-module "battery-portable")
  43. (defvar al/battery-mode-string "")
  44. (when (probe-file "/sys/class/power_supply/BAT0")
  45. (setf al/battery-mode-string " ^7*%B"
  46. battery-portable:*refresh-time* 30))
  47. (set-normal-gravity :bottom)
  48. (setf
  49. *message-window-gravity* :bottom-right
  50. *input-window-gravity* :center
  51. *window-info-format*
  52. (format nil "^>^B^5*%c ^b^6*%w^7*x^6*%h^7*~%%t")
  53. *time-format-string-default*
  54. (format nil "^5*%H:%M:%S~%^2*%A~%^7*%d %B")
  55. *mode-line-timeout* 5
  56. *screen-mode-line-format*
  57. '("^5*" (:eval (time-format "%k:%M"))
  58. " ^2*%n" ; group name
  59. " ^7*%c" ; cpu
  60. " ^6*%l" ; net
  61. al/battery-mode-string)
  62. *mouse-focus-policy* :click)
  63. (al/mode-line-on)
  64. ;; (set-font "-*-dejavu sans mono-medium-r-normal-*-*-115-*-*-*-*-*-1")
  65. (set-font "9x15bold")
  66. ;;; Message after a part of key sequence
  67. ;; Idea from <https://github.com/stumpwm/stumpwm/wiki/FAQ>.
  68. (defun key-seq-msg (key key-seq cmd)
  69. "Show a message with current incomplete key sequence."
  70. (declare (ignore key))
  71. (or (eq *top-map* *resize-map*)
  72. (stringp cmd)
  73. (let ((*message-window-gravity* :bottom-left))
  74. (message "~A" (print-key-seq (reverse key-seq))))))
  75. (add-hook *key-press-hook* 'key-seq-msg)
  76. ;;; visual.lisp ends here