summaryrefslogtreecommitdiff
path: root/modules/bar/popouts/Audio.qml
blob: 28667ec0d440065208db657a6939282b89055eb3 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import qs.widgets
import qs.services
import qs.config
import QtQuick.Layouts
import Quickshell

ColumnLayout {
    id: root

    required property var wrapper

    spacing: Appearance.spacing.normal

    VerticalSlider {
        id: volumeSlider

        icon: {
            if (Audio.muted)
                return "no_sound";
            if (value >= 0.5)
                return "volume_up";
            if (value > 0)
                return "volume_down";
            return "volume_mute";
        }

        value: Audio.volume
        onMoved: Audio.setVolume(value)

        implicitWidth: Config.osd.sizes.sliderWidth
        implicitHeight: Config.osd.sizes.sliderHeight
    }

    StyledRect {
        id: pavuButton

        implicitWidth: implicitHeight
        implicitHeight: icon.implicitHeight + Appearance.padding.small * 2

        radius: Appearance.rounding.normal
        color: Colours.palette.m3surfaceContainer

        StateLayer {
            function onClicked(): void {
                root.wrapper.hasCurrent = false;
                Quickshell.execDetached(["pavucontrol"]);
            }
        }

        MaterialIcon {
            id: icon

            anchors.centerIn: parent
            text: "settings"
        }
    }
}