minor fixes and icons

This commit is contained in:
lucy 2026-05-14 20:35:11 +02:00
commit cf4696fe04
10 changed files with 82 additions and 11 deletions

View file

@ -1,8 +1,10 @@
import Quickshell.Services.Pipewire
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import qs
import qs.widgets
import qs.settings
WrapperRectangle {
id: root
@ -10,16 +12,39 @@ WrapperRectangle {
required property int barHeight
property double vertMargin: barHeight / 4 - 4
property PwNode defaultAudio: Pipewire.ready ? Pipewire.preferredDefaultAudioSink : null
property string status: defaultAudio?.audio.muted ? "mut " : "vol "
property bool mute: Pipewire.ready ? defaultAudio?.audio.muted : null
radius: Config.rounding
topMargin: vertMargin
bottomMargin: vertMargin
leftMargin: 8
rightMargin: 8
function getVolumeIcon() {
let volume = Pipewire.ready ? root.defaultAudio.audio.volume : null;
if (root.mute) {
return "\ue04f";
}
if (volume <= 0.33) {
return "\ue04e";
}
if (volume <= 0.66) {
return "\ue04d";
}
if (volume >= 0.66) {
return "\ue050";
}
}
PwObjectTracker {
objects: [Pipewire.ready ? Pipewire.defaultAudioSink : null]
}
child: StyledText {
text: root.status + Math.floor(root.defaultAudio?.audio.volume * 100) + "%"
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
child: RowLayout {
spacing: 4
MaterialIcon {
text: root.getVolumeIcon()
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
}
StyledText {
text: Math.floor(root.defaultAudio?.audio.volume * 100) + "%"
opacity: root.defaultAudio?.audio.muted ? 0.6 : 1.0
}
}
}