102 lines
2.2 KiB
QML
102 lines
2.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Io
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
import "../constants"
|
|
import "../helpers"
|
|
import "."
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property int cpuUsage: 0
|
|
property int memUsage: 0
|
|
property int gpuUsage: 0
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
// anchors.centerIn: verticalCenter
|
|
anchors.leftMargin: 8
|
|
anchors.rightMargin: 8
|
|
|
|
WorkspaceHelpers {
|
|
id: workspaceHelpers
|
|
}
|
|
|
|
// =====================
|
|
// LEFT: Workspaces
|
|
// =====================
|
|
RowLayout {
|
|
spacing: 10
|
|
|
|
Repeater {
|
|
model: 10
|
|
|
|
Text {
|
|
required property int index
|
|
|
|
property int wsId: index + 1
|
|
property var ws: workspaceHelpers.getWorkspace(wsId)
|
|
|
|
text: wsId
|
|
|
|
color: workspaceHelpers.isWorkspaceActive(wsId) ? Colors.md3.primary : (ws ? Colors.md3.on_background : Colors.md3.on_secondary)
|
|
|
|
font {
|
|
family: Constants.fontFamily
|
|
pixelSize: Constants.fontSize
|
|
bold: true
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: Hyprland.dispatch("workspace " + wsId)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Spacer
|
|
Item {
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
// =====================
|
|
// RIGHT: System info
|
|
// =====================
|
|
RowLayout {
|
|
spacing: 10
|
|
|
|
LineSeparator {}
|
|
|
|
BarText {
|
|
prefix: "C"
|
|
value: cpuUsage
|
|
}
|
|
|
|
LineSeparator {}
|
|
|
|
BarText {
|
|
prefix: "M"
|
|
value: memUsage
|
|
}
|
|
|
|
LineSeparator {}
|
|
|
|
BarText {
|
|
prefix: "G"
|
|
value: gpuUsage
|
|
}
|
|
|
|
LineSeparator {}
|
|
|
|
Clock {}
|
|
}
|
|
}
|
|
}
|