pragma ComponentBehavior: Bound import qs.components import qs.services import qs.config import qs.utils import Quickshell import QtQuick Column { id: root required property PersistentProperties visibilities padding: Appearance.padding.large anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left spacing: Appearance.spacing.large SessionButton { id: logout icon: "logout" command: Config.session.commands.logout KeyNavigation.down: shutdown Connections { target: root.visibilities function onSessionChanged(): void { if (root.visibilities.session) logout.focus = true; } function onLauncherChanged(): void { if (root.visibilities.session && !root.visibilities.launcher) logout.focus = true; } } } SessionButton { id: shutdown icon: "power_settings_new" command: Config.session.commands.shutdown KeyNavigation.up: logout KeyNavigation.down: hibernate } AnimatedImage { width: Config.session.sizes.button height: Config.session.sizes.button sourceSize.width: width sourceSize.height: height playing: visible asynchronous: true speed: 0.7 source: Paths.expandTilde(Config.paths.sessionGif) } SessionButton { id: hibernate icon: "downloading" command: Config.session.commands.hibernate KeyNavigation.up: shutdown KeyNavigation.down: reboot } SessionButton { id: reboot icon: "cached" command: Config.session.commands.reboot KeyNavigation.up: hibernate } component SessionButton: StyledRect { id: button required property string icon required property list command implicitWidth: Config.session.sizes.button implicitHeight: Config.session.sizes.button radius: Appearance.rounding.large color: button.activeFocus ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer Keys.onEnterPressed: Quickshell.execDetached(button.command) Keys.onReturnPressed: Quickshell.execDetached(button.command) Keys.onEscapePressed: root.visibilities.session = false Keys.onPressed: event => { if (!Config.session.vimKeybinds) return; if (event.modifiers & Qt.ControlModifier) { if (event.key === Qt.Key_J && KeyNavigation.down) { KeyNavigation.down.focus = true; event.accepted = true; } else if (event.key === Qt.Key_K && KeyNavigation.up) { KeyNavigation.up.focus = true; event.accepted = true; } } else if (event.key === Qt.Key_Tab && KeyNavigation.down) { KeyNavigation.down.focus = true; event.accepted = true; } else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier))) { if (KeyNavigation.up) { KeyNavigation.up.focus = true; event.accepted = true; } } } StateLayer { radius: parent.radius color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface function onClicked(): void { Quickshell.execDetached(button.command); } } MaterialIcon { anchors.centerIn: parent text: button.icon color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface font.pointSize: Appearance.font.size.extraLarge font.weight: 500 } } }