barmodule: own hoverpanel internally, modules supply content as component

This commit is contained in:
Damocles 2026-04-25 14:07:26 +02:00
parent 26476dc930
commit 6fd36c812f
17 changed files with 367 additions and 453 deletions

View file

@ -9,6 +9,18 @@ M.BarModule {
id: root
spacing: S.Theme.moduleSpacing
tooltip: "Volume: " + Math.round(volume * 100) + "%" + (muted ? " (muted)" : "")
panelNamespace: "nova-volume"
panelTitle: "Sound"
panelContentWidth: 220
panelComponent: Component {
C.VolumeApplet {
width: parent.width
sink: root.sink
sinkList: root._sinkList
streamList: root._streamList
accentColor: root.accentColor
}
}
PwObjectTracker {
objects: [Pipewire.defaultAudioSink, ...root._streamList]
@ -78,24 +90,4 @@ M.BarModule {
root.sink.audio.volume = Math.max(0, root.sink.audio.volume + (event.angleDelta.y > 0 ? 0.05 : -0.05));
}
}
M.HoverPanel {
id: hoverPanel
showPanel: root._showPanel
screen: QsWindow.window?.screen ?? null
anchorItem: root
accentColor: root.accentColor
panelNamespace: "nova-volume"
panelTitle: "Sound"
contentWidth: 220
onDismissed: root.dismissPanel()
C.VolumeApplet {
width: hoverPanel.contentWidth
sink: root.sink
sinkList: root._sinkList
streamList: root._streamList
accentColor: root.accentColor
}
}
}