1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 14:32:52 -05:00

migrate to dankgop monitoring

This commit is contained in:
bbedward
2025-08-09 16:50:02 -04:00
parent a0c5f31ffa
commit 3f5eb1844c
21 changed files with 1061 additions and 934 deletions

View File

@@ -13,7 +13,7 @@ Rectangle {
border.width: 1
Ref {
service: SysMonitorService
service: DankgopService
}
Column {
@@ -36,7 +36,7 @@ Rectangle {
spacing: Theme.spacingXS
StyledText {
text: SysMonitorService.hostname
text: DankgopService.hostname
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
@@ -45,7 +45,7 @@ Rectangle {
}
StyledText {
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture
text: DankgopService.distribution + " • " + DankgopService.architecture
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.7)
@@ -74,7 +74,7 @@ Rectangle {
}
StyledText {
text: "Load: " + SysMonitorService.loadAverage
text: "Load: " + DankgopService.loadAverage
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
width: parent.width
@@ -82,8 +82,8 @@ Rectangle {
}
StyledText {
text: SysMonitorService.processCount + " proc, "
+ SysMonitorService.threadCount + " threads"
text: DankgopService.processCount + " proc, "
+ DankgopService.threadCount + " threads"
font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.8)

View File

@@ -28,10 +28,10 @@ Column {
anchors.fill: parent
spacing: Theme.spacingM
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["cpu", "memory", "network", "disk"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["cpu", "memory", "network", "disk"])
}
Rectangle {
@@ -71,7 +71,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: SysMonitorService.totalCpuUsage.toFixed(1) + "%"
text: DankgopService.cpuUsage.toFixed(1) + "%"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.primary
@@ -85,7 +85,7 @@ Column {
}
StyledText {
text: SysMonitorService.cpuCount + " cores"
text: DankgopService.cpuCores + " cores"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
@@ -104,7 +104,7 @@ Column {
spacing: 6
Repeater {
model: SysMonitorService.perCoreCpuUsage
model: DankgopService.perCoreCpuUsage
Row {
width: parent.width
@@ -193,9 +193,9 @@ Column {
}
StyledText {
text: SysMonitorService.formatSystemMemory(
SysMonitorService.usedMemoryKB) + " / " + SysMonitorService.formatSystemMemory(
SysMonitorService.totalMemoryKB)
text: DankgopService.formatSystemMemory(
DankgopService.usedMemoryKB) + " / " + DankgopService.formatSystemMemory(
DankgopService.totalMemoryKB)
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
@@ -218,15 +218,15 @@ Column {
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
Rectangle {
width: SysMonitorService.totalMemoryKB
> 0 ? parent.width * (SysMonitorService.usedMemoryKB
/ SysMonitorService.totalMemoryKB) : 0
width: DankgopService.totalMemoryKB
> 0 ? parent.width * (DankgopService.usedMemoryKB
/ DankgopService.totalMemoryKB) : 0
height: parent.height
radius: parent.radius
color: {
const usage = SysMonitorService.totalMemoryKB
> 0 ? (SysMonitorService.usedMemoryKB
/ SysMonitorService.totalMemoryKB) : 0
const usage = DankgopService.totalMemoryKB
> 0 ? (DankgopService.usedMemoryKB
/ DankgopService.totalMemoryKB) : 0
if (usage > 0.9)
return Theme.error
@@ -245,9 +245,9 @@ Column {
}
StyledText {
text: SysMonitorService.totalMemoryKB
> 0 ? ((SysMonitorService.usedMemoryKB
/ SysMonitorService.totalMemoryKB) * 100).toFixed(
text: DankgopService.totalMemoryKB
> 0 ? ((DankgopService.usedMemoryKB
/ DankgopService.totalMemoryKB) * 100).toFixed(
1) + "% used" : "No data"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
@@ -272,11 +272,11 @@ Column {
}
StyledText {
text: SysMonitorService.totalSwapKB
> 0 ? SysMonitorService.formatSystemMemory(
SysMonitorService.usedSwapKB) + " / "
+ SysMonitorService.formatSystemMemory(
SysMonitorService.totalSwapKB) : "No swap configured"
text: DankgopService.totalSwapKB
> 0 ? DankgopService.formatSystemMemory(
DankgopService.usedSwapKB) + " / "
+ DankgopService.formatSystemMemory(
DankgopService.totalSwapKB) : "No swap configured"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
@@ -299,17 +299,17 @@ Column {
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
Rectangle {
width: SysMonitorService.totalSwapKB
> 0 ? parent.width * (SysMonitorService.usedSwapKB
/ SysMonitorService.totalSwapKB) : 0
width: DankgopService.totalSwapKB
> 0 ? parent.width * (DankgopService.usedSwapKB
/ DankgopService.totalSwapKB) : 0
height: parent.height
radius: parent.radius
color: {
if (!SysMonitorService.totalSwapKB)
if (!DankgopService.totalSwapKB)
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.3)
const usage = SysMonitorService.usedSwapKB / SysMonitorService.totalSwapKB
const usage = DankgopService.usedSwapKB / DankgopService.totalSwapKB
if (usage > 0.9)
return Theme.error
@@ -328,9 +328,9 @@ Column {
}
StyledText {
text: SysMonitorService.totalSwapKB
> 0 ? ((SysMonitorService.usedSwapKB
/ SysMonitorService.totalSwapKB) * 100).toFixed(
text: DankgopService.totalSwapKB
> 0 ? ((DankgopService.usedSwapKB
/ DankgopService.totalSwapKB) * 100).toFixed(
1) + "% used" : "Not available"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
@@ -381,9 +381,9 @@ Column {
}
StyledText {
text: SysMonitorService.networkRxRate
text: DankgopService.networkRxRate
> 0 ? formatNetworkSpeed(
SysMonitorService.networkRxRate) : "0 B/s"
DankgopService.networkRxRate) : "0 B/s"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.surfaceText
@@ -400,9 +400,9 @@ Column {
}
StyledText {
text: SysMonitorService.networkTxRate
text: DankgopService.networkTxRate
> 0 ? formatNetworkSpeed(
SysMonitorService.networkTxRate) : "0 B/s"
DankgopService.networkTxRate) : "0 B/s"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.surfaceText
@@ -448,7 +448,7 @@ Column {
}
StyledText {
text: formatDiskSpeed(SysMonitorService.diskReadRate)
text: formatDiskSpeed(DankgopService.diskReadRate)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.surfaceText
@@ -465,7 +465,7 @@ Column {
}
StyledText {
text: formatDiskSpeed(SysMonitorService.diskWriteRate)
text: formatDiskSpeed(DankgopService.diskWriteRate)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold
color: Theme.surfaceText

View File

@@ -59,7 +59,7 @@ Rectangle {
DankIcon {
id: processIcon
name: SysMonitorService.getProcessIcon(process ? process.command : "")
name: DankgopService.getProcessIcon(process ? process.command : "")
size: Theme.iconSize - 4
color: {
if (process && process.cpu > 80)
@@ -110,7 +110,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: SysMonitorService.formatCpuUsage(process ? process.cpu : 0)
text: DankgopService.formatCpuUsage(process ? process.cpu : 0)
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: Font.Bold
@@ -149,7 +149,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: SysMonitorService.formatMemoryUsage(
text: DankgopService.formatMemoryUsage(
process ? process.memoryKB : 0)
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily

View File

@@ -57,7 +57,7 @@ PanelWindow {
color: "transparent"
Ref {
service: SysMonitorService
service: DankgopService
}
anchors {

View File

@@ -10,10 +10,10 @@ Column {
property var contextMenu: null
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["processes"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["processes"])
}
Item {
@@ -39,9 +39,9 @@ Column {
text: "Process"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "name" ? Font.Bold : Font.Medium
font.weight: DankgopService.sortBy === "name" ? Font.Bold : Font.Medium
color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "name" ? 1 : 0.7
opacity: DankgopService.sortBy === "name" ? 1 : 0.7
anchors.centerIn: parent
}
@@ -52,7 +52,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
SysMonitorService.setSortBy("name")
DankgopService.setSortBy("name")
}
}
@@ -79,9 +79,9 @@ Column {
text: "CPU"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "cpu" ? Font.Bold : Font.Medium
font.weight: DankgopService.sortBy === "cpu" ? Font.Bold : Font.Medium
color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.7
opacity: DankgopService.sortBy === "cpu" ? 1 : 0.7
anchors.centerIn: parent
}
@@ -92,7 +92,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
SysMonitorService.setSortBy("cpu")
DankgopService.setSortBy("cpu")
}
}
@@ -119,9 +119,9 @@ Column {
text: "RAM"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "memory" ? Font.Bold : Font.Medium
font.weight: DankgopService.sortBy === "memory" ? Font.Bold : Font.Medium
color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.7
opacity: DankgopService.sortBy === "memory" ? 1 : 0.7
anchors.centerIn: parent
}
@@ -132,7 +132,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
SysMonitorService.setSortBy("memory")
DankgopService.setSortBy("memory")
}
}
@@ -159,9 +159,9 @@ Column {
text: "PID"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "pid" ? Font.Bold : Font.Medium
font.weight: DankgopService.sortBy === "pid" ? Font.Bold : Font.Medium
color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "pid" ? 1 : 0.7
opacity: DankgopService.sortBy === "pid" ? 1 : 0.7
horizontalAlignment: Text.AlignHCenter
anchors.centerIn: parent
}
@@ -173,7 +173,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
SysMonitorService.setSortBy("pid")
DankgopService.setSortBy("pid")
}
}
@@ -197,7 +197,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: SysMonitorService.sortDescending ? "↓" : "↑"
text: DankgopService.sortDescending ? "↓" : "↑"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.centerIn: parent
@@ -210,7 +210,7 @@ Column {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
SysMonitorService.toggleSortOrder()
// ! TODO - we lost this with dankgop
}
}
@@ -231,7 +231,7 @@ Column {
height: parent.height - columnHeaders.height
clip: true
spacing: 4
model: SysMonitorService.processes
model: DankgopService.processes
delegate: ProcessListItem {
process: modelData

View File

@@ -8,10 +8,10 @@ Row {
width: parent.width
spacing: Theme.spacingM
Component.onCompleted: {
SysMonitorService.addRef();
DankgopService.addRef(["cpu", "memory", "system"]);
}
Component.onDestruction: {
SysMonitorService.removeRef();
DankgopService.removeRef(["cpu", "memory", "system"]);
}
Rectangle {
@@ -19,15 +19,15 @@ Row {
height: 80
radius: Theme.cornerRadius
color: {
if (SysMonitorService.sortBy === "cpu")
if (DankgopService.sortBy === "cpu")
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
else if (cpuCardMouseArea.containsMouse)
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12);
else
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08);
}
border.color: SysMonitorService.sortBy === "cpu" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
border.width: SysMonitorService.sortBy === "cpu" ? 2 : 1
border.color: DankgopService.sortBy === "cpu" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
border.width: DankgopService.sortBy === "cpu" ? 2 : 1
MouseArea {
id: cpuCardMouseArea
@@ -35,7 +35,7 @@ Row {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: SysMonitorService.setSortBy("cpu")
onClicked: DankgopService.setSortBy("cpu")
}
Column {
@@ -48,15 +48,19 @@ Row {
text: "CPU"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: SysMonitorService.sortBy === "cpu" ? Theme.primary : Theme.secondary
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.8
color: DankgopService.sortBy === "cpu" ? Theme.primary : Theme.secondary
opacity: DankgopService.sortBy === "cpu" ? 1 : 0.8
}
Row {
spacing: Theme.spacingS
StyledText {
text: SysMonitorService.totalCpuUsage.toFixed(1) + "%"
text: {
if (DankgopService.cpuUsage === undefined || DankgopService.cpuUsage === null)
return "--%"
return DankgopService.cpuUsage.toFixed(1) + "%"
}
font.pixelSize: Theme.fontSizeLarge
font.family: SettingsData.monoFontFamily
font.weight: Font.Bold
@@ -73,19 +77,19 @@ Row {
StyledText {
text: {
if (SysMonitorService.cpuTemperature === undefined || SysMonitorService.cpuTemperature === null || SysMonitorService.cpuTemperature < 0)
if (DankgopService.cpuTemperature === undefined || DankgopService.cpuTemperature === null || DankgopService.cpuTemperature <= 0)
return "--°";
return Math.round(SysMonitorService.cpuTemperature) + "°";
return Math.round(DankgopService.cpuTemperature) + "°";
}
font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily
font.weight: Font.Medium
color: {
if (SysMonitorService.cpuTemperature > 80)
if (DankgopService.cpuTemperature > 80)
return Theme.error;
if (SysMonitorService.cpuTemperature > 60)
if (DankgopService.cpuTemperature > 60)
return Theme.warning;
return Theme.surfaceText;
@@ -96,7 +100,7 @@ Row {
}
StyledText {
text: SysMonitorService.cpuCount + " cores"
text: DankgopService.cpuCores + " cores"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Theme.surfaceText
@@ -126,15 +130,15 @@ Row {
height: 80
radius: Theme.cornerRadius
color: {
if (SysMonitorService.sortBy === "memory")
if (DankgopService.sortBy === "memory")
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
else if (memoryCardMouseArea.containsMouse)
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.12);
else
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.08);
}
border.color: SysMonitorService.sortBy === "memory" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.2)
border.width: SysMonitorService.sortBy === "memory" ? 2 : 1
border.color: DankgopService.sortBy === "memory" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.2)
border.width: DankgopService.sortBy === "memory" ? 2 : 1
MouseArea {
id: memoryCardMouseArea
@@ -142,7 +146,7 @@ Row {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: SysMonitorService.setSortBy("memory")
onClicked: DankgopService.setSortBy("memory")
}
Column {
@@ -155,15 +159,15 @@ Row {
text: "Memory"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: SysMonitorService.sortBy === "memory" ? Theme.primary : Theme.secondary
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.8
color: DankgopService.sortBy === "memory" ? Theme.primary : Theme.secondary
opacity: DankgopService.sortBy === "memory" ? 1 : 0.8
}
Row {
spacing: Theme.spacingS
StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB)
text: DankgopService.formatSystemMemory(DankgopService.usedMemoryKB)
font.pixelSize: Theme.fontSizeLarge
font.family: SettingsData.monoFontFamily
font.weight: Font.Bold
@@ -176,27 +180,27 @@ Row {
height: 20
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
anchors.verticalCenter: parent.verticalCenter
visible: SysMonitorService.totalSwapKB > 0
visible: DankgopService.totalSwapKB > 0
}
StyledText {
text: SysMonitorService.totalSwapKB > 0 ? SysMonitorService.formatSystemMemory(SysMonitorService.usedSwapKB) : ""
text: DankgopService.totalSwapKB > 0 ? DankgopService.formatSystemMemory(DankgopService.usedSwapKB) : ""
font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily
font.weight: Font.Medium
color: SysMonitorService.usedSwapKB > 0 ? Theme.warning : Theme.surfaceText
color: DankgopService.usedSwapKB > 0 ? Theme.warning : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
visible: SysMonitorService.totalSwapKB > 0
visible: DankgopService.totalSwapKB > 0
}
}
StyledText {
text: {
if (SysMonitorService.totalSwapKB > 0)
return "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " + swap";
if (DankgopService.totalSwapKB > 0)
return "of " + DankgopService.formatSystemMemory(DankgopService.totalMemoryKB) + " + swap";
return "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB);
return "of " + DankgopService.formatSystemMemory(DankgopService.totalMemoryKB);
}
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
@@ -227,40 +231,40 @@ Row {
height: 80
radius: Theme.cornerRadius
color: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1)
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16);
else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08);
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)];
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)];
var vendor = gpu.vendor.toLowerCase();
if (vendor.includes("nvidia")) {
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1)
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1)
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.2);
else
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.12);
} else if (vendor.includes("amd")) {
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1)
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2);
else
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
} else if (vendor.includes("intel")) {
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1)
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1)
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.2);
else
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.12);
}
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1)
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16);
else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08);
}
border.color: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2);
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)];
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)];
var vendor = gpu.vendor.toLowerCase();
if (vendor.includes("nvidia"))
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3);
@@ -278,11 +282,11 @@ Row {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: SysMonitorService.availableGpus.length > 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
cursorShape: DankgopService.availableGpus.length > 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: (mouse) => {
if (mouse.button === Qt.LeftButton) {
if (SysMonitorService.availableGpus.length > 1) {
var nextIndex = (SessionData.selectedGpuIndex + 1) % SysMonitorService.availableGpus.length;
if (DankgopService.availableGpus.length > 1) {
var nextIndex = (SessionData.selectedGpuIndex + 1) % DankgopService.availableGpus.length;
SessionData.setSelectedGpuIndex(nextIndex);
}
} else if (mouse.button === Qt.RightButton) {
@@ -307,12 +311,14 @@ Row {
StyledText {
text: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
return "No GPU";
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)];
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)];
// Check if temperature monitoring is enabled for this GPU
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1;
var temp = gpu.temperature;
var hasTemp = temp !== undefined && temp !== null && temp !== 0;
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0;
if (hasTemp)
return Math.round(temp) + "°";
else
@@ -322,15 +328,16 @@ Row {
font.family: SettingsData.monoFontFamily
font.weight: Font.Bold
color: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
return Theme.surfaceText;
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)];
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)];
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1;
var temp = gpu.temperature || 0;
if (temp > 80)
if (tempEnabled && temp > 80)
return Theme.error;
if (temp > 60)
if (tempEnabled && temp > 60)
return Theme.warning;
return Theme.surfaceText;
@@ -339,12 +346,13 @@ Row {
StyledText {
text: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
return "No GPUs detected";
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)];
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)];
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1;
var temp = gpu.temperature;
var hasTemp = temp !== undefined && temp !== null && temp !== 0;
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0;
if (hasTemp)
return gpu.vendor + " " + gpu.displayName;
else
@@ -365,41 +373,40 @@ Row {
id: gpuContextMenu
MenuItem {
text: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
return "Enable GPU Temperature"
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)]
var isNvidia = gpu.vendor.toLowerCase().includes("nvidia")
return isNvidia ? "Enable GPU Temperature" : "Enable GPU Temperature"
}
text: "Enable GPU Temperature"
checkable: true
checked: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
return false
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)]
var isNvidia = gpu.vendor.toLowerCase().includes("nvidia")
return isNvidia ? SysMonitorService.nvidiaGpuTempEnabled : SysMonitorService.nonNvidiaGpuTempEnabled
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)]
if (!gpu.pciId) return false
return SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1 : false
}
onTriggered: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
return
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)]
var isNvidia = gpu.vendor.toLowerCase().includes("nvidia")
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)]
if (!gpu.pciId) return
if (isNvidia) {
SessionData.setNvidiaGpuTempEnabled(checked)
} else {
SessionData.setNonNvidiaGpuTempEnabled(checked)
var enabledIds = SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.slice() : []
var index = enabledIds.indexOf(gpu.pciId)
if (checked && index === -1) {
enabledIds.push(gpu.pciId)
DankgopService.addGpuPciId(gpu.pciId)
} else if (!checked && index !== -1) {
enabledIds.splice(index, 1)
DankgopService.removeGpuPciId(gpu.pciId)
}
SessionData.setEnabledGpuPciIds(enabledIds)
}
}
}
Behavior on color {

View File

@@ -10,10 +10,10 @@ ScrollView {
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["system", "hardware", "diskmounts"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["system", "hardware", "diskmounts"])
}
Column {
@@ -52,7 +52,7 @@ ScrollView {
spacing: Theme.spacingS
StyledText {
text: SysMonitorService.hostname
text: DankgopService.hostname
font.pixelSize: Theme.fontSizeXLarge
font.family: SettingsData.monoFontFamily
font.weight: Font.Light
@@ -61,8 +61,8 @@ ScrollView {
}
StyledText {
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture
+ " • " + SysMonitorService.kernelVersion
text: DankgopService.distribution + " • " + DankgopService.architecture
+ " • " + DankgopService.kernelVersion
font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -71,7 +71,7 @@ ScrollView {
}
StyledText {
text: "Up " + UserInfoService.uptime + " • Boot: " + SysMonitorService.bootTime
text: "Up " + UserInfoService.uptime + " • Boot: " + DankgopService.bootTime
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -80,9 +80,9 @@ ScrollView {
}
StyledText {
text: "Load: " + SysMonitorService.loadAverage + " • "
+ SysMonitorService.processCount + " processes, "
+ SysMonitorService.threadCount + " threads"
text: "Load: " + DankgopService.loadAverage + " • "
+ DankgopService.processCount + " processes, "
+ DankgopService.threadCount + " threads"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -144,7 +144,7 @@ ScrollView {
}
StyledText {
text: SysMonitorService.cpuModel
text: DankgopService.cpuModel
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
font.weight: Font.Medium
@@ -157,7 +157,7 @@ ScrollView {
}
StyledText {
text: SysMonitorService.motherboard
text: DankgopService.motherboard
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -170,7 +170,7 @@ ScrollView {
}
StyledText {
text: "BIOS " + SysMonitorService.biosVersion
text: "BIOS " + DankgopService.biosVersion
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -181,8 +181,8 @@ ScrollView {
}
StyledText {
text: SysMonitorService.formatSystemMemory(
SysMonitorService.totalMemoryKB) + " RAM"
text: DankgopService.formatSystemMemory(
DankgopService.totalMemoryKB) + " RAM"
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
@@ -206,11 +206,11 @@ ScrollView {
Theme.surfaceContainerHigh.g,
Theme.surfaceContainerHigh.b, 0.6)
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
return gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1 ? hoverColor : baseColor
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
return gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1 ? hoverColor : baseColor
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)]
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)]
var vendor = gpu.fullName.split(' ')[0].toLowerCase()
var tintColor
@@ -221,10 +221,10 @@ ScrollView {
} else if (vendor.includes("intel")) {
tintColor = Theme.info
} else {
return gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1 ? hoverColor : baseColor
return gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1 ? hoverColor : baseColor
}
if (gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1) {
if (gpuCardMouseArea.containsMouse && DankgopService.availableGpus.length > 1) {
return Qt.rgba((hoverColor.r + tintColor.r * 0.1) / 1.1,
(hoverColor.g + tintColor.g * 0.1) / 1.1,
(hoverColor.b + tintColor.b * 0.1) / 1.1, 0.6)
@@ -236,11 +236,11 @@ ScrollView {
}
border.width: 1
border.color: {
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
}
var gpu = SysMonitorService.availableGpus[Math.min(SessionData.selectedGpuIndex, SysMonitorService.availableGpus.length - 1)]
var gpu = DankgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DankgopService.availableGpus.length - 1)]
var vendor = gpu.fullName.split(' ')[0].toLowerCase()
if (vendor.includes("nvidia")) {
@@ -258,12 +258,12 @@ ScrollView {
id: gpuCardMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: SysMonitorService.availableGpus.length
cursorShape: DankgopService.availableGpus.length
> 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
if (SysMonitorService.availableGpus.length > 1) {
if (DankgopService.availableGpus.length > 1) {
var nextIndex = (SessionData.selectedGpuIndex + 1)
% SysMonitorService.availableGpus.length
% DankgopService.availableGpus.length
SessionData.setSelectedGpuIndex(nextIndex)
}
}
@@ -301,13 +301,13 @@ ScrollView {
StyledText {
text: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0) {
return "No GPUs detected"
}
var gpu = SysMonitorService.availableGpus[Math.min(
var gpu = DankgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
SysMonitorService.availableGpus.length
DankgopService.availableGpus.length
- 1)]
return gpu.fullName
}
@@ -323,13 +323,13 @@ ScrollView {
StyledText {
text: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0) {
return "Device: N/A"
}
var gpu = SysMonitorService.availableGpus[Math.min(
var gpu = DankgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
SysMonitorService.availableGpus.length
DankgopService.availableGpus.length
- 1)]
return "Device: " + gpu.pciId
}
@@ -345,13 +345,13 @@ ScrollView {
StyledText {
text: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0) {
return "Driver: N/A"
}
var gpu = SysMonitorService.availableGpus[Math.min(
var gpu = DankgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
SysMonitorService.availableGpus.length
DankgopService.availableGpus.length
- 1)]
return "Driver: " + gpu.driver
}
@@ -366,13 +366,13 @@ ScrollView {
StyledText {
text: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0) {
return "Temp: --°"
}
var gpu = SysMonitorService.availableGpus[Math.min(
var gpu = DankgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
SysMonitorService.availableGpus.length
DankgopService.availableGpus.length
- 1)]
var temp = gpu.temperature
return "Temp: " + ((temp === undefined || temp === null
@@ -382,14 +382,14 @@ ScrollView {
font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily
color: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0) {
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0) {
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.7)
}
var gpu = SysMonitorService.availableGpus[Math.min(
var gpu = DankgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
SysMonitorService.availableGpus.length
DankgopService.availableGpus.length
- 1)]
var temp = gpu.temperature || 0
if (temp > 80)
@@ -532,7 +532,7 @@ ScrollView {
Repeater {
id: diskMountRepeater
model: SysMonitorService.diskMounts
model: DankgopService.diskMounts
Rectangle {
width: parent.width

View File

@@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Controls
import qs.Common
import qs.Services
import qs.Widgets
Item {
@@ -53,26 +54,29 @@ Item {
"text": "CPU Usage",
"description": "CPU usage indicator",
"icon": "memory",
"enabled": true
"enabled": DankgopService.dankgopAvailable,
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
}, {
"id": "memUsage",
"text": "Memory Usage",
"description": "Memory usage indicator",
"icon": "storage",
"enabled": true
"enabled": DankgopService.dankgopAvailable,
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
}, {
"id": "cpuTemp",
"text": "CPU Temperature",
"description": "CPU temperature display",
"icon": "device_thermostat",
"enabled": true
"enabled": DankgopService.dankgopAvailable,
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
}, {
"id": "gpuTemp",
"text": "GPU Temperature",
"description": "GPU temperature display",
"icon": "auto_awesome_mosaic",
"warning": "This widget prevents GPU power off states, which can significantly impact battery life on laptops. It is not recommended to use this on laptops with hybrid graphics.",
"enabled": true
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : "This widget prevents GPU power off states, which can significantly impact battery life on laptops. It is not recommended to use this on laptops with hybrid graphics.",
"enabled": DankgopService.dankgopAvailable
}, {
"id": "systemTray",
"text": "System Tray",
@@ -145,12 +149,6 @@ Item {
}, {
"id": "clipboard",
"enabled": true
}, {
"id": "cpuUsage",
"enabled": true
}, {
"id": "memUsage",
"enabled": true
}, {
"id": "notificationButton",
"enabled": true
@@ -169,8 +167,10 @@ Item {
}
if (widgetId === "spacer")
widgetObj.size = 20
if (widgetId === "gpuTemp")
if (widgetId === "gpuTemp") {
widgetObj.selectedGpuIndex = 0
widgetObj.pciId = ""
}
var widgets = []
if (targetSection === "left") {
@@ -223,14 +223,22 @@ Item {
var widget = widgets[i]
var widgetId = typeof widget === "string" ? widget : widget.id
if (widgetId === itemId) {
widgets[i] = typeof widget === "string" ? {
"id": widget,
"enabled": enabled
} : {
"id": widget.id,
"enabled": enabled,
"size": widget.size,
"selectedGpuIndex": widget.selectedGpuIndex
if (typeof widget === "string") {
widgets[i] = {
"id": widget,
"enabled": enabled
}
} else {
var newWidget = {
"id": widget.id,
"enabled": enabled
}
if (widget.size !== undefined) newWidget.size = widget.size
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex
else if (widget.id === "gpuTemp") newWidget.selectedGpuIndex = 0
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId
else if (widget.id === "gpuTemp") newWidget.pciId = ""
widgets[i] = newWidget
}
break
}
@@ -264,15 +272,21 @@ Item {
var widget = widgets[i]
var widgetId = typeof widget === "string" ? widget : widget.id
if (widgetId === itemId && widgetId === "spacer") {
widgets[i] = typeof widget === "string" ? {
"id": widget,
"enabled": true,
"size": newSize
} : {
"id": widget.id,
"enabled": widget.enabled,
"size": newSize,
"selectedGpuIndex": widget.selectedGpuIndex
if (typeof widget === "string") {
widgets[i] = {
"id": widget,
"enabled": true,
"size": newSize
}
} else {
var newWidget = {
"id": widget.id,
"enabled": widget.enabled,
"size": newSize
}
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId
widgets[i] = newWidget
}
break
}
@@ -296,15 +310,22 @@ Item {
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
var widget = widgets[widgetIndex]
widgets[widgetIndex] = typeof widget === "string" ? {
"id": widget,
"enabled": true,
"selectedGpuIndex": selectedGpuIndex
} : {
"id": widget.id,
"enabled": widget.enabled,
"size": widget.size,
"selectedGpuIndex": selectedGpuIndex
if (typeof widget === "string") {
widgets[widgetIndex] = {
"id": widget,
"enabled": true,
"selectedGpuIndex": selectedGpuIndex,
"pciId": DankgopService.availableGpus && DankgopService.availableGpus.length > selectedGpuIndex ? DankgopService.availableGpus[selectedGpuIndex].pciId : ""
}
} else {
var newWidget = {
"id": widget.id,
"enabled": widget.enabled,
"selectedGpuIndex": selectedGpuIndex,
"pciId": DankgopService.availableGpus && DankgopService.availableGpus.length > selectedGpuIndex ? DankgopService.availableGpus[selectedGpuIndex].pciId : ""
}
if (widget.size !== undefined) newWidget.size = widget.size
widgets[widgetIndex] = newWidget
}
}
@@ -331,6 +352,8 @@ Item {
var widgetSize = typeof widget === "string" ? undefined : widget.size
var widgetSelectedGpuIndex = typeof widget
=== "string" ? undefined : widget.selectedGpuIndex
var widgetPciId = typeof widget
=== "string" ? undefined : widget.pciId
var widgetDef = baseWidgetDefinitions.find(w => {
return w.id === widgetId
})
@@ -341,6 +364,8 @@ Item {
item.size = widgetSize
if (widgetSelectedGpuIndex !== undefined)
item.selectedGpuIndex = widgetSelectedGpuIndex
if (widgetPciId !== undefined)
item.pciId = widgetPciId
widgets.push(item)
}
@@ -359,8 +384,9 @@ Item {
if (!SettingsData.topBarRightWidgets
|| SettingsData.topBarRightWidgets.length === 0)
SettingsData.setTopBarRightWidgets(
defaultRightWidgets)["left", "center", "right"].forEach(sectionId => {
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
["left", "center", "right"].forEach(sectionId => {
var widgets = []
if (sectionId === "left")
widgets = SettingsData.topBarLeftWidgets.slice()

View File

@@ -148,29 +148,23 @@ Column {
currentValue: {
var selectedIndex = modelData.selectedGpuIndex
!== undefined ? modelData.selectedGpuIndex : 0
if (SysMonitorService.availableGpus
&& SysMonitorService.availableGpus.length > selectedIndex
if (DankgopService.availableGpus
&& DankgopService.availableGpus.length > selectedIndex
&& selectedIndex >= 0) {
var gpu = SysMonitorService.availableGpus[selectedIndex]
return gpu.driver.toUpperCase() + " (" + Math.round(
gpu.temperature || 0) + "°C)"
var gpu = DankgopService.availableGpus[selectedIndex]
return gpu.driver.toUpperCase()
}
return SysMonitorService.availableGpus
&& SysMonitorService.availableGpus.length
> 0 ? SysMonitorService.availableGpus[0].driver.toUpperCase(
) + " (" + Math.round(
SysMonitorService.availableGpus[0].temperature
|| 0) + "°C)" : ""
return DankgopService.availableGpus
&& DankgopService.availableGpus.length
> 0 ? DankgopService.availableGpus[0].driver.toUpperCase() : ""
}
options: {
var gpuOptions = []
if (SysMonitorService.availableGpus
&& SysMonitorService.availableGpus.length > 0) {
for (var i = 0; i < SysMonitorService.availableGpus.length; i++) {
var gpu = SysMonitorService.availableGpus[i]
gpuOptions.push(gpu.driver.toUpperCase(
) + " (" + Math.round(gpu.temperature
|| 0) + "°C)")
if (DankgopService.availableGpus
&& DankgopService.availableGpus.length > 0) {
for (var i = 0; i < DankgopService.availableGpus.length; i++) {
var gpu = DankgopService.availableGpus[i]
gpuOptions.push(gpu.driver.toUpperCase())
}
}
return gpuOptions
@@ -188,7 +182,7 @@ Column {
Item {
width: 32
height: 32
visible: modelData.id === "gpuTemp" && modelData.warning
visible: (modelData.warning !== undefined && modelData.warning !== "") && (modelData.id === "cpuUsage" || modelData.id === "memUsage" || modelData.id === "cpuTemp" || modelData.id === "gpuTemp")
DankIcon {
name: "warning"
@@ -207,13 +201,16 @@ Column {
Rectangle {
id: warningTooltip
width: warningTooltipText.contentWidth + Theme.spacingM * 2
height: warningTooltipText.contentHeight + Theme.spacingS * 2
property string warningText: (modelData.warning !== undefined && modelData.warning !== "") ? modelData.warning : ""
width: Math.min(250, warningTooltipText.implicitWidth) + Theme.spacingM * 2
height: warningTooltipText.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius
color: Theme.surfaceContainer
border.color: Theme.outline
border.width: 1
visible: warningArea.containsMouse
visible: warningArea.containsMouse && warningText !== ""
opacity: visible ? 1 : 0
x: -width - Theme.spacingS
y: (parent.height - height) / 2
@@ -222,10 +219,11 @@ Column {
StyledText {
id: warningTooltipText
anchors.centerIn: parent
text: modelData.warning || "Warning"
anchors.margins: Theme.spacingS
text: warningTooltip.warningText
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
width: 300
width: Math.min(250, implicitWidth)
wrapMode: Text.WordWrap
}

View File

@@ -23,10 +23,10 @@ Rectangle {
baseColor.a * Theme.widgetTransparency)
}
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["cpu"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["cpu"])
}
MouseArea {
@@ -45,7 +45,7 @@ Rectangle {
Theme.barHeight + Theme.spacingXS,
width, section, currentScreen)
}
SysMonitorService.setSortBy("cpu")
DankgopService.setSortBy("cpu")
if (root.toggleProcessList)
root.toggleProcessList()
}
@@ -59,10 +59,10 @@ Rectangle {
name: "memory"
size: Theme.iconSize - 8
color: {
if (SysMonitorService.cpuUsage > 80)
if (DankgopService.cpuUsage > 80)
return Theme.tempDanger
if (SysMonitorService.cpuUsage > 60)
if (DankgopService.cpuUsage > 60)
return Theme.tempWarning
return Theme.surfaceText
@@ -72,12 +72,12 @@ Rectangle {
StyledText {
text: {
if (SysMonitorService.cpuUsage === undefined
|| SysMonitorService.cpuUsage === null
|| SysMonitorService.cpuUsage === 0) {
if (DankgopService.cpuUsage === undefined
|| DankgopService.cpuUsage === null
|| DankgopService.cpuUsage === 0) {
return "--%"
}
return SysMonitorService.cpuUsage.toFixed(0) + "%"
return DankgopService.cpuUsage.toFixed(0) + "%"
}
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium

View File

@@ -23,10 +23,10 @@ Rectangle {
baseColor.a * Theme.widgetTransparency)
}
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["cpu"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["cpu"])
}
MouseArea {
@@ -45,7 +45,7 @@ Rectangle {
Theme.barHeight + Theme.spacingXS,
width, section, currentScreen)
}
SysMonitorService.setSortBy("cpu")
DankgopService.setSortBy("cpu")
if (root.toggleProcessList)
root.toggleProcessList()
}
@@ -59,10 +59,10 @@ Rectangle {
name: "memory"
size: Theme.iconSize - 8
color: {
if (SysMonitorService.cpuTemperature > 85)
if (DankgopService.cpuTemperature > 85)
return Theme.tempDanger
if (SysMonitorService.cpuTemperature > 69)
if (DankgopService.cpuTemperature > 69)
return Theme.tempWarning
return Theme.surfaceText
@@ -72,12 +72,12 @@ Rectangle {
StyledText {
text: {
if (SysMonitorService.cpuTemperature === undefined
|| SysMonitorService.cpuTemperature === null
|| SysMonitorService.cpuTemperature < 0) {
if (DankgopService.cpuTemperature === undefined
|| DankgopService.cpuTemperature === null
|| DankgopService.cpuTemperature < 0) {
return "--°"
}
return Math.round(SysMonitorService.cpuTemperature) + "°"
return Math.round(DankgopService.cpuTemperature) + "°"
}
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium

View File

@@ -37,19 +37,33 @@ Rectangle {
baseColor.a * Theme.widgetTransparency)
}
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["gpu"])
console.log("GpuTemperature widget - pciId:", widgetData ? widgetData.pciId : "no widgetData", "selectedGpuIndex:", widgetData ? widgetData.selectedGpuIndex : "no widgetData")
// Add this widget's PCI ID to the service
if (widgetData && widgetData.pciId) {
console.log("Adding GPU PCI ID to service:", widgetData.pciId)
DankgopService.addGpuPciId(widgetData.pciId)
} else {
console.log("No PCI ID in widget data, starting auto-detection")
// No PCI ID saved, auto-detect and save the first GPU
autoSaveTimer.running = true
}
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["gpu"])
// Remove this widget's PCI ID from the service
if (widgetData && widgetData.pciId) {
DankgopService.removeGpuPciId(widgetData.pciId)
}
}
property real displayTemp: {
if (!SysMonitorService.availableGpus
|| SysMonitorService.availableGpus.length === 0)
if (!DankgopService.availableGpus
|| DankgopService.availableGpus.length === 0)
return 0
if (selectedGpuIndex >= 0
&& selectedGpuIndex < SysMonitorService.availableGpus.length) {
return SysMonitorService.availableGpus[selectedGpuIndex].temperature || 0
&& selectedGpuIndex < DankgopService.availableGpus.length) {
return DankgopService.availableGpus[selectedGpuIndex].temperature || 0
}
return 0
}
@@ -70,7 +84,7 @@ Rectangle {
Theme.barHeight + Theme.spacingXS,
width, section, currentScreen)
}
SysMonitorService.setSortBy("cpu")
DankgopService.setSortBy("cpu")
if (root.toggleProcessList)
root.toggleProcessList()
}
@@ -116,4 +130,57 @@ Rectangle {
easing.type: Theme.standardEasing
}
}
Timer {
id: autoSaveTimer
interval: 100
running: false
onTriggered: {
if (DankgopService.availableGpus && DankgopService.availableGpus.length > 0) {
const firstGpu = DankgopService.availableGpus[0]
if (firstGpu && firstGpu.pciId) {
// Save the first GPU's PCI ID to this widget's settings
updateWidgetPciId(firstGpu.pciId)
DankgopService.addGpuPciId(firstGpu.pciId)
}
}
}
}
function updateWidgetPciId(pciId) {
// Find and update this widget's pciId in the settings
var sections = ["left", "center", "right"]
for (var s = 0; s < sections.length; s++) {
var sectionId = sections[s]
var widgets = []
if (sectionId === "left")
widgets = SettingsData.topBarLeftWidgets.slice()
else if (sectionId === "center")
widgets = SettingsData.topBarCenterWidgets.slice()
else if (sectionId === "right")
widgets = SettingsData.topBarRightWidgets.slice()
for (var i = 0; i < widgets.length; i++) {
var widget = widgets[i]
if (typeof widget === "object" && widget.id === "gpuTemp"
&& (!widget.pciId || widget.pciId === "")) {
widgets[i] = {
"id": widget.id,
"enabled": widget.enabled !== undefined ? widget.enabled : true,
"selectedGpuIndex": 0,
"pciId": pciId
}
if (sectionId === "left")
SettingsData.setTopBarLeftWidgets(widgets)
else if (sectionId === "center")
SettingsData.setTopBarCenterWidgets(widgets)
else if (sectionId === "right")
SettingsData.setTopBarRightWidgets(widgets)
return
}
}
}
}
}

View File

@@ -23,10 +23,10 @@ Rectangle {
baseColor.a * Theme.widgetTransparency)
}
Component.onCompleted: {
SysMonitorService.addRef()
DankgopService.addRef(["memory"])
}
Component.onDestruction: {
SysMonitorService.removeRef()
DankgopService.removeRef(["memory"])
}
MouseArea {
@@ -45,7 +45,7 @@ Rectangle {
Theme.barHeight + Theme.spacingXS,
width, section, currentScreen)
}
SysMonitorService.setSortBy("memory")
DankgopService.setSortBy("memory")
if (root.toggleProcessList)
root.toggleProcessList()
}
@@ -59,10 +59,10 @@ Rectangle {
name: "developer_board"
size: Theme.iconSize - 8
color: {
if (SysMonitorService.memoryUsage > 90)
if (DankgopService.memoryUsage > 90)
return Theme.tempDanger
if (SysMonitorService.memoryUsage > 75)
if (DankgopService.memoryUsage > 75)
return Theme.tempWarning
return Theme.surfaceText
@@ -72,12 +72,12 @@ Rectangle {
StyledText {
text: {
if (SysMonitorService.memoryUsage === undefined
|| SysMonitorService.memoryUsage === null
|| SysMonitorService.memoryUsage === 0) {
if (DankgopService.memoryUsage === undefined
|| DankgopService.memoryUsage === null
|| DankgopService.memoryUsage === 0) {
return "--%"
}
return SysMonitorService.memoryUsage.toFixed(0) + "%"
return DankgopService.memoryUsage.toFixed(0) + "%"
}
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium

View File

@@ -58,9 +58,9 @@ PanelWindow {
return widgetId === "gpuTemp" && widgetEnabled
})
SysMonitorService.gpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled
SysMonitorService.nvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled
SysMonitorService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled
DankgopService.gpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled
DankgopService.nvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled
DankgopService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled
}
Connections {
@@ -238,13 +238,13 @@ PanelWindow {
case "clipboard":
return true
case "cpuUsage":
return true
return DankgopService.dankgopAvailable
case "memUsage":
return true
return DankgopService.dankgopAvailable
case "cpuTemp":
return true
return DankgopService.dankgopAvailable
case "gpuTemp":
return true
return DankgopService.dankgopAvailable
case "notificationButton":
return true
case "battery":