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

102 lines
3.7 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 []
2024-03-27 17:10:36 -05:00
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :valign "center" :spacing 10
2023-11-07 17:09:05 -06:00
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: 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" ? " " : " "}
2024-03-27 12:39:22 -05:00
) {"${micVolume}%"}
2023-11-07 17:09:05 -06:00
)
(box :class "vol" (
box :class {muted == "false" ? "live" : "muted"} {muted == "false" ? "󰕾 " : "󰖁 "}
2024-03-27 12:39:22 -05:00
) {"${volume}%"}
2023-11-07 17:09:05 -06:00
)
2024-03-27 12:39:22 -05:00
{" ${round(EWW_CPU["avg"], 0)}%"}
{" ${round(EWW_RAM["used_mem_perc"], 0)}%"}
2024-03-27 17:10:36 -05:00
{(showBrightness == "true") ? (" ${brightness}%") : ""}
{(showBattery == "true") ? ("󱊣 ${EWW_BATTERY["BAT1"]["capacity"]}% (${batteryTime})") : ""}
2024-03-27 13:06:50 -05:00
(box :orientation "h" :space-evenly false :halign "start" :valign "center" (workspaces))
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")
2024-03-28 10:47:17 -05:00
; "upower -d | rg '\\s*(time to empty|time to full):\\s*(\\d.*)\$' -r '\$2'; upower --monitor-detail | rg '\\s*(time to empty|time to full):\\s*(\\d.*)\$' -r '\$2'")
2024-03-27 12:39:22 -05:00
; (deflisten batteryTime :initial "unknown"
; "upower -d | rg '\s*time to empty:\s*(\d.*)\$' -r '\$1'; upower --monitor-detail | rg '\\s*time to empty:\\s*(\\d.*)\$' -r '\$1'")
2024-03-27 12:39:22 -05:00
2023-11-07 17:09:05 -06:00
(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 2>&1 | rg '\/sys\/class\/power_supply\/BAT' 2>&1 > /dev/null; 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)))")
2024-03-27 13:06:50 -05:00
2024-03-28 10:47:17 -05:00
(deflisten batteryTime :initial "unknown" "scripts/battery-time.bash")
2024-03-27 13:06:50 -05:00
(deflisten workspace "scripts/hypr-workspaces.bash")
(defwidget workspaces [] (literal :content workspace))