b7c569c5f66b

Merge.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 16 Jul 2018 14:37:07 +0000
parents 6d2fdb8941e9 (diff) 1f7fd4683ec5 (current diff)
children 3f66d0d6e710 66679e85f03f
branches/tags (none)
files stumpwmrc

Changes

--- a/gitconfig	Sun Jul 15 15:38:15 2018 +0000
+++ b/gitconfig	Mon Jul 16 14:37:07 2018 +0000
@@ -5,7 +5,7 @@
 [core]
     pager = cat
     editor = nvim
-    excludesfile = /Users/sjl/.gitignore
+    excludesfile = /home/sjl/.gitignore
 
 [alias]
     tags = tag -l
--- a/stumpwmrc	Sun Jul 15 15:38:15 2018 +0000
+++ b/stumpwmrc	Mon Jul 16 14:37:07 2018 +0000
@@ -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"))
@@ -102,6 +101,19 @@
 ;;;; Load ---------------------------------------------------------------------
 (load-module "pass")
 
+;;;; 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)
@@ -242,7 +254,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"))
 
@@ -278,6 +290,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*