From 4207f91f5a3277d1edfee4f76306044cc85c0262 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 19 Aug 2026 19:10:57 +0200 Subject: [PATCH] fixes qs powermenu --- .../quickshell/own/modules/PowerMenuPopup.qml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .config/quickshell/own/modules/PowerMenuPopup.qml diff --git a/.config/quickshell/own/modules/PowerMenuPopup.qml b/.config/quickshell/own/modules/PowerMenuPopup.qml new file mode 100644 index 0000000..8ca9eab --- /dev/null +++ b/.config/quickshell/own/modules/PowerMenuPopup.qml @@ -0,0 +1,62 @@ +// PowerMenuPopup.qml - the popup that appears when you click the power button +import QtQuick +import QtQuick.Layouts +import Quickshell.Io +import ".." + +Popup { + popupName: "powerMenu" + + ColumnLayout { + spacing: 2 + + Repeater { + model: [ + { icon: "", label: "Suspend", cmd: ["systemctl", "suspend"]}, + { icon: "", label: "Hibernate", cmd: ["systemctl", "hibernate"]}, + { icon: "", label: "Logout", cmd: ["hyprctl", "dispatch", "hl.dsp.exec_cmd('hyprshutdown -t \"Logging out...\"')"]}, + { icon: "", label: "Reboot", cmd: ["hyprctl", "dispatch", "hl.dsp.exec_cmd('hyprshutdown -t \"Restarting...\" --post-cmd \"systemctl reboot\"')"]}, + { icon: "", label: "Shutdown", cmd: ["hyprctl", "dispatch", "hl.dsp.exec_cmd('hyprshutdown -t \"Shutting down...\" --post-cmd \"systemctl poweroff\"')"]}, + ] + + delegate: Rectangle { + required property var modelData + readonly property var cmd: modelData.cmd + + Layout.fillWidth: true + implicitWidth: row.implicitWidth + 24 + height: 28 + radius: Theme.radius + color: itemHover.containsMouse ? Theme.pillHover : "transparent" + Behavior on color { ColorAnimation { duration: 150 } } + + RowLayout { + id: row + anchors { left: parent.left; verticalCenter: parent.verticalCenter; leftMargin: 10 } + spacing: 8 + + Text { + text: modelData.icon + font { family: Theme.fontMono; pixelSize: Theme.fontSize } + color: Theme.pillText + } + Text { + text: modelData.label + font { family: Theme.fontSans; pixelSize: Theme.fontSize } + color: Theme.pillText + } + } + + MouseArea { + id: itemHover + anchors.fill: parent + hoverEnabled: true + onClicked: { + GlobalStates.popups.close() + Exec.run(modelData.cmd) + } + } + } + } + } +}