--- a/stumpwmrc Sat Jul 21 02:34:40 2018 +0000
+++ b/stumpwmrc Sat Jul 21 02:37:37 2018 +0000
@@ -6,7 +6,7 @@
;;;; Config -------------------------------------------------------------------
(set-prefix-key (kbd "C-space"))
-(redirect-all-output (data-dir-file "debug" "text"))
+;; (redirect-all-output (data-dir-file "debug" "text"))
(setf *mouse-focus-policy* :click
*message-window-gravity* :center
@@ -17,11 +17,6 @@
;;;; Utils --------------------------------------------------------------------
-(defun ensure-mode-line ()
- (when (not (stumpwm::head-mode-line (current-head)))
- (toggle-mode-line (current-screen) (current-head))))
-
-
(defun string-contains (needle string)
(and (search needle string :test #'char=) t))
@@ -38,6 +33,10 @@
(find ch bag :test #'char=))))
+(defun mod+ (n increment modulo)
+ (mod (+ n increment) modulo))
+
+
(defun volume ()
(-<> (run-shell-command "amixer sget Master" t)
(string-grep "Front Left:" <> :first-only t)
@@ -79,7 +78,7 @@
`(case *host* ,@clauses))
-;;;; Regroup -------------------------------------------------------------------
+;;;; Regroup ------------------------------------------------------------------
(defparameter *class-groups*
'(("zoom" . "zoom")
("jetbrains-idea-ce" . "ij"))
@@ -111,6 +110,19 @@
(run-shell-command "/home/sjl/src/dotfiles/bin/screenshot-screen"))
+;;;; Brightness ---------------------------------------------------------------
+(defparameter *brightness-values* #(0 1 25 50 75 100))
+(defparameter *brightness-index* 2)
+
+(defun brightness ()
+ (aref *brightness-values* *brightness-index*))
+
+(defcommand rotate-brightness () ()
+ (setf *brightness-index*
+ (mod+ *brightness-index* 1 (length *brightness-values*)))
+ (run-shell-command (format nil "xbacklight -set ~D" (brightness))))
+
+
;;;; Commands -----------------------------------------------------------------
(defcommand sane-hsplit () ()
(hsplit)
@@ -252,7 +264,7 @@
(define-top-keys ;; screen
("H-F5" "exec xbacklight -dec 10")
- ("H-F6" "exec xbacklight -inc 10")
+ ("H-F6" "rotate-brightness")
("H-F7" "screen-single")
("H-F8" "screen-multi"))
@@ -288,6 +300,10 @@
;;;; Modeline -----------------------------------------------------------------
+(defun ensure-mode-line ()
+ (when (not (stumpwm::head-mode-line (current-head)))
+ (toggle-mode-line (current-screen) (current-head))))
+
(defun configure-modeline ()
(setf
*time-modeline-string*