Add battery command to stumpwm config

This commit is contained in:
Jeremy Dormitzer 2020-01-02 20:20:22 -05:00
parent 3c3bc96c20
commit 5d61b4dd6c

View File

@ -19,6 +19,16 @@
"-n " "-n "
"--lock-icon ~/Pictures/lock.png"))) "--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 ;; Keybindings
(define-key stumpwm:*root-map* (kbd "C-f") "firefox") (define-key stumpwm:*root-map* (kbd "C-f") "firefox")
(define-key stumpwm:*root-map* (kbd "d") "exec rofi -show run") (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 "P") "exec passmenu")
(define-key stumpwm:*root-map* (kbd "N") "exec networkmanager_dmenu") (define-key stumpwm:*root-map* (kbd "N") "exec networkmanager_dmenu")
(define-key stumpwm:*root-map* (kbd "L") "lock") (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 "XF86MonBrightnessDown") "exec light -U 5")
(define-key *top-map* (kbd "XF86MonBrightnessUp") "exec light -A 5") (define-key *top-map* (kbd "XF86MonBrightnessUp") "exec light -A 5")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec pavolume volup") (define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec pavolume volup")