C++ / fmt (pull_request) Failing after 7s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Failing after 31s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Failing after 1m28s
Rust / fmt (pull_request) Successful in 30s
Rust / clippy (pull_request) Successful in 54s
96 lines
2.7 KiB
QML
96 lines
2.7 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import QtQuick.Layouts
|
|
import ZShell.Config
|
|
import ZShell.Services
|
|
import qs.Services
|
|
import qs.Modules.Bar.Components.Common
|
|
import qs.Components
|
|
|
|
WidgetBase {
|
|
id: root
|
|
|
|
required property ScreenState screenState
|
|
|
|
clip: true
|
|
color: screenState.resources ? Colors.palette.m3primary : Colors.tPalette.m3surfaceContainer
|
|
implicitHeight: horizontal ? baseSize : gridLayout.implicitHeight + Tokens.padding.medium * 2
|
|
implicitWidth: horizontal ? gridLayout.implicitWidth + Tokens.padding.medium * 2 : baseSize
|
|
radius: Tokens.rounding.full
|
|
|
|
StateLayer {
|
|
color: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
|
|
onClicked: root.screenState.resources = !root.screenState.resources
|
|
}
|
|
|
|
GridLayout {
|
|
id: gridLayout
|
|
|
|
anchors.centerIn: parent
|
|
anchors.horizontalCenterOffset: root.horizontal ? 0 : 1
|
|
anchors.verticalCenterOffset: root.horizontal ? 0 : -3
|
|
columnSpacing: Tokens.spacing.small
|
|
rowSpacing: 0
|
|
columns: root.horizontal ? -1 : 1
|
|
|
|
ServiceRef {
|
|
service: Gpu
|
|
}
|
|
|
|
ServiceRef {
|
|
service: Cpu
|
|
}
|
|
|
|
ServiceRef {
|
|
service: Memory
|
|
}
|
|
|
|
Resource {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
|
|
horizontal: root.horizontal
|
|
icon: "memory"
|
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
|
percentage: Cpu.percentage
|
|
warningThreshold: 95
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "memory_alt"
|
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3secondary
|
|
percentage: Memory.percentage
|
|
warningThreshold: 80
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "gamepad"
|
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3tertiary
|
|
percentage: Gpu.percentage
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "developer_board"
|
|
iconColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
|
|
mainColor: root.screenState.resources ? Colors.palette.m3onPrimary : Colors.palette.m3primary
|
|
percentage: Gpu.memoryUsed / Gpu.memoryTotal
|
|
}
|
|
}
|
|
}
|