From c96856581d16f8375a99875bbed0e706e24b465a Mon Sep 17 00:00:00 2001 From: Damocles Date: Sat, 25 Apr 2026 22:44:23 +0200 Subject: [PATCH 1/2] move cpu core consumer tracking into applet, move mpris art caching into service --- shell/applets/CpuApplet.qml | 13 +++++++++++++ shell/dock/AppletDock.qml | 1 + shell/modules/CpuModule.qml | 12 ------------ shell/modules/MprisModule.qml | 21 +-------------------- shell/services/MprisService.qml | 12 ++++++++++++ 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/shell/applets/CpuApplet.qml b/shell/applets/CpuApplet.qml index 2068cce..70e43d9 100644 --- a/shell/applets/CpuApplet.qml +++ b/shell/applets/CpuApplet.qml @@ -12,6 +12,19 @@ Column { property bool active: true + property bool _coreActive: false + onActiveChanged: { + if (active && !_coreActive) { + _coreActive = true; + S.SystemStats.coreConsumers++; + } else if (!active && _coreActive) { + _coreActive = false; + S.SystemStats.coreConsumers--; + } + } + Component.onDestruction: if (_coreActive) + S.SystemStats.coreConsumers-- + // Per-core rows Repeater { model: root.cores.length diff --git a/shell/dock/AppletDock.qml b/shell/dock/AppletDock.qml index a9f2285..d1a788a 100644 --- a/shell/dock/AppletDock.qml +++ b/shell/dock/AppletDock.qml @@ -374,6 +374,7 @@ PanelWindow { players: S.MprisService.players playing: S.MprisService.playing accentColor: root._accent + cachedArt: S.MprisService.cachedArt playerIdx: S.MprisService.playerIdx onPlayerSwitched: idx => S.MprisService.switchPlayer(idx) } diff --git a/shell/modules/CpuModule.qml b/shell/modules/CpuModule.qml index 9b89514..dcc3099 100644 --- a/shell/modules/CpuModule.qml +++ b/shell/modules/CpuModule.qml @@ -27,18 +27,6 @@ M.BarModule { readonly property var _coreMaxFreq: S.SystemStats.cpuCoreMaxFreq readonly property var _coreTypes: S.SystemStats.cpuCoreTypes - property bool _coreConsumerActive: false - - on_ShowPanelChanged: { - if (_showPanel && !_coreConsumerActive) { - _coreConsumerActive = true; - S.SystemStats.coreConsumers++; - } else if (!_showPanel && _coreConsumerActive) { - _coreConsumerActive = false; - S.SystemStats.coreConsumers--; - } - } - property M.ProcessList _procs: M.ProcessList { sortBy: "cpu" active: root._showPanel diff --git a/shell/modules/MprisModule.qml b/shell/modules/MprisModule.qml index 7c9d60b..0ad0673 100644 --- a/shell/modules/MprisModule.qml +++ b/shell/modules/MprisModule.qml @@ -22,7 +22,7 @@ M.BarModule { players: root._players playing: root.playing accentColor: root.accentColor - cachedArt: root._cachedArt + cachedArt: S.MprisService.cachedArt cavaBars: root._cavaBars playerIdx: S.MprisService.playerIdx onPlayerSwitched: idx => { @@ -35,25 +35,6 @@ M.BarModule { readonly property var _players: S.MprisService.players readonly property MprisPlayer player: S.MprisService.player readonly property bool playing: S.MprisService.playing - property string _cachedArt: "" - property string _artTrack: "" - - readonly property string _artUrl: player?.trackArtUrl ?? "" - readonly property string _currentTrack: player?.trackTitle ?? "" - on_ArtUrlChanged: if (_artUrl) - _cachedArt = _artUrl - on_CurrentTrackChanged: if (_currentTrack !== _artTrack) { - _artTrack = _currentTrack; - _cachedArt = _artUrl || ""; - } - - // Preload art while panel is hidden - Image { - visible: false - source: root._cachedArt - asynchronous: true - } - // Cava visualizer - 16 bars, raw output mode property var _cavaBars: Array(16).fill(0) property bool _cavaActive: false diff --git a/shell/services/MprisService.qml b/shell/services/MprisService.qml index 5cb628f..d8533b5 100644 --- a/shell/services/MprisService.qml +++ b/shell/services/MprisService.qml @@ -118,6 +118,18 @@ QtObject { _selectedIdentity = players[chosen].identity ?? ""; } + // Album art caching - persists across panel/dock collapse + property string cachedArt: "" + property string _artTrack: "" + readonly property string _artUrl: player?.trackArtUrl ?? "" + readonly property string _currentTrack: player?.trackTitle ?? "" + on_ArtUrlChanged: if (_artUrl) + cachedArt = _artUrl + on_CurrentTrackChanged: if (_currentTrack !== _artTrack) { + _artTrack = _currentTrack; + cachedArt = _artUrl || ""; + } + function switchPlayer(idx) { playerIdx = idx; if (players[idx]) From 02910957f17aa4d86134e037ba4586b9975d5921 Mon Sep 17 00:00:00 2001 From: Damocles Date: Sat, 25 Apr 2026 22:52:28 +0200 Subject: [PATCH 2/2] move network/bluetooth refresh + active tracking into applets, fix dock parent.expanded --- shell/applets/BluetoothApplet.qml | 3 +++ shell/applets/NetworkApplet.qml | 3 +++ shell/dock/AppletDock.qml | 4 +++- shell/dock/DockCard.qml | 3 ++- shell/modules/BluetoothModule.qml | 3 --- shell/modules/NetworkModule.qml | 3 --- test/qmllint-baseline.txt | 1 - 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/shell/applets/BluetoothApplet.qml b/shell/applets/BluetoothApplet.qml index 89ff63b..bc6c4cc 100644 --- a/shell/applets/BluetoothApplet.qml +++ b/shell/applets/BluetoothApplet.qml @@ -5,6 +5,9 @@ Column { id: root required property color accentColor + property bool active: true + onActiveChanged: if (active) + S.BluetoothService.refresh() Repeater { model: S.BluetoothService.devices diff --git a/shell/applets/NetworkApplet.qml b/shell/applets/NetworkApplet.qml index 2344e7d..749d950 100644 --- a/shell/applets/NetworkApplet.qml +++ b/shell/applets/NetworkApplet.qml @@ -5,6 +5,9 @@ Column { id: root required property color accentColor + property bool active: true + onActiveChanged: if (active) + S.NetworkService.refresh() Repeater { model: S.NetworkService.networks diff --git a/shell/dock/AppletDock.qml b/shell/dock/AppletDock.qml index d1a788a..c38bbbb 100644 --- a/shell/dock/AppletDock.qml +++ b/shell/dock/AppletDock.qml @@ -251,7 +251,7 @@ PanelWindow { devices: S.SystemStats.tempDevices accentColor: root._accent deviceFilter: S.Modules.temperature.device || "" - active: parent.parent.expanded + active: parent.expanded } } @@ -296,6 +296,7 @@ PanelWindow { C.NetworkApplet { width: parent.width accentColor: root._accent + active: parent.expanded } } @@ -310,6 +311,7 @@ PanelWindow { C.BluetoothApplet { width: parent.width accentColor: root._accent + active: parent.expanded } } diff --git a/shell/dock/DockCard.qml b/shell/dock/DockCard.qml index 5a496b9..d946cd1 100644 --- a/shell/dock/DockCard.qml +++ b/shell/dock/DockCard.qml @@ -89,9 +89,10 @@ Rectangle { } } - // Content area + // Content area - expanded propagated so children can bind `active: parent.expanded` Column { id: _contentColumn + property bool expanded: root.expanded anchors.top: _header.bottom anchors.topMargin: 4 width: parent.width diff --git a/shell/modules/BluetoothModule.qml b/shell/modules/BluetoothModule.qml index 347a614..5d0ea98 100644 --- a/shell/modules/BluetoothModule.qml +++ b/shell/modules/BluetoothModule.qml @@ -54,9 +54,6 @@ M.BarModule { } } - on_ShowPanelChanged: if (_showPanel) - S.BluetoothService.refresh() - Connections { target: S.BluetoothService function onDevicesChanged() { diff --git a/shell/modules/NetworkModule.qml b/shell/modules/NetworkModule.qml index b434888..2aa9dac 100644 --- a/shell/modules/NetworkModule.qml +++ b/shell/modules/NetworkModule.qml @@ -56,9 +56,6 @@ M.BarModule { readonly property string state: S.NetworkService.state - on_ShowPanelChanged: if (_showPanel) - S.NetworkService.refresh() - Connections { target: S.NetworkService function onNetworksChanged() { diff --git a/test/qmllint-baseline.txt b/test/qmllint-baseline.txt index 83b42c3..708aa1d 100644 --- a/test/qmllint-baseline.txt +++ b/test/qmllint-baseline.txt @@ -18,7 +18,6 @@ shell/applets/PowerApplet.qml: Unqualified access [unqualified] shell/applets/TemperatureApplet.qml: Unqualified access [unqualified] shell/applets/VolumeApplet.qml: Unqualified access [unqualified] shell/dock/AppletDock.qml: Could not find property "top". [missing-property] -shell/dock/AppletDock.qml: Member "expanded" not found on type "QQuickItem" [missing-property] shell/dock/AppletDock.qml: Type margins is used but it is not resolved [unresolved-type] shell/dock/AppletDock.qml: Type PanelWindow is not creatable. [uncreatable-type] shell/dock/AppletDock.qml: unknown grouped property scope margins. [unqualified]