Files
quickshell/modules/bar/widgets/PowerButton.qml
T
2026-02-16 23:44:27 +01:00

49 lines
1.3 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import "../../../colors"
MouseArea {
id: powerButton
width: powerText.width + 16
height: bar.height
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
Rectangle {
anchors.fill: parent
color: powerButton.containsMouse ? Colors.secondaryContainer_fg : Qt.alpha(Colors.secondary, 0.5)
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 {
id: powerText
anchors.centerIn: parent
text: ""
font.pixelSize: 26
font.family: "Nerd Font"
color:powerButton.containsMouse ? Colors.secondaryContainer : Colors.secondary_fg
}
}
}