Files
quickshell/modules/bar/widgets/PowerButton.qml
T

50 lines
1.4 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import "../../../colors"
import "../../../config"
MouseArea {
id: powerButton
width: Math.max(powerText.width + Config.spacing, bar.height)
height: bar.height
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
Rectangle {
anchors.fill: parent
color: powerButton.containsMouse ? Colors.secondaryContainer_fg : Qt.alpha(Colors.secondary, 0.75)
radius: Config.radius
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")
root.openWlogout()
}
}
}
Text {
id: powerText
anchors.centerIn: parent
text: ""
font.pixelSize: Config.big_font_size(bar.height)
font.family: Config.font
color:powerButton.containsMouse ? Colors.secondaryContainer : Colors.secondary_fg
}
}
}