fix: compact view sizing and Plasma 5.27 compatibility

- Move QML components to contents/ui/ (Plasma 5 resolves siblings)
- Inline compact representation with MouseArea as container
- Set implicitWidth/Height to prevent panel overflow
- Use units.iconSizes.small for theme-consistent sizing
- Fix metadata.json: add ServiceTypes, FormFactors, X-Plasma-API
- Fix metadata.desktop: add X-KDE-FormFactors
- Remove CompactView.qml (inlined in main.qml)
- Remove components/ subdirectory (Plasma 5 import issues)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrés Eduardo García Márquez 2026-02-24 14:20:25 -05:00
parent 8d7cd3f65f
commit 46f5a86747
7 changed files with 38 additions and 44 deletions

View File

@ -1,30 +0,0 @@
import QtQuick 2.15
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "logic/CpuReader.js" as Reader
Row {
id: root
property int temperature: 0
signal clicked()
spacing: 4
PlasmaCore.IconItem {
source: "cpu"
width: 16; height: 16
anchors.verticalCenter: parent.verticalCenter
}
PlasmaComponents.Label {
text: root.temperature + "°C"
color: Reader.tempColor(root.temperature)
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: root.clicked()
}
}

View File

@ -1,6 +1,5 @@
import QtQuick 2.15
import org.kde.plasma.core 2.0 as PlasmaCore
import "components" as Components
Column {
id: root
@ -14,7 +13,7 @@ Column {
Item { width: 1; height: 4 }
Components.TemperatureDisplay {
TemperatureDisplay {
temperature: root.temperature
anchors.horizontalCenter: parent.horizontalCenter
}
@ -27,7 +26,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
}
Components.PerfLimiter {
PerfLimiter {
currentPerf: root.currentPerf
anchors.horizontalCenter: parent.horizontalCenter
onPerfChangeRequested: root.perfChangeRequested(newValue)

View File

@ -2,7 +2,7 @@ import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "../logic/CpuWriter.js" as Writer
import "logic/CpuWriter.js" as Writer
Column {
id: root

View File

@ -1,6 +1,6 @@
import QtQuick 2.15
import org.kde.plasma.components 2.0 as PlasmaComponents
import "../logic/CpuReader.js" as Reader
import "logic/CpuReader.js" as Reader
Column {
id: root

View File

@ -1,6 +1,7 @@
import QtQuick 2.15
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import "logic/CpuReader.js" as Reader
import "logic/CpuWriter.js" as Writer
@ -47,9 +48,29 @@ Item {
if (cmd) writeSource.connectSource(cmd)
}
Plasmoid.compactRepresentation: CompactView {
temperature: root.temperature
Plasmoid.compactRepresentation: MouseArea {
implicitWidth: compactRow.implicitWidth
implicitHeight: compactRow.implicitHeight
onClicked: plasmoid.expanded = !plasmoid.expanded
Row {
id: compactRow
spacing: 4
anchors.centerIn: parent
PlasmaCore.IconItem {
source: "cpu"
width: units.iconSizes.small
height: units.iconSizes.small
anchors.verticalCenter: parent.verticalCenter
}
PlasmaComponents.Label {
text: root.temperature + "°C"
color: Reader.tempColor(root.temperature)
anchors.verticalCenter: parent.verticalCenter
}
}
}
Plasmoid.fullRepresentation: FullView {

View File

@ -1,14 +1,15 @@
[Desktop Entry]
Name=CPU Control
Comment=Control CPU performance mode
Comment=Monitor CPU temperature and control performance limit
Icon=cpu
Type=Service
X-KDE-ServiceTypes=Plasma/Applet
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/main.qml
X-KDE-FormFactors=panel,desktop
X-KDE-PluginInfo-Name=org.kde.plasma.cpucontrol
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Author=Andres Garcia
X-KDE-PluginInfo-Email=andresgarcia0313@gmail.com
X-KDE-PluginInfo-Version=1.0.0
X-KDE-PluginInfo-Version=2.0.0
X-KDE-PluginInfo-License=MIT

View File

@ -2,7 +2,7 @@
"KPlugin": {
"Id": "org.kde.plasma.cpucontrol",
"Name": "CPU Control",
"Description": "Control CPU performance mode",
"Description": "Monitor CPU temperature and control performance limit",
"Icon": "cpu",
"Authors": [
{
@ -12,9 +12,12 @@
],
"Category": "System Information",
"License": "MIT",
"Version": "1.0.0",
"Website": "https://github.com/andresgarcia0313"
"Version": "2.0.0",
"Website": "https://github.com/andresgarcia0313",
"ServiceTypes": ["Plasma/Applet"],
"FormFactors": ["panel", "desktop"],
"EnabledByDefault": true
},
"KPackageStructure": "Plasma/Applet",
"X-Plasma-API-Minimum-Version": "6.0"
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml"
}