diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 17:45:26 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-25 17:45:26 +1000 |
| commit | 7a27d4126f06bc92041bd909929ebcdebb4a6cee (patch) | |
| tree | 2ec1b086af0a28061349e59212cf1558b1b5b79e /modules/lock/Buttons.qml | |
| parent | lock: fix media position (diff) | |
| download | caelestia-shell-7a27d4126f06bc92041bd909929ebcdebb4a6cee.tar.gz caelestia-shell-7a27d4126f06bc92041bd909929ebcdebb4a6cee.tar.bz2 caelestia-shell-7a27d4126f06bc92041bd909929ebcdebb4a6cee.zip | |
lock: add session buttons
Diffstat (limited to 'modules/lock/Buttons.qml')
| -rw-r--r-- | modules/lock/Buttons.qml | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/modules/lock/Buttons.qml b/modules/lock/Buttons.qml new file mode 100644 index 0000000..ef7af37 --- /dev/null +++ b/modules/lock/Buttons.qml @@ -0,0 +1,111 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell.Widgets +import QtQuick +import QtQuick.Layouts + +WrapperItem { + readonly property real nonAnimMargin: handler.hovered ? Appearance.padding.large * 2 : Appearance.padding.large * 1.2 + readonly property real nonAnimWidth: handler.hovered ? Config.lock.sizes.buttonsWidth : Config.lock.sizes.buttonsWidthSmall + readonly property real nonAnimHeight: (nonAnimWidth + nonAnimMargin * 2) / 4 + + margin: nonAnimMargin + rightMargin: 0 + bottomMargin: 0 + implicitWidth: nonAnimWidth + implicitHeight: nonAnimHeight + + Behavior on margin { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasized + } + } + + Behavior on implicitWidth { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasized + } + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasized + } + } + + HoverHandler { + id: handler + + target: parent + } + + RowLayout { + id: layout + + spacing: Appearance.spacing.normal + + SessionButton { + icon: "logout" + command: ["loginctl", "terminate-user", ""] + } + + SessionButton { + icon: "power_settings_new" + command: ["systemctl", "poweroff"] + } + + SessionButton { + icon: "downloading" + command: ["systemctl", "hibernate"] + } + + SessionButton { + icon: "cached" + command: ["systemctl", "reboot"] + } + } + + component SessionButton: StyledRect { + required property string icon + required property list<string> command + + Layout.fillWidth: true + Layout.preferredHeight: width + + radius: stateLayer.containsMouse ? Appearance.rounding.large * 2 : Appearance.rounding.large * 1.2 + color: Colours.palette.m3secondaryContainer + + StateLayer { + id: stateLayer + + color: Colours.palette.m3onSecondaryContainer + + function onClicked(): void { + Quickshell.execDetached(parent.command); + } + } + + MaterialIcon { + anchors.centerIn: parent + + text: parent.icon + color: Colours.palette.m3onSecondaryContainer + font.pointSize: (parent.width * 0.4) || 1 + } + + Behavior on radius { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } +} |