Skip to content

Instantly share code, notes, and snippets.

@easbarba
Last active September 13, 2019 05:43
Show Gist options
  • Save easbarba/c1bbbadd2acb024fffb37a5f97d8cf84 to your computer and use it in GitHub Desktop.
Save easbarba/c1bbbadd2acb024fffb37a5f97d8cf84 to your computer and use it in GitHub Desktop.
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