From df3b1ca168e1b9396cde4acaa794fd2533e73092 Mon Sep 17 00:00:00 2001 From: Calamytryx <91600814+Calamytryx@users.noreply.github.com> Date: Fri, 10 Oct 2025 01:01:14 +0800 Subject: [PATCH] Add click-to-close functionality and streamline executable connections in DashboardRepresentation --- contents/ui/DashboardRepresentation.qml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/contents/ui/DashboardRepresentation.qml b/contents/ui/DashboardRepresentation.qml index b5c2d89..75ce1cd 100644 --- a/contents/ui/DashboardRepresentation.qml +++ b/contents/ui/DashboardRepresentation.qml @@ -50,8 +50,19 @@ Kicker.DashboardWindow { anchors.fill: parent + // --- Add this MouseArea for outside click-to-close --- + MouseArea { + anchors.fill: parent + z: 0 + acceptedButtons: Qt.LeftButton | Qt.RightButton + propagateComposedEvents: true + onClicked: root.toggle() + } + // --- End addition --- + Item { id: mainContainer + z: 1 // Make the container responsive to screen size width: Math.min(parent.width * 0.9, Kirigami.Units.gridUnit * 36) @@ -535,11 +546,10 @@ Kicker.DashboardWindow { MouseArea { id: lockMouseArea - anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: kicker.executable2.connectSource("loginctl lock-session") + onClicked: executable2.connectSource("loginctl lock-session") } } @@ -595,11 +605,10 @@ Kicker.DashboardWindow { MouseArea { id: logoutMouseArea - anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: kicker.executable2.connectSource("qdbus org.kde.ksmserver /KSMServer logout 0 0 0") + onClicked: Qt.openUrlExternally("qdbus org.kde.Shutdown /Shutdown logout") } } @@ -656,11 +665,10 @@ Kicker.DashboardWindow { MouseArea { id: rebootMouseArea - anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: kicker.executable2.connectSource("systemctl reboot") + onClicked: executable2.connectSource("systemctl reboot") } } @@ -717,11 +725,10 @@ Kicker.DashboardWindow { MouseArea { id: shutdownMouseArea - anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: kicker.executable2.connectSource("systemctl poweroff") + onClicked: executable2.connectSource("systemctl poweroff") } } } @@ -1101,4 +1108,4 @@ Kicker.DashboardWindow { } } } -} +} \ No newline at end of file