116 lines
2.8 KiB
QML
116 lines
2.8 KiB
QML
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
|
|
|
|
MaterialIcon {
|
|
anchors.centerIn: parent
|
|
|
|
text: "person"
|
|
fill: 1
|
|
font.pointSize: (info.implicitHeight / 2) || 1
|
|
}
|
|
|
|
CachingImage {
|
|
anchors.fill: parent
|
|
path: `${Paths.home}/.face`
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|