4b486c5a8a54

Linux
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 09 Jul 2018 11:14:40 -0400
parents 0e3de710bb6c
children 74e54dee9e41
branches/tags (none)
files mutt/offlineimaplinux.py stumpwmrc

Changes

--- a/mutt/offlineimaplinux.py	Thu Jun 28 11:10:24 2018 -0400
+++ b/mutt/offlineimaplinux.py	Mon Jul 09 11:14:40 2018 -0400
@@ -2,8 +2,8 @@
 
 import subprocess
 
-def get_keychain_pass(account=None):
-    command = "pass-work '%s'" % account
-    output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
+def get_keychain_pass(account=None, command='pass'):
+    full_command = "%s '%s'" % (command, account)
+    output = subprocess.check_output(full_command, shell=True, stderr=subprocess.STDOUT)
     return output.splitlines()[0]
 
--- a/stumpwmrc	Thu Jun 28 11:10:24 2018 -0400
+++ b/stumpwmrc	Mon Jul 09 11:14:40 2018 -0400
@@ -34,6 +34,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)
@@ -61,7 +65,7 @@
     (apply #'format s args)))
 
 
-;;;; Regroup -------------------------------------------------------------------
+;;;; Regroup ------------------------------------------------------------------
 (defparameter *class-groups*
   '(("zoom" . "zoom")
     ("jetbrains-idea-ce" . "ij"))
@@ -84,6 +88,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)
@@ -217,7 +234,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"))
 
@@ -239,12 +256,12 @@
   "%a %b %e %k:%M"
   *screen-mode-line-format*
   (list "[^B%n^b] %W^>"
-        "(V "
-        ;; '(:eval (volume))
+        "(BR "
+        '(:eval (princ-to-string (brightness)))
         ")"
         " "
-        "(B "
-        '(:eval (battery))
+        "(BA "
+        '(:eval (princ-to-string (battery)))
         ")"
         " %d %T"))