new_dots/configuration/modules/dots/quick_shell/config/PowerPopup.qml
2026-03-13 17:56:47 +01:00

86 lines
2.2 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import QtQuick
import QtQuick.Controls
PanelWindow {
id: powerPopup
required property bool expanderOpen
required property color bgColor
required property color recColor
required property int recRadius
required property int barWidth
anchors.left: true
anchors.bottom: true
implicitWidth: (expanderOpen || popupAnim.running) ? 140 : 0
implicitHeight: (expanderOpen || popupAnim.running) ? 100 : 0
color: "transparent"
Rectangle {
id: popupRectangle
y: parent.height - height
x: powerPopup.expanderOpen ? 0 : -(width + powerPopup.barWidth)
width: 140
height: 100
color: powerPopup.bgColor
Behavior on x {
NumberAnimation {
id: popupAnim
duration: 400
easing.type: Easing.OutCubic
}
}
Row {
anchors.centerIn: popupRectangle
spacing: 10
Rectangle {
color: powerPopup.recColor
width: 50
height: 50
radius: powerPopup.recRadius * 2
Button {
anchors.fill: parent
opacity: 0
onClicked: Quickshell.execDetached(["poweroff"])
}
Image {
anchors.centerIn: parent
source: "file://" + Quickshell.shellDir + "/assets/power.svg"
sourceSize.width: 28
sourceSize.height: 28
}
}
Rectangle {
color: powerPopup.recColor
width: 50
height: 50
radius: powerPopup.recRadius * 2
Button {
anchors.fill: parent
opacity: 0
onClicked: Quickshell.execDetached(["reboot"])
}
Image {
anchors.centerIn: parent
source: "file://" + Quickshell.shellDir + "/assets/reboot.svg"
sourceSize.width: 28
sourceSize.height: 28
}
}
}
}
}