fixes qs powermenu
This commit is contained in:
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user