Added PowerOff button with wlogout
This commit is contained in:
@@ -70,6 +70,7 @@ PanelWindow {
|
||||
spacing: 8
|
||||
|
||||
// TODO: Add bluetooth, network, audio, power, maybe HW monitor
|
||||
PowerButton {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
|
||||
MouseArea {
|
||||
id: archButton
|
||||
width: 30
|
||||
height: 28
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: archButton.containsMouse ? "#2a2a2a" : "transparent"
|
||||
radius: 6
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
Process {
|
||||
id: powerOff
|
||||
command: ["wlogout", "-b", "2"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
console.log("Running PowerOff Menu")
|
||||
powerOff.startDetached()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: ""
|
||||
font.pixelSize: 26
|
||||
font.family: "Nerd Font"
|
||||
color: "#ffffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user