Files
DankMaterialShell/quickshell/Modules/Lock/Widgets/LockPowerWidget.qml
T

48 lines
1.4 KiB
QML

import QtQuick
import qs.Common
import qs.Widgets
import qs.DankCommon.Session
Item {
id: root
property var instanceData: null
property var lockHost: null
readonly property var cfg: instanceData?.config ?? ({})
readonly property string shape: cfg.shape ?? "round"
readonly property bool round: shape === "round"
readonly property bool resizable: false
readonly property real minWidth: implicitWidth
readonly property real minHeight: implicitHeight
implicitWidth: powerButton.width
implicitHeight: powerButton.height
DankMaterialShape {
anchors.fill: powerButton
visible: !root.round
shape: root.shape
color: Theme.secondaryContainer
scale: powerButton.pressed ? 0.9 : 1
Behavior on scale {
NumberAnimation {
duration: LockMetrics.shakeDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.expressiveFastSpatial
}
}
}
LockActionButton {
id: powerButton
Accessible.name: I18n.tr("Power Options")
iconName: "power_settings_new"
iconColor: Theme.onSecondaryContainer
backgroundColor: root.round ? Theme.secondaryContainer : "transparent"
radius: pressed ? Theme.cornerRadiusS : Theme.fullRadius(width, height)
buttonSize: Theme.buttonHeightM
onClicked: root.lockHost?.showPowerMenu()
}
}