Skip to content

Instantly share code, notes, and snippets.

@lxbarbosa lxbarbosa/exwm-status.el
Last active Sep 13, 2019

Embed
What would you like to do?
EXWM - Status Bar (echo-area) w/ icons
;; TODO: Proper all-the-icons usage
;; TODO: Modular stats
;; TODO: Emacs package?
;; TODO: Portable
(require 'all-the-icons)
(require 'subr-x)
(let ((bat
(concat
(string-trim
(shell-command-to-string
"cat /sys/class/power_supply/BAT0/capacity"))
"%"))
(cpu-temp
(concat (substring
(string-trim
(shell-command-to-string
"cat /sys/class/thermal/thermal_zone1/temp"))
0 -3)
"°C"))
(cpu-freq
(concat (number-to-string
(let ((a (split-string (shell-command-to-string
"grep 'cpu ' /proc/stat"))))
(/ (* (+ (string-to-number (nth 1 a))
(string-to-number (nth 3 a)))
100)
(+ (string-to-number (nth 1 a))
(string-to-number (nth 3 a))
(string-to-number (nth 4 a))))))
"%"))
(time
(format-time-string "%A %D - %l:%M %p" (current-time)))
(volume (let ((current-volume (shell-command-to-string "amixer get Master")))
(string-match "\\([0-9]+%\\)" current-volume)
(match-string 0 current-volume))))
(message "%s /  %s%s /  %s /  %s"
bat cpu-temp cpu-freq volume time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.