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

61 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-05-09 20:19:26 -05:00
(defwidget bar []
(centerbox :orientation "h"
(sidestuff)
(box)
2023-05-11 10:32:36 -05:00
(music)))
(defwindow bar
:monitor 2
:stacking "fg"
:exclusive true
:geometry
(geometry
:x "0%"
:y "0%"
:width "100%"
:height "31px"
:anchor "bottom center")
(bar))
2023-05-09 20:19:26 -05:00
(defwidget sidestuff []
2023-05-11 10:32:36 -05:00
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20
2023-05-09 20:19:26 -05:00
time
2023-05-11 10:32:36 -05:00
; 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
))
2023-05-09 20:19:26 -05:00
(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")
2023-05-11 10:32:36 -05:00
; convert these to `deflisten`s as well because polling is very silly
2023-05-09 20:19:26 -05:00
(defpoll volume :interval "1s"
"pamixer --get-volume")
2023-05-11 10:32:36 -05:00
(defpoll micVolume :interval "10s"
"pamixer --default-source --get-volume")
2023-05-09 20:19:26 -05:00
2023-05-11 10:32:36 -05:00
(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'")