This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/os/linux/eww/eww.yuck
2023-05-11 10:32:36 -05:00

61 lines
1.5 KiB
Plaintext

(defwidget bar []
(centerbox :orientation "h"
(sidestuff)
(box)
(music)))
(defwindow bar
:monitor 2
:stacking "fg"
:exclusive true
:geometry
(geometry
:x "0%"
:y "0%"
:width "100%"
:height "31px"
:anchor "bottom center")
(bar))
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20
time
; TODO: idle inhibitor?
; TODO: get these to align properly?
(box :class "mic" (box :class {micMuted == "false" ? "muted" : "live"} {micMuted == "false" ? " " : " "}))
{"󰕾 " + volume}
{" " + cpu}
{" " + ram}
; TODO: brightness
; TODO: battery
))
(defwidget music []
(box :class "music"
:orientation "h"
:halign "end"
:space-evenly false
{music != "" ? "${music}" : ""}))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ title }} by {{ artist }}' || true")
; convert these to `deflisten`s as well because polling is very silly
(defpoll volume :interval "1s"
"pamixer --get-volume")
(defpoll micVolume :interval "10s"
"pamixer --default-source --get-volume")
(defpoll micMuted :interval "1s"
"pamixer --default-source --get-mute")
(defpoll cpu :interval "1s"
"mpstat -o JSON | jq -r '(100 - .sysstat.hosts[0].statistics[0][\"cpu-load\"][0].idle | round | tostring)+\"%\"'")
(defpoll ram :interval "1s"
"free | grep Mem | awk '{printf \"%.0f%\", $3/$2 * 100.0}'")
(defpoll time :interval "1s"
"date '+%a %b %d %H:%M:%S'")