aboutsummaryrefslogtreecommitdiff
path: root/roles/home/desktop/eww/panels/volume.yuck
blob: 0c342c3518a0134ffb2dfccbb725ccce370b038c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(defwidget volume []
    (box :class "volume panel"
        :orientation "v"
        :space-evenly false

        (label :markup "<b>Volume</b>")
    
        (box
            :orientation "h"
            :vexpand true
    
            (box
                :orientation "v"
                :space-evenly false
                :vexpand true

                (scale
                    :orientation "v"
                    :flipped true
                    :value {sink-volume}
                    :max 101
                    :onchange `pactl set-sink-volume @DEFAULT_SINK@ {}%`
                    :vexpand true
                )

                {sink-volume + "%"}
            )
        )
    )
)

(defpoll sink-volume
    :interval "0.2s"
    `pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | awk '{print substr($5, 1, length($5)-1)}'`
)

;(defpoll source-volume
;    :interval "0.2s"
;    `pactl get-source-volume @DEFAULT_SOURCE@ | head -n1 | awk '{print substr($5, 1, length($5)-1)}'`
;)