summaryrefslogtreecommitdiff
path: root/modules/session/Content.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-11 23:55:05 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-11 23:55:05 +1000
commit60858f6f02fb7dc04e727db89090e7b83399803a (patch)
tree0a6300271786a38a468ba4bb6df0c392eed82043 /modules/session/Content.qml
parentosd: fix show on hover (diff)
downloadcaelestia-shell-60858f6f02fb7dc04e727db89090e7b83399803a.tar.gz
caelestia-shell-60858f6f02fb7dc04e727db89090e7b83399803a.tar.bz2
caelestia-shell-60858f6f02fb7dc04e727db89090e7b83399803a.zip
feat: session menu
Diffstat (limited to 'modules/session/Content.qml')
-rw-r--r--modules/session/Content.qml118
1 files changed, 118 insertions, 0 deletions
diff --git a/modules/session/Content.qml b/modules/session/Content.qml
new file mode 100644
index 0000000..d1a2c38
--- /dev/null
+++ b/modules/session/Content.qml
@@ -0,0 +1,118 @@
+pragma ComponentBehavior: Bound
+
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Column {
+ id: root
+
+ required property Scope session
+
+ padding: Appearance.padding.large
+
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+
+ spacing: Appearance.spacing.large
+
+ SessionButton {
+ id: logout
+
+ icon: "logout"
+ command: ["uwsm", "stop"]
+
+ KeyNavigation.down: shutdown
+
+ Connections {
+ target: session
+
+ function onSessionVisibleChanged(): void {
+ if (session.sessionVisible)
+ logout.focus = true;
+ }
+ }
+ }
+
+ SessionButton {
+ id: shutdown
+
+ icon: "power_settings_new"
+ command: ["systemctl", "poweroff"]
+
+ KeyNavigation.up: logout
+ KeyNavigation.down: hibernate
+ }
+
+ AnimatedImage {
+ width: SessionConfig.sizes.button
+ height: SessionConfig.sizes.button
+ sourceSize.width: width
+ sourceSize.height: height
+
+ playing: session.sessionVisible
+ asynchronous: true
+ speed: 0.7
+ source: "root:/assets/kurukuru.gif"
+ }
+
+ SessionButton {
+ id: hibernate
+
+ icon: "downloading"
+ command: ["systemctl", "hibernate"]
+
+ KeyNavigation.up: shutdown
+ KeyNavigation.down: reboot
+ }
+
+ SessionButton {
+ id: reboot
+
+ icon: "cached"
+ command: ["systemctl", "reboot"]
+
+ KeyNavigation.up: hibernate
+ }
+
+ component SessionButton: StyledRect {
+ id: button
+
+ required property string icon
+ required property list<string> command
+
+ implicitWidth: SessionConfig.sizes.button
+ implicitHeight: SessionConfig.sizes.button
+
+ radius: Appearance.rounding.large
+ color: button.activeFocus ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer
+
+ Keys.onEnterPressed: proc.startDetached()
+ Keys.onEscapePressed: root.session.sessionVisible = false
+
+ Process {
+ id: proc
+
+ command: button.command
+ }
+
+ StateLayer {
+ radius: parent.radius
+
+ function onClicked(): void {
+ proc.startDetached();
+ }
+ }
+
+ MaterialIcon {
+ anchors.centerIn: parent
+
+ text: button.icon
+ color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
+ font.pointSize: Appearance.font.size.extraLarge
+ }
+ }
+}