(defpoll sourcevol :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $2}'`)
(defpoll sourcemute :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $3}'`)
(defpoll sinkvol :interval "200ms" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $2}'`)
(defpoll sinkmute :interval "1s" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $3}'`)

(defwidget volume []
 (box
   :space-evenly false
   :spacing 3
   (eventbox
     :class "sourcevol${sourcemute == "[MUTED]" ? " muted" : ""}"
     :onclick "wpctl set-mute @DEFAULT_SOURCE@ toggle"
     (label :text "${sourcemute == "[MUTED]" ? "󰍭" : "󰍬"}  ${sourcevol}"))
   (eventbox  
     :class "sinkvol${sinkmute == "[MUTED]" ? " muted" : ""}"
     :onclick "wpctl set-mute @DEFAULT_SINK@ toggle"
     (label :text "${sinkmute == "[MUTED]" ? "󰟎" : "󰋋"}  ${sinkvol}"))))
