dotfiles/dotconfig/eww/bar_widget/bar.yuck
2024-08-03 13:18:47 +02:00

102 lines
2.2 KiB
Text

(defwidget bar []
(centerbox :orientation "h"
(right_pane)
(music)
(left_pane)))
(defwidget right_pane []
(box :class "rpane"
:orientation "h"
:space-evenly false
(time_box)
(wifi_box)
(workspaces)
))
(defwidget time_box []
(box
:class "time_box"
(label :text " ${time}"
)))
(defwidget wifi_box []
(box
:class "wifi_box"
(label :text " ${wlan0}"
)))
(defwidget left_pane []
(box :class "left_pane" :orientation "h" :space-evenly false :halign "end"
(metric :label "🔊"
:value volume
:onchange "amixer -D pulse sset Master {}%")
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
(metric :label "💾"
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
(systray :class "tray" :orientation "h" :space-evenly true :icon-size "16")
))
(defwidget workspaces []
(box :class "workspaces"
:orientation "h"
:space-evenly false
:halign "start"
(literal :content workspace)
;(for i in workspace
; (button :class "btw" :onclick "hyprctl dispatch workspace ${i}" "${i}"))
))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? "🎵${music}" : ""}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
(defpoll volume :interval "1s"
"echo 50")
(defpoll time :interval "1s"
"date '+%I:%M:%S %p'")
(defpoll wlan0 :interval "1s"
"get_network")
(defpoll workspace :interval "0.5s"
"get_active_workspace")
(defwindow bar
:monitor 0
:geometry (geometry
:x "0%"
:y "0%"
:width "134%"
:height "30px"
:anchor "top center")
:stacking "bg"
:exclusive true
:focusable false
(bar))