From 5d61b4dd6c269074f280df262ef7363efbfa84ce Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 2 Jan 2020 20:20:22 -0500 Subject: [PATCH] Add battery command to stumpwm config --- stumpwm/.stumpwm.d/init.lisp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stumpwm/.stumpwm.d/init.lisp b/stumpwm/.stumpwm.d/init.lisp index 960f71e..d023270 100644 --- a/stumpwm/.stumpwm.d/init.lisp +++ b/stumpwm/.stumpwm.d/init.lisp @@ -19,6 +19,16 @@ "-n " "--lock-icon ~/Pictures/lock.png"))) +(defcommand battery () () + (let ((capacity + (string-trim + '(#\newline) + (run-shell-command + "cat /sys/class/power_supply/BAT0/capacity" + t)))) + (echo-string (current-screen) + (format nil "Battery: ~A%" capacity)))) + ;; Keybindings (define-key stumpwm:*root-map* (kbd "C-f") "firefox") (define-key stumpwm:*root-map* (kbd "d") "exec rofi -show run") @@ -26,6 +36,7 @@ (define-key stumpwm:*root-map* (kbd "P") "exec passmenu") (define-key stumpwm:*root-map* (kbd "N") "exec networkmanager_dmenu") (define-key stumpwm:*root-map* (kbd "L") "lock") +(define-key stumpwm:*root-map* (kbd "b") "battery") (define-key *top-map* (kbd "XF86MonBrightnessDown") "exec light -U 5") (define-key *top-map* (kbd "XF86MonBrightnessUp") "exec light -A 5") (define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec pavolume volup")