dotfiles/config/eww-ahrc--laptop/eww.yuck

122 lines
2.3 KiB
Text

(deflisten batterystatus
:initial "unknown"
"listen/battery BAT1"
)
(deflisten workspaces
:initial '{"current":1,"used":[1]}'
"listen/hypr workspace"
)
(deflisten windowtitle
:initial ''
"listen/hypr activewindow"
)
(deflisten submap
:initial ''
"listen/hypr submap"
)
(deflisten network
:initial '{"state":"disconnected","infos":{}}'
"listen/network"
)
(defvar battery-icon '{
"unknown": "",
"critical": "",
"low": "",
"medium": "",
"high": "",
"full": ""
}')
(defvar network-icon '{
"disconnected": "󰲛",
"ethernet": "󰈀",
"wifi-terrible": "󰤯",
"wifi-bad": "󰤟",
"wifi-mediocre": "󰤢",
"wifi-good": "󰤥",
"wifi-excellent": "󰤨",
"tethering": "󰕓"
}')
(defwidget workspaces []
(eventbox :onscroll "action/hyprland/nearby-workspace {}"
(box :class "workspaces"
(for workspace in {workspaces.used}
(eventbox
:class "workspace-button ${workspace == workspaces.current ? "workspace-current" : ""}"
:onclick "hyprctl dispatch workspace ${workspace}"
(box :width 25 "${workspace}")
)
)
)
)
)
(defwidget submap []
(eventbox :onclick "hyprctl dispatch submap reset"
(box :class "submap" "${submap}")
)
)
(defwidget window-title []
(box "${windowtitle ?: ''}")
)
(defwidget tray [] (box
(systray :icon-size 15 :spacing 10)
))
(defwidget time []
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
)
; (defwidget sound [] "")
(defwidget network []
"${network.state == "wireless" ? "${network-icon["wifi-${network.infos.signal}"]} ${network.infos.ssid}" : "${network-icon[network.state]}"}"
)
(defwidget battery []
"${battery-icon[batterystatus]}${EWW_BATTERY.BAT1.status == "Charging" ? " " : ""} ${EWW_BATTERY.BAT1.capacity} %"
)
(defwindow bar
:monitor 0
:geometry (geometry
:anchor "bottom center"
:width "100%"
:height 25
)
:exclusive true
(centerbox
(box
:halign "start"
:space-evenly false
:class "left"
(workspaces)
(submap)
(window-title)
)
(box
:space-evenly false
:class "middle"
(tray) (time)
)
(box
:halign "end"
:space-evenly false
:class "right"
; (sound)
(network)
(battery)
)
)
)