nix/modules/home-manager/eww/eww.yuck

95 lines
3.1 KiB
Plaintext
Raw Normal View History

2023-11-07 17:09:05 -06:00
(defwidget bar []
(centerbox :orientation "h"
(sidestuff)
(box)
(music)))
2023-11-07 23:55:16 -06:00
(defwindow bar0
2023-11-07 21:30:26 -06:00
:monitor 0
2023-11-07 17:09:05 -06:00
:stacking "fg"
:exclusive true
:geometry
(geometry
:x "0%"
:y "0%"
:width "100%"
2024-03-27 12:10:51 -05:00
:height "32px"
2023-11-07 17:09:05 -06:00
:anchor "bottom center")
(bar))
2023-11-07 23:55:16 -06:00
(defwindow bar1
:monitor 1
:stacking "fg"
:exclusive true
:geometry
(geometry
:x "0%"
:y "0%"
:width "100%"
2024-03-27 12:10:51 -05:00
:height "32px"
2023-11-07 23:55:16 -06:00
:anchor "bottom center")
(bar))
2023-11-07 17:09:05 -06:00
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20
time
2024-03-27 11:06:26 -05:00
; TODO: indicator/tray/taskbar/toolbar icons and management? (probably should use something standalone?)
; https://github.com/elkowar/eww/issues/111
2023-11-07 17:09:05 -06:00
; TODO: idle inhibitor?
2024-03-27 10:46:47 -05:00
; TODO: battery time remaining?
; TODO: hyprland workspaces?
; TODO: get these to align properly? icons seem lower than they should be?
2023-11-07 17:09:05 -06:00
(box :class "mic" (
box :class {micMuted == "false" ? "live" : "muted"} {micMuted == "false" ? " " : " "}
) {micVolume + "%"}
)
(box :class "vol" (
box :class {muted == "false" ? "live" : "muted"} {muted == "false" ? "󰕾 " : "󰖁 "}
) {volume + "%"}
)
{" " + round(EWW_CPU["avg"], 0) + "%"}
{" " + round(EWW_RAM["used_mem_perc"], 0) + "%"}
2024-03-27 12:10:51 -05:00
{showBrightness == "true" ? "" : " " + brightness + "%"}
{showBattery == "true" ? "" : "󱊣 " + EWW_BATTERY["BAT1"]["capacity"] + "%"}
2023-11-07 17:09:05 -06: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")
(deflisten volume :initial "0"
"pamixer --get-volume; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-volume; done")
(deflisten muted :initial "false"
"pamixer --get-mute; pactl subscribe | grep sink --line-buffered | while read i; do pamixer --get-mute; done")
(deflisten micVolume :initial "0"
"pamixer --default-source --get-volume; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-volume; done")
(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")
(defpoll time :interval "1s"
"date '+%a %b %d %H:%M:%S'")
2024-03-27 12:10:51 -05:00
(defpoll showBrightness :interval "24h"
; if we have at least one file in /sys/class/backlight, we should try and show brightness
"if [ \"$(find /sys/class/backlight -mindepth 1 -maxdepth 1 | head -n 1 | wc -l)\" == \"1\" ]; then echo true; else echo false; fi")
(defpoll showBattery :interval "24h"
; if we have at least one battery in /sys/class/power_supply, we should try and show battery levels
"if [ \"$(find /sys/class/power_supply* -mindepth 1 -maxdepth 1 | grep '^BAT' | head -n 1 | wc -l)\" == \"1\" ]; then echo true; else echo false; fi")
2023-11-07 17:09:05 -06:00
(defpoll brightness :interval "10s"
"echo $(((100 * $(brightnessctl get)) / $(brightnessctl max)))")
2023-11-07 23:55:16 -06:00
(defpoll monitor :interval "60s"
"echo $EWW_BAR_MON")