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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
import "root:/widgets"
import "root:/services"
import "root:/config"
import "root:/utils"
import Quickshell
import Quickshell.Io
import QtQuick
Row {
id: root
padding: Appearance.padding.large
spacing: Appearance.spacing.large
StyledClippingRect {
implicitWidth: info.implicitHeight
implicitHeight: info.implicitHeight
radius: Appearance.rounding.full
color: Colours.palette.m3surfaceContainerHigh
CachingImage {
anchors.fill: parent
path: `${Paths.home}/.face`
fillMode: Image.PreserveAspectCrop
smooth: true
}
Rectangle {
id: overlay
anchors.fill: parent
radius: avatarRect.radius
color: Qt.rgba(0, 0, 0, 0.4)
opacity: mouseArea.containsMouse ? 1.0 : 0.0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: 300
easing.type: Easing.InOutQuad
}
}
MaterialIcon {
anchors.centerIn: parent
text: "photo_camera"
color: "white"
font.pointSize: info.implicitHeight / 4
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: avatarUpdateProc.running = true
cursorShape: Qt.PointingHandCursor
}
Process {
id: avatarUpdateProc
running: false
command: [`${Paths.home}/.local/share/caelestia/shell/scripts/caelestia-avatar-picker.sh`]
stdout: SplitParser {
onRead: {
notifyProc.running = true
}
}
}
Process {
id: notifyProc
running: false
command: [
"notify-send",
"-u", "low",
"-i", "dialog-information-symbolic",
"Profile Updated",
"Your avatar has been successfully changed.",
"-a", "Shell",
"-A", "OK=Got it!"
]
}
}
Column {
id: info
spacing: Appearance.spacing.normal
InfoLine {
icon: Icons.osIcon
text: Icons.osName
colour: Colours.palette.m3primary
}
InfoLine {
icon: "select_window_2"
text: Quickshell.env("XDG_CURRENT_DESKTOP") || Quickshell.env("XDG_SESSION_DESKTOP")
colour: Colours.palette.m3secondary
}
InfoLine {
icon: "timer"
text: uptimeProc.uptime
colour: Colours.palette.m3tertiary
Timer {
running: true
repeat: true
interval: 15000
onTriggered: uptimeProc.running = true
}
Process {
id: uptimeProc
property string uptime
running: true
command: ["uptime", "-p"]
stdout: SplitParser {
onRead: data => uptimeProc.uptime = data
}
}
}
}
component InfoLine: Item {
id: line
required property string icon
required property string text
required property color colour
implicitWidth: icon.implicitWidth + text.width + text.anchors.leftMargin
implicitHeight: Math.max(icon.implicitHeight, text.implicitHeight)
MaterialIcon {
id: icon
anchors.left: parent.left
anchors.leftMargin: (DashboardConfig.sizes.infoIconSize - implicitWidth) / 2
text: line.icon
color: line.colour
font.pointSize: Appearance.font.size.normal
font.variableAxes: ({
FILL: 1
})
}
StyledText {
id: text
anchors.verticalCenter: icon.verticalCenter
anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin
text: `: ${line.text}`
font.pointSize: Appearance.font.size.normal
width: DashboardConfig.sizes.infoWidth
elide: Text.ElideRight
}
}
}
|