nosignal-shell/modules/session/Content.qml
2 * r + 2 * t 11c8e5c7eb icons: some fixes for previous axes change
Mostly spacing fixes
Also qsTr windowinfo class and title when none
2025-06-26 21:35:15 +10:00

119 lines
2.9 KiB
QML

pragma ComponentBehavior: Bound
import "root:/widgets"
import "root:/services"
import "root:/config"
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: ["loginctl", "terminate-user", ""]
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: ["systemctl", "poweroff"]
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: Config.paths.sessionGif
}
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: 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
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
}
}
}