# HG changeset patch # User Steve Losh # Date 1531149280 14400 # Node ID 4b486c5a8a541d32101eaff5bf2c29c2d14e4450 # Parent 0e3de710bb6c91a12072c5cbb7fd8c814ad51c4d Linux diff -r 0e3de710bb6c -r 4b486c5a8a54 mutt/offlineimaplinux.py --- 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] diff -r 0e3de710bb6c -r 4b486c5a8a54 stumpwmrc --- 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"))