import QtQuick import Quickshell import "." as M import "../services" as S import "../applets" as C import NovaStats as NS M.BarModule { id: root active: NS.ModulesService.volumeEnable spacing: NS.ThemeService.moduleSpacing tooltip: "Volume: " + Math.round(volume * 100) + "%" + (muted ? " (muted)" : "") panelNamespace: "nova-volume" panelContentWidth: 220 panelComponent: Component { C.VolumeApplet { width: parent.width accentColor: root.accentColor } } readonly property real volume: S.PipewireService.volume readonly property bool muted: S.PipewireService.muted readonly property string _volumeIcon: muted ? "\uF026" : (volume > 0.5 ? "\uF028" : (volume > 0 ? "\uF027" : "\uF026")) readonly property color _volumeColor: muted ? NS.ThemeService.base04 : root.accentColor property bool _volumeInit: false property bool _mutedInit: false onVolumeChanged: { if (!_volumeInit) { _volumeInit = true; return; } flashPanel(); } onMutedChanged: { if (!_mutedInit) { _mutedInit = true; return; } flashPanel(); } M.BarIcon { icon: root._volumeIcon minIcon: "\uF028" color: root._volumeColor anchors.verticalCenter: parent.verticalCenter } M.BarLabel { label: Math.round(root.volume * 100) + "%" minText: "100%" color: root._volumeColor anchors.verticalCenter: parent.verticalCenter } WheelHandler { onWheel: event => { if (!S.PipewireService.sink?.audio) return; S.PipewireService.sink.audio.volume = Math.max(0, S.PipewireService.sink.audio.volume + (event.angleDelta.y > 0 ? 0.05 : -0.05)); } } }