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

57 lines
1.6 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?
2023-05-11 14:07:39 -05:00
(box :class "mic" (box :class {micMuted == "false" ? "live" : "muted"} {micMuted == "false" ? " " : " "}))
2023-05-11 10:32:36 -05:00
{"󰕾 " + 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 14:07:39 -05:00
(deflisten volume :initial "0"
"pamixer --get-volume; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-volume; done")
2023-05-09 20:19:26 -05:00
2023-05-11 14:07:39 -05:00
(deflisten micMuted :initial "false"
"pamixer --default-source --get-mute; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-mute; done")
2023-05-09 20:19:26 -05:00
2023-05-11 14:07:39 -05:00
(defpoll cpu :interval "5s"
2023-05-11 10:32:36 -05:00
"mpstat -o JSON | jq -r '(100 - .sysstat.hosts[0].statistics[0][\"cpu-load\"][0].idle | round | tostring)+\"%\"'")
2023-05-11 14:07:39 -05:00
(defpoll ram :interval "5s"
2023-05-11 10:32:36 -05:00
"free | grep Mem | awk '{printf \"%.0f%\", $3/$2 * 100.0}'")
(defpoll time :interval "1s"
"date '+%a %b %d %H:%M:%S'")