101 lines
3.7 KiB
Text
101 lines
3.7 KiB
Text
(defwidget bar []
|
|
(centerbox :orientation "h"
|
|
(sidestuff)
|
|
(box)
|
|
(music)))
|
|
|
|
(defwindow bar0
|
|
:monitor 0
|
|
:stacking "fg"
|
|
:exclusive true
|
|
:geometry
|
|
(geometry
|
|
:x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "32px"
|
|
:anchor "bottom center")
|
|
(bar))
|
|
|
|
(defwindow bar1
|
|
:monitor 1
|
|
:stacking "fg"
|
|
:exclusive true
|
|
:geometry
|
|
(geometry
|
|
:x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "32px"
|
|
:anchor "bottom center")
|
|
(bar))
|
|
|
|
(defwidget sidestuff []
|
|
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :valign "center" :spacing 10
|
|
time
|
|
; TODO: indicator/tray/taskbar/toolbar icons and management? (probably should use something standalone?)
|
|
; https://github.com/elkowar/eww/issues/111
|
|
|
|
; TODO: idle inhibitor?
|
|
; TODO: hyprland workspaces?
|
|
; TODO: get these to align properly? icons seem lower than they should be?
|
|
(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)}%"}
|
|
{(showBrightness == "true") ? (" ${brightness}%") : ""}
|
|
{(showBattery == "true") ? (" ${EWW_BATTERY["BAT1"]["capacity"]}% (${batteryTime})") : ""}
|
|
(box :orientation "h" :space-evenly false :halign "start" :valign "center" (workspaces))
|
|
))
|
|
|
|
(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")
|
|
|
|
; "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'")
|
|
|
|
; (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'")
|
|
|
|
(defpoll time :interval "1s"
|
|
"date '+%a %b %d %H:%M:%S'")
|
|
|
|
(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")
|
|
|
|
(defpoll brightness :interval "10s"
|
|
"echo $(((100 * $(brightnessctl get)) / $(brightnessctl max)))")
|
|
|
|
(deflisten batteryTime :initial "unknown" "scripts/battery-time.bash")
|
|
|
|
(deflisten workspace "scripts/hypr-workspaces.bash")
|
|
(defwidget workspaces [] (literal :content workspace))
|