blob: 66833ab7020f14069f403913d91ccf71468194ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
pragma ComponentBehavior: Bound
import qs.widgets
import qs.services
import qs.config
import Quickshell
import QtQuick
import QtQuick.Layouts
Item {
id: root
readonly property real nonAnimMargin: handler.hovered ? Appearance.padding.large * 1.5 : Appearance.padding.large
readonly property real nonAnimWidth: handler.hovered ? Config.lock.sizes.buttonsWidth : Config.lock.sizes.buttonsWidthSmall
readonly property real nonAnimHeight: (nonAnimWidth + nonAnimMargin * 2) / 4
implicitWidth: nonAnimWidth
implicitHeight: nonAnimHeight
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
anchors.fill: parent
anchors.margins: root.nonAnimMargin
anchors.rightMargin: 0
anchors.bottomMargin: 0
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"]
}
Behavior on anchors.margins {
NumberAnimation {
duration: Appearance.anim.durations.large
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
}
component SessionButton: StyledRect {
required property string icon
required property list<string> command
Layout.fillWidth: true
Layout.preferredHeight: width
radius: 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
font.weight: handler.hovered ? 500 : 400
}
}
}
|