dotfiles/dotconfig/eww/bar_widget/bar.yuck
statzitz 4201b4f102 Changes in eww bar
Addings
- makes the sound volume/mic appears
- makes the correct light appears
- makes the batteries appears

Fix
- The tray widget menu now have a background.
2024-09-08 23:51:25 +02:00

123 lines
2.7 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"
(box
:class "sound_box"
(label :text "${volume_sound}  "))
(box
:class "mic_box"
(label :text "${volume_mic}%  "))
(box
:class "light_box"
(label :text "${light_value}% ☀ "))
(box
:class "battery_box"
(label :text "${batterie}%  "))
;(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_sound :interval "0.2s"
"pamixer --get-volume-human")
(defpoll volume_mic :interval "0.2s"
"get_source_volume")
(defpoll light_value :interval "1s"
"get_light_value")
(defpoll batterie :interval "1s"
"cat /sys/class/power_supply/BAT1/capacity")
(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))