;; Audio: output and mic levels, device pickers, per-app mixer. (defwindow audio :monitor 0 :geometry (geometry :x "-10px" :y "47px" :width "380px" :anchor "top right") :stacking "fg" :wm-ignore true :resizable false (box :class "panel" :orientation "v" :space-evenly false (head :title "Audio" (head-action :glyph "󰒓" :tip "Advanced mixer" :onclick "rice-panel close; setsid -f pavucontrol")) (slider-row :glyph {audio?.sink?.muted == true ? "󰝟" : "󰕾"} :value {audio?.sink?.vol ?: 0} :muted {audio?.sink?.muted ?: false} :onglyph "rice-volume mute" :onchange "rice-volume set {}") (slider-row :glyph {audio?.source?.muted == true ? "󰍭" : "󰍬"} :value {audio?.source?.vol ?: 0} :muted {audio?.source?.muted ?: false} :onglyph "rice-audio mic-mute" :onchange "rice-audio mic {}") ;; eww appends a loop's items after their siblings, so every loop gets its own box. (section :text "Output") (box :orientation "v" :space-evenly false (for s in {audio?.sinks ?: []} (row :glyph "󰓃" :title {s.desc} :active {s.default} :onclick "rice-audio sink ${s.index}"))) (section :text "Input") (box :orientation "v" :space-evenly false (for s in {audio?.sources ?: []} (row :glyph "󰍬" :title {s.desc} :active {s.default} :onclick "rice-audio source ${s.index}"))) (box :orientation "v" :space-evenly false :visible {arraylength(audio?.apps ?: []) > 0} (section :text "Apps") (box :orientation "v" :space-evenly false (for a in {audio?.apps ?: []} (box :class "row slider-row" :space-evenly false (button :class "glyph ${a.muted ? 'urgent' : ''}" :tooltip {a.name} :onclick "rice-audio app-mute ${a.id}" {a.muted ? "󰝟" : "󰎆"}) (label :class "row-title" :xalign 0 :width 90 :limit-width 11 :text {a.name}) (scale :class "slider" :hexpand true :min 0 :max 101 :value {a.vol} :onchange "rice-audio app-volume ${a.id} {}") (label :class "row-value slider-value" :xalign 1 :text "${a.vol}%")))))))