This repository has been archived on 2026-07-13. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
nova-shell/modules/Volume.qml
2026-04-12 00:38:50 +02:00

29 lines
786 B
QML

import QtQuick
import Quickshell.Services.Pipewire
import "." as M
Row {
id: root
spacing: 4
PwObjectTracker {
objects: [Pipewire.defaultAudioSink]
}
readonly property var sink: Pipewire.defaultAudioSink
readonly property real volume: sink?.audio?.volume ?? 0
readonly property bool muted: sink?.audio?.muted ?? false
M.BarIcon {
icon: root.muted ? "\uF026" : (root.volume > 0.5 ? "\uF028" : (root.volume > 0 ? "\uF027" : "\uF026"))
anchors.verticalCenter: parent.verticalCenter
}
M.BarLabel {
label: Math.round(root.volume * 100) + "%"
anchors.verticalCenter: parent.verticalCenter
}
TapHandler {
onTapped: if (root.sink?.audio) root.sink.audio.muted = !root.sink.audio.muted
}
}