swaybar/modules/SVG_Volume.qml.old (view raw)
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 |
// Volume.qml
import QtQuick
import Quickshell
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Quickshell.Services.Pipewire
import "../classes" as Class
import "../../"
Class.RightRowLayout {
spacing:2
PwObjectTracker {
objects: [ Pipewire.defaultAudioSink ]
}
property var muted: Pipewire.defaultAudioSink?.audio.muted
Class.TopbarText {
id: volume_indicator
property var vol: Math.round((Pipewire.defaultAudioSink?.audio.volume ?? 0) * 100)
text: (muted)
? ""
: vol + "%"
}
Class.TopbarSVG {
icon.source: muted
? "../../icons/phosphor/light/speaker-x-light.svg"
: (volume_indicator.vol == 0)
? "../../icons/phosphor/light/speaker-none-light.svg"
: (volume_indicator.vol <= 50)
? "../../icons/phosphor/light/speaker-low-light.svg"
: (volume_indicator.vol > 50)
? "../../icons/phosphor/light/speaker-high-light.svg"
: "../../icons/phosphor/light/speaker-low-light.svg"
icon.color: muted
? Style.scarlet
: Style.orange
icon.width: Resources.fontsize.topbar_text-1
icon.height: Resources.fontsize.topbar_text-1
}
Class.TopSep{}
}
|