From 9bc45980f334ef777bddc4b5e5545e1b2472ddc7 Mon Sep 17 00:00:00 2001 From: enne2 Date: Mon, 2 Nov 2026 17:54:18 +0100 Subject: [PATCH] Plasmoide: apri la calibrazione dall'icona del vassoio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kirigami.Icon dentro una compactRepresentation personalizzata assorbe gli eventi del mouse (bug KDE 518024), quindi la MouseArea che apriva il popup non riceveva i clic. Il gesto è ora duplicato anche dentro l'icona. Clic sinistro sull'icona: apre la pagina di calibrazione a tutto schermo (fascia bianca + gain RGB e luminosità). Clic centrale: popup dei controlli. L'avvio della calibrazione è centralizzato in openCalibration(), riusato dal pulsante Calibra… del popup. --- .../org.enne2.ambilight/contents/ui/main.qml | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/package/org.enne2.ambilight/contents/ui/main.qml b/package/org.enne2.ambilight/contents/ui/main.qml index 7bc97ac..f6af975 100644 --- a/package/org.enne2.ambilight/contents/ui/main.qml +++ b/package/org.enne2.ambilight/contents/ui/main.qml @@ -50,6 +50,13 @@ PlasmoidItem { exec.connectSource(root.ctl + " " + args) } + function openCalibration() { + if (!root.st.daemon || root.calibrating) + return + root.calibrating = true + calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration)) + } + // ---- stato (polling) P5Support.DataSource { id: poll @@ -105,12 +112,19 @@ PlasmoidItem { Layout.preferredWidth: implicitWidth Layout.preferredHeight: implicitHeight + // Kirigami.Icon assorbe i clic se non ha un MouseArea proprio (bug KDE 518024), + // quindi il gesto è duplicato sia sul contenitore sia sull'icona. MouseArea { id: compactMouse anchors.fill: parent hoverEnabled: true - acceptedButtons: Qt.LeftButton - onClicked: root.expanded = !root.expanded + acceptedButtons: Qt.LeftButton | Qt.MiddleButton + onClicked: function(mouse) { + if (mouse.button === Qt.MiddleButton) + root.expanded = !root.expanded + else + root.openCalibration() + } onContainsMouseChanged: { if (containsMouse) root.refresh() @@ -121,6 +135,17 @@ PlasmoidItem { source: "video-television" active: compactMouse.containsMouse opacity: root.st.running ? 1.0 : 0.45 + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.MiddleButton + onClicked: function(mouse) { + if (mouse.button === Qt.MiddleButton) + root.expanded = !root.expanded + else + root.openCalibration() + } + } } } } @@ -264,10 +289,7 @@ PlasmoidItem { PC3.Button { text: i18n("Calibra…") enabled: root.st.daemon && !root.calibrating - onClicked: { - root.calibrating = true - calibrationSource.connectSource("/usr/bin/python3 " + JSON.stringify(root.calibration)) - } + onClicked: root.openCalibration() } PC3.Button { text: i18n("Riavvia demone")