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")