mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
migrate to dankgop monitoring
This commit is contained in:
35
.gitignore
vendored
35
.gitignore
vendored
@@ -63,4 +63,37 @@ CLAUDE-temp.md
|
|||||||
niri-colors.generated.kdl
|
niri-colors.generated.kdl
|
||||||
ghostty-colors.generated.conf
|
ghostty-colors.generated.conf
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Code coverage profiles and other test artifacts
|
||||||
|
*.out
|
||||||
|
coverage.*
|
||||||
|
*.coverprofile
|
||||||
|
profile.cov
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
go.work.sum
|
||||||
|
|
||||||
|
# env file
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Editor/IDE
|
||||||
|
# .idea/
|
||||||
|
# .vscode/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ Singleton {
|
|||||||
property int selectedGpuIndex: 0
|
property int selectedGpuIndex: 0
|
||||||
property bool nvidiaGpuTempEnabled: false
|
property bool nvidiaGpuTempEnabled: false
|
||||||
property bool nonNvidiaGpuTempEnabled: false
|
property bool nonNvidiaGpuTempEnabled: false
|
||||||
|
property var enabledGpuPciIds: []
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadSettings()
|
loadSettings()
|
||||||
@@ -43,6 +44,7 @@ Singleton {
|
|||||||
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0
|
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0
|
||||||
nvidiaGpuTempEnabled = settings.nvidiaGpuTempEnabled !== undefined ? settings.nvidiaGpuTempEnabled : false
|
nvidiaGpuTempEnabled = settings.nvidiaGpuTempEnabled !== undefined ? settings.nvidiaGpuTempEnabled : false
|
||||||
nonNvidiaGpuTempEnabled = settings.nonNvidiaGpuTempEnabled !== undefined ? settings.nonNvidiaGpuTempEnabled : false
|
nonNvidiaGpuTempEnabled = settings.nonNvidiaGpuTempEnabled !== undefined ? settings.nonNvidiaGpuTempEnabled : false
|
||||||
|
enabledGpuPciIds = settings.enabledGpuPciIds !== undefined ? settings.enabledGpuPciIds : []
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
@@ -59,7 +61,8 @@ Singleton {
|
|||||||
"pinnedApps": pinnedApps,
|
"pinnedApps": pinnedApps,
|
||||||
"selectedGpuIndex": selectedGpuIndex,
|
"selectedGpuIndex": selectedGpuIndex,
|
||||||
"nvidiaGpuTempEnabled": nvidiaGpuTempEnabled,
|
"nvidiaGpuTempEnabled": nvidiaGpuTempEnabled,
|
||||||
"nonNvidiaGpuTempEnabled": nonNvidiaGpuTempEnabled
|
"nonNvidiaGpuTempEnabled": nonNvidiaGpuTempEnabled,
|
||||||
|
"enabledGpuPciIds": enabledGpuPciIds
|
||||||
}, null, 2))
|
}, null, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +142,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setEnabledGpuPciIds(pciIds) {
|
||||||
|
enabledGpuPciIds = pciIds
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
FileView {
|
FileView {
|
||||||
id: settingsFile
|
id: settingsFile
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ Singleton {
|
|||||||
property bool showCpuTemp: true
|
property bool showCpuTemp: true
|
||||||
property bool showGpuTemp: true
|
property bool showGpuTemp: true
|
||||||
property int selectedGpuIndex: 0
|
property int selectedGpuIndex: 0
|
||||||
|
property var enabledGpuPciIds: []
|
||||||
property bool showSystemTray: true
|
property bool showSystemTray: true
|
||||||
property bool showClock: true
|
property bool showClock: true
|
||||||
property bool showNotificationButton: true
|
property bool showNotificationButton: true
|
||||||
@@ -187,6 +188,7 @@ Singleton {
|
|||||||
showCpuTemp = settings.showCpuTemp !== undefined ? settings.showCpuTemp : true
|
showCpuTemp = settings.showCpuTemp !== undefined ? settings.showCpuTemp : true
|
||||||
showGpuTemp = settings.showGpuTemp !== undefined ? settings.showGpuTemp : true
|
showGpuTemp = settings.showGpuTemp !== undefined ? settings.showGpuTemp : true
|
||||||
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0
|
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0
|
||||||
|
enabledGpuPciIds = settings.enabledGpuPciIds !== undefined ? settings.enabledGpuPciIds : []
|
||||||
showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true
|
showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true
|
||||||
showClock = settings.showClock !== undefined ? settings.showClock : true
|
showClock = settings.showClock !== undefined ? settings.showClock : true
|
||||||
showNotificationButton = settings.showNotificationButton
|
showNotificationButton = settings.showNotificationButton
|
||||||
@@ -291,6 +293,7 @@ Singleton {
|
|||||||
"showCpuTemp": showCpuTemp,
|
"showCpuTemp": showCpuTemp,
|
||||||
"showGpuTemp": showGpuTemp,
|
"showGpuTemp": showGpuTemp,
|
||||||
"selectedGpuIndex": selectedGpuIndex,
|
"selectedGpuIndex": selectedGpuIndex,
|
||||||
|
"enabledGpuPciIds": enabledGpuPciIds,
|
||||||
"showSystemTray": showSystemTray,
|
"showSystemTray": showSystemTray,
|
||||||
"showClock": showClock,
|
"showClock": showClock,
|
||||||
"showNotificationButton": showNotificationButton,
|
"showNotificationButton": showNotificationButton,
|
||||||
@@ -453,6 +456,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setEnabledGpuPciIds(pciIds) {
|
||||||
|
enabledGpuPciIds = pciIds
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setShowSystemTray(enabled) {
|
function setShowSystemTray(enabled) {
|
||||||
showSystemTray = enabled
|
showSystemTray = enabled
|
||||||
saveSettings()
|
saveSettings()
|
||||||
@@ -508,6 +516,7 @@ Singleton {
|
|||||||
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
||||||
var size = typeof order[i] === "string" ? undefined : order[i].size
|
var size = typeof order[i] === "string" ? undefined : order[i].size
|
||||||
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
||||||
|
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
||||||
|
|
||||||
var item = {
|
var item = {
|
||||||
"widgetId": widgetId,
|
"widgetId": widgetId,
|
||||||
@@ -519,6 +528,9 @@ Singleton {
|
|||||||
if (selectedGpuIndex !== undefined) {
|
if (selectedGpuIndex !== undefined) {
|
||||||
item.selectedGpuIndex = selectedGpuIndex
|
item.selectedGpuIndex = selectedGpuIndex
|
||||||
}
|
}
|
||||||
|
if (pciId !== undefined) {
|
||||||
|
item.pciId = pciId
|
||||||
|
}
|
||||||
listModel.append(item)
|
listModel.append(item)
|
||||||
}
|
}
|
||||||
// Emit signal to notify widgets that data has changed
|
// Emit signal to notify widgets that data has changed
|
||||||
@@ -528,7 +540,7 @@ Singleton {
|
|||||||
function resetTopBarWidgetsToDefault() {
|
function resetTopBarWidgetsToDefault() {
|
||||||
var defaultLeft = ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
var defaultLeft = ["launcherButton", "workspaceSwitcher", "focusedWindow"]
|
||||||
var defaultCenter = ["music", "clock", "weather"]
|
var defaultCenter = ["music", "clock", "weather"]
|
||||||
var defaultRight = ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"]
|
var defaultRight = ["systemTray", "clipboard", "notificationButton", "battery", "controlCenterButton"]
|
||||||
|
|
||||||
topBarLeftWidgets = defaultLeft
|
topBarLeftWidgets = defaultLeft
|
||||||
topBarCenterWidgets = defaultCenter
|
topBarCenterWidgets = defaultCenter
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ DankModal {
|
|||||||
property var tabNames: ["Processes", "Performance", "System"]
|
property var tabNames: ["Processes", "Performance", "System"]
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
|
if (!DankgopService.dankgopAvailable) {
|
||||||
|
console.warn("ProcessListModal: dankgop is not available")
|
||||||
|
return
|
||||||
|
}
|
||||||
processListModal.visible = true
|
processListModal.visible = true
|
||||||
UserInfoService.getUptime()
|
UserInfoService.getUptime()
|
||||||
}
|
}
|
||||||
@@ -29,6 +33,10 @@ DankModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
|
if (!DankgopService.dankgopAvailable) {
|
||||||
|
console.warn("ProcessListModal: dankgop is not available")
|
||||||
|
return
|
||||||
|
}
|
||||||
if (processListModal.visible)
|
if (processListModal.visible)
|
||||||
hide()
|
hide()
|
||||||
else
|
else
|
||||||
@@ -44,9 +52,6 @@ DankModal {
|
|||||||
enableShadow: true
|
enableShadow: true
|
||||||
onBackgroundClicked: hide()
|
onBackgroundClicked: hide()
|
||||||
|
|
||||||
Ref {
|
|
||||||
service: SysMonitorService
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: processesTabComponent
|
id: processesTabComponent
|
||||||
@@ -92,10 +97,52 @@ DankModal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show error message when dankgop is not available
|
||||||
|
Rectangle {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 400
|
||||||
|
height: 200
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.errorBackground
|
||||||
|
border.color: Theme.error
|
||||||
|
border.width: 2
|
||||||
|
visible: !DankgopService.dankgopAvailable
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "error"
|
||||||
|
size: 48
|
||||||
|
color: Theme.error
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "System Monitor Unavailable"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.error
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "The 'dankgop' tool is required for system monitoring.\nPlease install dankgop to use this feature."
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingL
|
anchors.margins: Theme.spacingL
|
||||||
spacing: Theme.spacingL
|
spacing: Theme.spacingL
|
||||||
|
visible: DankgopService.dankgopAvailable
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -233,7 +280,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: currentTab === 0
|
active: processListModal.visible && currentTab === 0
|
||||||
visible: currentTab === 0
|
visible: currentTab === 0
|
||||||
opacity: currentTab === 0 ? 1 : 0
|
opacity: currentTab === 0 ? 1 : 0
|
||||||
sourceComponent: processesTabComponent
|
sourceComponent: processesTabComponent
|
||||||
@@ -251,7 +298,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: currentTab === 1
|
active: processListModal.visible && currentTab === 1
|
||||||
visible: currentTab === 1
|
visible: currentTab === 1
|
||||||
opacity: currentTab === 1 ? 1 : 0
|
opacity: currentTab === 1 ? 1 : 0
|
||||||
sourceComponent: performanceTabComponent
|
sourceComponent: performanceTabComponent
|
||||||
@@ -269,7 +316,7 @@ DankModal {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
active: currentTab === 2
|
active: processListModal.visible && currentTab === 2
|
||||||
visible: currentTab === 2
|
visible: currentTab === 2
|
||||||
opacity: currentTab === 2 ? 1 : 0
|
opacity: currentTab === 2 ? 1 : 0
|
||||||
sourceComponent: systemTabComponent
|
sourceComponent: systemTabComponent
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Rectangle {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
Ref {
|
Ref {
|
||||||
service: SysMonitorService
|
service: DankgopService
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -36,7 +36,7 @@ Rectangle {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.hostname
|
text: DankgopService.hostname
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -45,7 +45,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture
|
text: DankgopService.distribution + " • " + DankgopService.architecture
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
Theme.surfaceText.b, 0.7)
|
Theme.surfaceText.b, 0.7)
|
||||||
@@ -74,7 +74,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Load: " + SysMonitorService.loadAverage
|
text: "Load: " + DankgopService.loadAverage
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -82,8 +82,8 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.processCount + " proc, "
|
text: DankgopService.processCount + " proc, "
|
||||||
+ SysMonitorService.threadCount + " threads"
|
+ DankgopService.threadCount + " threads"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
Theme.surfaceText.b, 0.8)
|
Theme.surfaceText.b, 0.8)
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ Column {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["cpu", "memory", "network", "disk"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["cpu", "memory", "network", "disk"])
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -71,7 +71,7 @@ Column {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.totalCpuUsage.toFixed(1) + "%"
|
text: DankgopService.cpuUsage.toFixed(1) + "%"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
@@ -85,7 +85,7 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.cpuCount + " cores"
|
text: DankgopService.cpuCores + " cores"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -104,7 +104,7 @@ Column {
|
|||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: SysMonitorService.perCoreCpuUsage
|
model: DankgopService.perCoreCpuUsage
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -193,9 +193,9 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.formatSystemMemory(
|
text: DankgopService.formatSystemMemory(
|
||||||
SysMonitorService.usedMemoryKB) + " / " + SysMonitorService.formatSystemMemory(
|
DankgopService.usedMemoryKB) + " / " + DankgopService.formatSystemMemory(
|
||||||
SysMonitorService.totalMemoryKB)
|
DankgopService.totalMemoryKB)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
}
|
}
|
||||||
@@ -218,15 +218,15 @@ Column {
|
|||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: SysMonitorService.totalMemoryKB
|
width: DankgopService.totalMemoryKB
|
||||||
> 0 ? parent.width * (SysMonitorService.usedMemoryKB
|
> 0 ? parent.width * (DankgopService.usedMemoryKB
|
||||||
/ SysMonitorService.totalMemoryKB) : 0
|
/ DankgopService.totalMemoryKB) : 0
|
||||||
height: parent.height
|
height: parent.height
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: {
|
color: {
|
||||||
const usage = SysMonitorService.totalMemoryKB
|
const usage = DankgopService.totalMemoryKB
|
||||||
> 0 ? (SysMonitorService.usedMemoryKB
|
> 0 ? (DankgopService.usedMemoryKB
|
||||||
/ SysMonitorService.totalMemoryKB) : 0
|
/ DankgopService.totalMemoryKB) : 0
|
||||||
if (usage > 0.9)
|
if (usage > 0.9)
|
||||||
return Theme.error
|
return Theme.error
|
||||||
|
|
||||||
@@ -245,9 +245,9 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.totalMemoryKB
|
text: DankgopService.totalMemoryKB
|
||||||
> 0 ? ((SysMonitorService.usedMemoryKB
|
> 0 ? ((DankgopService.usedMemoryKB
|
||||||
/ SysMonitorService.totalMemoryKB) * 100).toFixed(
|
/ DankgopService.totalMemoryKB) * 100).toFixed(
|
||||||
1) + "% used" : "No data"
|
1) + "% used" : "No data"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -272,11 +272,11 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.totalSwapKB
|
text: DankgopService.totalSwapKB
|
||||||
> 0 ? SysMonitorService.formatSystemMemory(
|
> 0 ? DankgopService.formatSystemMemory(
|
||||||
SysMonitorService.usedSwapKB) + " / "
|
DankgopService.usedSwapKB) + " / "
|
||||||
+ SysMonitorService.formatSystemMemory(
|
+ DankgopService.formatSystemMemory(
|
||||||
SysMonitorService.totalSwapKB) : "No swap configured"
|
DankgopService.totalSwapKB) : "No swap configured"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
}
|
}
|
||||||
@@ -299,17 +299,17 @@ Column {
|
|||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: SysMonitorService.totalSwapKB
|
width: DankgopService.totalSwapKB
|
||||||
> 0 ? parent.width * (SysMonitorService.usedSwapKB
|
> 0 ? parent.width * (DankgopService.usedSwapKB
|
||||||
/ SysMonitorService.totalSwapKB) : 0
|
/ DankgopService.totalSwapKB) : 0
|
||||||
height: parent.height
|
height: parent.height
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: {
|
color: {
|
||||||
if (!SysMonitorService.totalSwapKB)
|
if (!DankgopService.totalSwapKB)
|
||||||
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
Theme.surfaceText.b, 0.3)
|
Theme.surfaceText.b, 0.3)
|
||||||
|
|
||||||
const usage = SysMonitorService.usedSwapKB / SysMonitorService.totalSwapKB
|
const usage = DankgopService.usedSwapKB / DankgopService.totalSwapKB
|
||||||
if (usage > 0.9)
|
if (usage > 0.9)
|
||||||
return Theme.error
|
return Theme.error
|
||||||
|
|
||||||
@@ -328,9 +328,9 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.totalSwapKB
|
text: DankgopService.totalSwapKB
|
||||||
> 0 ? ((SysMonitorService.usedSwapKB
|
> 0 ? ((DankgopService.usedSwapKB
|
||||||
/ SysMonitorService.totalSwapKB) * 100).toFixed(
|
/ DankgopService.totalSwapKB) * 100).toFixed(
|
||||||
1) + "% used" : "Not available"
|
1) + "% used" : "Not available"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -381,9 +381,9 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.networkRxRate
|
text: DankgopService.networkRxRate
|
||||||
> 0 ? formatNetworkSpeed(
|
> 0 ? formatNetworkSpeed(
|
||||||
SysMonitorService.networkRxRate) : "0 B/s"
|
DankgopService.networkRxRate) : "0 B/s"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -400,9 +400,9 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.networkTxRate
|
text: DankgopService.networkTxRate
|
||||||
> 0 ? formatNetworkSpeed(
|
> 0 ? formatNetworkSpeed(
|
||||||
SysMonitorService.networkTxRate) : "0 B/s"
|
DankgopService.networkTxRate) : "0 B/s"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -448,7 +448,7 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: formatDiskSpeed(SysMonitorService.diskReadRate)
|
text: formatDiskSpeed(DankgopService.diskReadRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -465,7 +465,7 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: formatDiskSpeed(SysMonitorService.diskWriteRate)
|
text: formatDiskSpeed(DankgopService.diskWriteRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ Rectangle {
|
|||||||
DankIcon {
|
DankIcon {
|
||||||
id: processIcon
|
id: processIcon
|
||||||
|
|
||||||
name: SysMonitorService.getProcessIcon(process ? process.command : "")
|
name: DankgopService.getProcessIcon(process ? process.command : "")
|
||||||
size: Theme.iconSize - 4
|
size: Theme.iconSize - 4
|
||||||
color: {
|
color: {
|
||||||
if (process && process.cpu > 80)
|
if (process && process.cpu > 80)
|
||||||
@@ -110,7 +110,7 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.formatCpuUsage(process ? process.cpu : 0)
|
text: DankgopService.formatCpuUsage(process ? process.cpu : 0)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -149,7 +149,7 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.formatMemoryUsage(
|
text: DankgopService.formatMemoryUsage(
|
||||||
process ? process.memoryKB : 0)
|
process ? process.memoryKB : 0)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ PanelWindow {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
Ref {
|
Ref {
|
||||||
service: SysMonitorService
|
service: DankgopService
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ Column {
|
|||||||
property var contextMenu: null
|
property var contextMenu: null
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["processes"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["processes"])
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -39,9 +39,9 @@ Column {
|
|||||||
text: "Process"
|
text: "Process"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
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
|
color: Theme.surfaceText
|
||||||
opacity: SysMonitorService.sortBy === "name" ? 1 : 0.7
|
opacity: DankgopService.sortBy === "name" ? 1 : 0.7
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ Column {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SysMonitorService.setSortBy("name")
|
DankgopService.setSortBy("name")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,9 +79,9 @@ Column {
|
|||||||
text: "CPU"
|
text: "CPU"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
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
|
color: Theme.surfaceText
|
||||||
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.7
|
opacity: DankgopService.sortBy === "cpu" ? 1 : 0.7
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ Column {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SysMonitorService.setSortBy("cpu")
|
DankgopService.setSortBy("cpu")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +119,9 @@ Column {
|
|||||||
text: "RAM"
|
text: "RAM"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
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
|
color: Theme.surfaceText
|
||||||
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.7
|
opacity: DankgopService.sortBy === "memory" ? 1 : 0.7
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ Column {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SysMonitorService.setSortBy("memory")
|
DankgopService.setSortBy("memory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,9 +159,9 @@ Column {
|
|||||||
text: "PID"
|
text: "PID"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
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
|
color: Theme.surfaceText
|
||||||
opacity: SysMonitorService.sortBy === "pid" ? 1 : 0.7
|
opacity: DankgopService.sortBy === "pid" ? 1 : 0.7
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ Column {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SysMonitorService.setSortBy("pid")
|
DankgopService.setSortBy("pid")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ Column {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.sortDescending ? "↓" : "↑"
|
text: DankgopService.sortDescending ? "↓" : "↑"
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -210,7 +210,7 @@ Column {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
SysMonitorService.toggleSortOrder()
|
// ! TODO - we lost this with dankgop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ Column {
|
|||||||
height: parent.height - columnHeaders.height
|
height: parent.height - columnHeaders.height
|
||||||
clip: true
|
clip: true
|
||||||
spacing: 4
|
spacing: 4
|
||||||
model: SysMonitorService.processes
|
model: DankgopService.processes
|
||||||
|
|
||||||
delegate: ProcessListItem {
|
delegate: ProcessListItem {
|
||||||
process: modelData
|
process: modelData
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ Row {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef();
|
DankgopService.addRef(["cpu", "memory", "system"]);
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef();
|
DankgopService.removeRef(["cpu", "memory", "system"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -19,15 +19,15 @@ Row {
|
|||||||
height: 80
|
height: 80
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.sortBy === "cpu")
|
if (DankgopService.sortBy === "cpu")
|
||||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
||||||
else if (cpuCardMouseArea.containsMouse)
|
else if (cpuCardMouseArea.containsMouse)
|
||||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12);
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08);
|
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.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: SysMonitorService.sortBy === "cpu" ? 2 : 1
|
border.width: DankgopService.sortBy === "cpu" ? 2 : 1
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: cpuCardMouseArea
|
id: cpuCardMouseArea
|
||||||
@@ -35,7 +35,7 @@ Row {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: SysMonitorService.setSortBy("cpu")
|
onClicked: DankgopService.setSortBy("cpu")
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -48,15 +48,19 @@ Row {
|
|||||||
text: "CPU"
|
text: "CPU"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: SysMonitorService.sortBy === "cpu" ? Theme.primary : Theme.secondary
|
color: DankgopService.sortBy === "cpu" ? Theme.primary : Theme.secondary
|
||||||
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.8
|
opacity: DankgopService.sortBy === "cpu" ? 1 : 0.8
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
StyledText {
|
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.pixelSize: Theme.fontSizeLarge
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -73,19 +77,19 @@ Row {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (SysMonitorService.cpuTemperature === undefined || SysMonitorService.cpuTemperature === null || SysMonitorService.cpuTemperature < 0)
|
if (DankgopService.cpuTemperature === undefined || DankgopService.cpuTemperature === null || DankgopService.cpuTemperature <= 0)
|
||||||
return "--°";
|
return "--°";
|
||||||
|
|
||||||
return Math.round(SysMonitorService.cpuTemperature) + "°";
|
return Math.round(DankgopService.cpuTemperature) + "°";
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.cpuTemperature > 80)
|
if (DankgopService.cpuTemperature > 80)
|
||||||
return Theme.error;
|
return Theme.error;
|
||||||
|
|
||||||
if (SysMonitorService.cpuTemperature > 60)
|
if (DankgopService.cpuTemperature > 60)
|
||||||
return Theme.warning;
|
return Theme.warning;
|
||||||
|
|
||||||
return Theme.surfaceText;
|
return Theme.surfaceText;
|
||||||
@@ -96,7 +100,7 @@ Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.cpuCount + " cores"
|
text: DankgopService.cpuCores + " cores"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -126,15 +130,15 @@ Row {
|
|||||||
height: 80
|
height: 80
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.sortBy === "memory")
|
if (DankgopService.sortBy === "memory")
|
||||||
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16);
|
||||||
else if (memoryCardMouseArea.containsMouse)
|
else if (memoryCardMouseArea.containsMouse)
|
||||||
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.12);
|
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.12);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.08);
|
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.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: SysMonitorService.sortBy === "memory" ? 2 : 1
|
border.width: DankgopService.sortBy === "memory" ? 2 : 1
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: memoryCardMouseArea
|
id: memoryCardMouseArea
|
||||||
@@ -142,7 +146,7 @@ Row {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: SysMonitorService.setSortBy("memory")
|
onClicked: DankgopService.setSortBy("memory")
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -155,15 +159,15 @@ Row {
|
|||||||
text: "Memory"
|
text: "Memory"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: SysMonitorService.sortBy === "memory" ? Theme.primary : Theme.secondary
|
color: DankgopService.sortBy === "memory" ? Theme.primary : Theme.secondary
|
||||||
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.8
|
opacity: DankgopService.sortBy === "memory" ? 1 : 0.8
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB)
|
text: DankgopService.formatSystemMemory(DankgopService.usedMemoryKB)
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -176,27 +180,27 @@ Row {
|
|||||||
height: 20
|
height: 20
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: SysMonitorService.totalSwapKB > 0
|
visible: DankgopService.totalSwapKB > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.totalSwapKB > 0 ? SysMonitorService.formatSystemMemory(SysMonitorService.usedSwapKB) : ""
|
text: DankgopService.totalSwapKB > 0 ? DankgopService.formatSystemMemory(DankgopService.usedSwapKB) : ""
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: SysMonitorService.usedSwapKB > 0 ? Theme.warning : Theme.surfaceText
|
color: DankgopService.usedSwapKB > 0 ? Theme.warning : Theme.surfaceText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: SysMonitorService.totalSwapKB > 0
|
visible: DankgopService.totalSwapKB > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (SysMonitorService.totalSwapKB > 0)
|
if (DankgopService.totalSwapKB > 0)
|
||||||
return "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " + swap";
|
return "of " + DankgopService.formatSystemMemory(DankgopService.totalMemoryKB) + " + swap";
|
||||||
|
|
||||||
return "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB);
|
return "of " + DankgopService.formatSystemMemory(DankgopService.totalMemoryKB);
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
@@ -227,40 +231,40 @@ Row {
|
|||||||
height: 80
|
height: 80
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
|
||||||
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);
|
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08);
|
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();
|
var vendor = gpu.vendor.toLowerCase();
|
||||||
if (vendor.includes("nvidia")) {
|
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);
|
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.2);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.12);
|
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.12);
|
||||||
} else if (vendor.includes("amd")) {
|
} 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);
|
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
|
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
|
||||||
} else if (vendor.includes("intel")) {
|
} 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);
|
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.2);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.12);
|
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);
|
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16);
|
||||||
else
|
else
|
||||||
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08);
|
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08);
|
||||||
}
|
}
|
||||||
border.color: {
|
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);
|
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();
|
var vendor = gpu.vendor.toLowerCase();
|
||||||
if (vendor.includes("nvidia"))
|
if (vendor.includes("nvidia"))
|
||||||
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3);
|
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3);
|
||||||
@@ -278,11 +282,11 @@ Row {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
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) => {
|
onClicked: (mouse) => {
|
||||||
if (mouse.button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
if (SysMonitorService.availableGpus.length > 1) {
|
if (DankgopService.availableGpus.length > 1) {
|
||||||
var nextIndex = (SessionData.selectedGpuIndex + 1) % SysMonitorService.availableGpus.length;
|
var nextIndex = (SessionData.selectedGpuIndex + 1) % DankgopService.availableGpus.length;
|
||||||
SessionData.setSelectedGpuIndex(nextIndex);
|
SessionData.setSelectedGpuIndex(nextIndex);
|
||||||
}
|
}
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
@@ -307,12 +311,14 @@ Row {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
|
||||||
return "No GPU";
|
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 temp = gpu.temperature;
|
||||||
var hasTemp = temp !== undefined && temp !== null && temp !== 0;
|
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0;
|
||||||
if (hasTemp)
|
if (hasTemp)
|
||||||
return Math.round(temp) + "°";
|
return Math.round(temp) + "°";
|
||||||
else
|
else
|
||||||
@@ -322,15 +328,16 @@ Row {
|
|||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: {
|
color: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
|
||||||
return Theme.surfaceText;
|
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;
|
var temp = gpu.temperature || 0;
|
||||||
if (temp > 80)
|
if (tempEnabled && temp > 80)
|
||||||
return Theme.error;
|
return Theme.error;
|
||||||
|
|
||||||
if (temp > 60)
|
if (tempEnabled && temp > 60)
|
||||||
return Theme.warning;
|
return Theme.warning;
|
||||||
|
|
||||||
return Theme.surfaceText;
|
return Theme.surfaceText;
|
||||||
@@ -339,12 +346,13 @@ Row {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0)
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0)
|
||||||
return "No GPUs detected";
|
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 temp = gpu.temperature;
|
||||||
var hasTemp = temp !== undefined && temp !== null && temp !== 0;
|
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0;
|
||||||
if (hasTemp)
|
if (hasTemp)
|
||||||
return gpu.vendor + " " + gpu.displayName;
|
return gpu.vendor + " " + gpu.displayName;
|
||||||
else
|
else
|
||||||
@@ -365,41 +373,40 @@ Row {
|
|||||||
id: gpuContextMenu
|
id: gpuContextMenu
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: {
|
text: "Enable GPU Temperature"
|
||||||
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"
|
|
||||||
}
|
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: {
|
checked: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
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 isNvidia = gpu.vendor.toLowerCase().includes("nvidia")
|
if (!gpu.pciId) return false
|
||||||
return isNvidia ? SysMonitorService.nvidiaGpuTempEnabled : SysMonitorService.nonNvidiaGpuTempEnabled
|
|
||||||
|
return SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1 : false
|
||||||
}
|
}
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
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 isNvidia = gpu.vendor.toLowerCase().includes("nvidia")
|
if (!gpu.pciId) return
|
||||||
|
|
||||||
if (isNvidia) {
|
var enabledIds = SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.slice() : []
|
||||||
SessionData.setNvidiaGpuTempEnabled(checked)
|
var index = enabledIds.indexOf(gpu.pciId)
|
||||||
} else {
|
|
||||||
SessionData.setNonNvidiaGpuTempEnabled(checked)
|
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 {
|
Behavior on color {
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ ScrollView {
|
|||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["system", "hardware", "diskmounts"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["system", "hardware", "diskmounts"])
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -52,7 +52,7 @@ ScrollView {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.hostname
|
text: DankgopService.hostname
|
||||||
font.pixelSize: Theme.fontSizeXLarge
|
font.pixelSize: Theme.fontSizeXLarge
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Light
|
font.weight: Font.Light
|
||||||
@@ -61,8 +61,8 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture
|
text: DankgopService.distribution + " • " + DankgopService.architecture
|
||||||
+ " • " + SysMonitorService.kernelVersion
|
+ " • " + DankgopService.kernelVersion
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -71,7 +71,7 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Up " + UserInfoService.uptime + " • Boot: " + SysMonitorService.bootTime
|
text: "Up " + UserInfoService.uptime + " • Boot: " + DankgopService.bootTime
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -80,9 +80,9 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Load: " + SysMonitorService.loadAverage + " • "
|
text: "Load: " + DankgopService.loadAverage + " • "
|
||||||
+ SysMonitorService.processCount + " processes, "
|
+ DankgopService.processCount + " processes, "
|
||||||
+ SysMonitorService.threadCount + " threads"
|
+ DankgopService.threadCount + " threads"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -144,7 +144,7 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.cpuModel
|
text: DankgopService.cpuModel
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
@@ -157,7 +157,7 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.motherboard
|
text: DankgopService.motherboard
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -170,7 +170,7 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "BIOS " + SysMonitorService.biosVersion
|
text: "BIOS " + DankgopService.biosVersion
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -181,8 +181,8 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: SysMonitorService.formatSystemMemory(
|
text: DankgopService.formatSystemMemory(
|
||||||
SysMonitorService.totalMemoryKB) + " RAM"
|
DankgopService.totalMemoryKB) + " RAM"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
@@ -206,11 +206,11 @@ ScrollView {
|
|||||||
Theme.surfaceContainerHigh.g,
|
Theme.surfaceContainerHigh.g,
|
||||||
Theme.surfaceContainerHigh.b, 0.6)
|
Theme.surfaceContainerHigh.b, 0.6)
|
||||||
|
|
||||||
if (!SysMonitorService.availableGpus || SysMonitorService.availableGpus.length === 0) {
|
if (!DankgopService.availableGpus || DankgopService.availableGpus.length === 0) {
|
||||||
return gpuCardMouseArea.containsMouse && SysMonitorService.availableGpus.length > 1 ? hoverColor : baseColor
|
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 vendor = gpu.fullName.split(' ')[0].toLowerCase()
|
||||||
var tintColor
|
var tintColor
|
||||||
|
|
||||||
@@ -221,10 +221,10 @@ ScrollView {
|
|||||||
} else if (vendor.includes("intel")) {
|
} else if (vendor.includes("intel")) {
|
||||||
tintColor = Theme.info
|
tintColor = Theme.info
|
||||||
} else {
|
} 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,
|
return Qt.rgba((hoverColor.r + tintColor.r * 0.1) / 1.1,
|
||||||
(hoverColor.g + tintColor.g * 0.1) / 1.1,
|
(hoverColor.g + tintColor.g * 0.1) / 1.1,
|
||||||
(hoverColor.b + tintColor.b * 0.1) / 1.1, 0.6)
|
(hoverColor.b + tintColor.b * 0.1) / 1.1, 0.6)
|
||||||
@@ -236,11 +236,11 @@ ScrollView {
|
|||||||
}
|
}
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: {
|
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)
|
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()
|
var vendor = gpu.fullName.split(' ')[0].toLowerCase()
|
||||||
|
|
||||||
if (vendor.includes("nvidia")) {
|
if (vendor.includes("nvidia")) {
|
||||||
@@ -258,12 +258,12 @@ ScrollView {
|
|||||||
id: gpuCardMouseArea
|
id: gpuCardMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: SysMonitorService.availableGpus.length
|
cursorShape: DankgopService.availableGpus.length
|
||||||
> 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
|
> 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (SysMonitorService.availableGpus.length > 1) {
|
if (DankgopService.availableGpus.length > 1) {
|
||||||
var nextIndex = (SessionData.selectedGpuIndex + 1)
|
var nextIndex = (SessionData.selectedGpuIndex + 1)
|
||||||
% SysMonitorService.availableGpus.length
|
% DankgopService.availableGpus.length
|
||||||
SessionData.setSelectedGpuIndex(nextIndex)
|
SessionData.setSelectedGpuIndex(nextIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,13 +301,13 @@ ScrollView {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| DankgopService.availableGpus.length === 0) {
|
||||||
return "No GPUs detected"
|
return "No GPUs detected"
|
||||||
}
|
}
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = DankgopService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length
|
DankgopService.availableGpus.length
|
||||||
- 1)]
|
- 1)]
|
||||||
return gpu.fullName
|
return gpu.fullName
|
||||||
}
|
}
|
||||||
@@ -323,13 +323,13 @@ ScrollView {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| DankgopService.availableGpus.length === 0) {
|
||||||
return "Device: N/A"
|
return "Device: N/A"
|
||||||
}
|
}
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = DankgopService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length
|
DankgopService.availableGpus.length
|
||||||
- 1)]
|
- 1)]
|
||||||
return "Device: " + gpu.pciId
|
return "Device: " + gpu.pciId
|
||||||
}
|
}
|
||||||
@@ -345,13 +345,13 @@ ScrollView {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| DankgopService.availableGpus.length === 0) {
|
||||||
return "Driver: N/A"
|
return "Driver: N/A"
|
||||||
}
|
}
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = DankgopService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length
|
DankgopService.availableGpus.length
|
||||||
- 1)]
|
- 1)]
|
||||||
return "Driver: " + gpu.driver
|
return "Driver: " + gpu.driver
|
||||||
}
|
}
|
||||||
@@ -366,13 +366,13 @@ ScrollView {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| DankgopService.availableGpus.length === 0) {
|
||||||
return "Temp: --°"
|
return "Temp: --°"
|
||||||
}
|
}
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = DankgopService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length
|
DankgopService.availableGpus.length
|
||||||
- 1)]
|
- 1)]
|
||||||
var temp = gpu.temperature
|
var temp = gpu.temperature
|
||||||
return "Temp: " + ((temp === undefined || temp === null
|
return "Temp: " + ((temp === undefined || temp === null
|
||||||
@@ -382,14 +382,14 @@ ScrollView {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: {
|
color: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| DankgopService.availableGpus.length === 0) {
|
||||||
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
|
||||||
Theme.surfaceText.b, 0.7)
|
Theme.surfaceText.b, 0.7)
|
||||||
}
|
}
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = DankgopService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length
|
DankgopService.availableGpus.length
|
||||||
- 1)]
|
- 1)]
|
||||||
var temp = gpu.temperature || 0
|
var temp = gpu.temperature || 0
|
||||||
if (temp > 80)
|
if (temp > 80)
|
||||||
@@ -532,7 +532,7 @@ ScrollView {
|
|||||||
Repeater {
|
Repeater {
|
||||||
id: diskMountRepeater
|
id: diskMountRepeater
|
||||||
|
|
||||||
model: SysMonitorService.diskMounts
|
model: DankgopService.diskMounts
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -53,26 +54,29 @@ Item {
|
|||||||
"text": "CPU Usage",
|
"text": "CPU Usage",
|
||||||
"description": "CPU usage indicator",
|
"description": "CPU usage indicator",
|
||||||
"icon": "memory",
|
"icon": "memory",
|
||||||
"enabled": true
|
"enabled": DankgopService.dankgopAvailable,
|
||||||
|
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
|
||||||
}, {
|
}, {
|
||||||
"id": "memUsage",
|
"id": "memUsage",
|
||||||
"text": "Memory Usage",
|
"text": "Memory Usage",
|
||||||
"description": "Memory usage indicator",
|
"description": "Memory usage indicator",
|
||||||
"icon": "storage",
|
"icon": "storage",
|
||||||
"enabled": true
|
"enabled": DankgopService.dankgopAvailable,
|
||||||
|
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
|
||||||
}, {
|
}, {
|
||||||
"id": "cpuTemp",
|
"id": "cpuTemp",
|
||||||
"text": "CPU Temperature",
|
"text": "CPU Temperature",
|
||||||
"description": "CPU temperature display",
|
"description": "CPU temperature display",
|
||||||
"icon": "device_thermostat",
|
"icon": "device_thermostat",
|
||||||
"enabled": true
|
"enabled": DankgopService.dankgopAvailable,
|
||||||
|
"warning": !DankgopService.dankgopAvailable ? "Requires 'dankgop' tool" : undefined
|
||||||
}, {
|
}, {
|
||||||
"id": "gpuTemp",
|
"id": "gpuTemp",
|
||||||
"text": "GPU Temperature",
|
"text": "GPU Temperature",
|
||||||
"description": "GPU temperature display",
|
"description": "GPU temperature display",
|
||||||
"icon": "auto_awesome_mosaic",
|
"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.",
|
"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": true
|
"enabled": DankgopService.dankgopAvailable
|
||||||
}, {
|
}, {
|
||||||
"id": "systemTray",
|
"id": "systemTray",
|
||||||
"text": "System Tray",
|
"text": "System Tray",
|
||||||
@@ -145,12 +149,6 @@ Item {
|
|||||||
}, {
|
}, {
|
||||||
"id": "clipboard",
|
"id": "clipboard",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}, {
|
|
||||||
"id": "cpuUsage",
|
|
||||||
"enabled": true
|
|
||||||
}, {
|
|
||||||
"id": "memUsage",
|
|
||||||
"enabled": true
|
|
||||||
}, {
|
}, {
|
||||||
"id": "notificationButton",
|
"id": "notificationButton",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
@@ -169,8 +167,10 @@ Item {
|
|||||||
}
|
}
|
||||||
if (widgetId === "spacer")
|
if (widgetId === "spacer")
|
||||||
widgetObj.size = 20
|
widgetObj.size = 20
|
||||||
if (widgetId === "gpuTemp")
|
if (widgetId === "gpuTemp") {
|
||||||
widgetObj.selectedGpuIndex = 0
|
widgetObj.selectedGpuIndex = 0
|
||||||
|
widgetObj.pciId = ""
|
||||||
|
}
|
||||||
|
|
||||||
var widgets = []
|
var widgets = []
|
||||||
if (targetSection === "left") {
|
if (targetSection === "left") {
|
||||||
@@ -223,14 +223,22 @@ Item {
|
|||||||
var widget = widgets[i]
|
var widget = widgets[i]
|
||||||
var widgetId = typeof widget === "string" ? widget : widget.id
|
var widgetId = typeof widget === "string" ? widget : widget.id
|
||||||
if (widgetId === itemId) {
|
if (widgetId === itemId) {
|
||||||
widgets[i] = typeof widget === "string" ? {
|
if (typeof widget === "string") {
|
||||||
"id": widget,
|
widgets[i] = {
|
||||||
"enabled": enabled
|
"id": widget,
|
||||||
} : {
|
"enabled": enabled
|
||||||
"id": widget.id,
|
}
|
||||||
"enabled": enabled,
|
} else {
|
||||||
"size": widget.size,
|
var newWidget = {
|
||||||
"selectedGpuIndex": widget.selectedGpuIndex
|
"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
|
break
|
||||||
}
|
}
|
||||||
@@ -264,15 +272,21 @@ Item {
|
|||||||
var widget = widgets[i]
|
var widget = widgets[i]
|
||||||
var widgetId = typeof widget === "string" ? widget : widget.id
|
var widgetId = typeof widget === "string" ? widget : widget.id
|
||||||
if (widgetId === itemId && widgetId === "spacer") {
|
if (widgetId === itemId && widgetId === "spacer") {
|
||||||
widgets[i] = typeof widget === "string" ? {
|
if (typeof widget === "string") {
|
||||||
"id": widget,
|
widgets[i] = {
|
||||||
"enabled": true,
|
"id": widget,
|
||||||
"size": newSize
|
"enabled": true,
|
||||||
} : {
|
"size": newSize
|
||||||
"id": widget.id,
|
}
|
||||||
"enabled": widget.enabled,
|
} else {
|
||||||
"size": newSize,
|
var newWidget = {
|
||||||
"selectedGpuIndex": widget.selectedGpuIndex
|
"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
|
break
|
||||||
}
|
}
|
||||||
@@ -296,15 +310,22 @@ Item {
|
|||||||
|
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
||||||
var widget = widgets[widgetIndex]
|
var widget = widgets[widgetIndex]
|
||||||
widgets[widgetIndex] = typeof widget === "string" ? {
|
if (typeof widget === "string") {
|
||||||
"id": widget,
|
widgets[widgetIndex] = {
|
||||||
"enabled": true,
|
"id": widget,
|
||||||
"selectedGpuIndex": selectedGpuIndex
|
"enabled": true,
|
||||||
} : {
|
"selectedGpuIndex": selectedGpuIndex,
|
||||||
"id": widget.id,
|
"pciId": DankgopService.availableGpus && DankgopService.availableGpus.length > selectedGpuIndex ? DankgopService.availableGpus[selectedGpuIndex].pciId : ""
|
||||||
"enabled": widget.enabled,
|
}
|
||||||
"size": widget.size,
|
} else {
|
||||||
"selectedGpuIndex": selectedGpuIndex
|
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 widgetSize = typeof widget === "string" ? undefined : widget.size
|
||||||
var widgetSelectedGpuIndex = typeof widget
|
var widgetSelectedGpuIndex = typeof widget
|
||||||
=== "string" ? undefined : widget.selectedGpuIndex
|
=== "string" ? undefined : widget.selectedGpuIndex
|
||||||
|
var widgetPciId = typeof widget
|
||||||
|
=== "string" ? undefined : widget.pciId
|
||||||
var widgetDef = baseWidgetDefinitions.find(w => {
|
var widgetDef = baseWidgetDefinitions.find(w => {
|
||||||
return w.id === widgetId
|
return w.id === widgetId
|
||||||
})
|
})
|
||||||
@@ -341,6 +364,8 @@ Item {
|
|||||||
item.size = widgetSize
|
item.size = widgetSize
|
||||||
if (widgetSelectedGpuIndex !== undefined)
|
if (widgetSelectedGpuIndex !== undefined)
|
||||||
item.selectedGpuIndex = widgetSelectedGpuIndex
|
item.selectedGpuIndex = widgetSelectedGpuIndex
|
||||||
|
if (widgetPciId !== undefined)
|
||||||
|
item.pciId = widgetPciId
|
||||||
|
|
||||||
widgets.push(item)
|
widgets.push(item)
|
||||||
}
|
}
|
||||||
@@ -359,8 +384,9 @@ Item {
|
|||||||
|
|
||||||
if (!SettingsData.topBarRightWidgets
|
if (!SettingsData.topBarRightWidgets
|
||||||
|| SettingsData.topBarRightWidgets.length === 0)
|
|| SettingsData.topBarRightWidgets.length === 0)
|
||||||
SettingsData.setTopBarRightWidgets(
|
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
||||||
defaultRightWidgets)["left", "center", "right"].forEach(sectionId => {
|
|
||||||
|
["left", "center", "right"].forEach(sectionId => {
|
||||||
var widgets = []
|
var widgets = []
|
||||||
if (sectionId === "left")
|
if (sectionId === "left")
|
||||||
widgets = SettingsData.topBarLeftWidgets.slice()
|
widgets = SettingsData.topBarLeftWidgets.slice()
|
||||||
|
|||||||
@@ -148,29 +148,23 @@ Column {
|
|||||||
currentValue: {
|
currentValue: {
|
||||||
var selectedIndex = modelData.selectedGpuIndex
|
var selectedIndex = modelData.selectedGpuIndex
|
||||||
!== undefined ? modelData.selectedGpuIndex : 0
|
!== undefined ? modelData.selectedGpuIndex : 0
|
||||||
if (SysMonitorService.availableGpus
|
if (DankgopService.availableGpus
|
||||||
&& SysMonitorService.availableGpus.length > selectedIndex
|
&& DankgopService.availableGpus.length > selectedIndex
|
||||||
&& selectedIndex >= 0) {
|
&& selectedIndex >= 0) {
|
||||||
var gpu = SysMonitorService.availableGpus[selectedIndex]
|
var gpu = DankgopService.availableGpus[selectedIndex]
|
||||||
return gpu.driver.toUpperCase() + " (" + Math.round(
|
return gpu.driver.toUpperCase()
|
||||||
gpu.temperature || 0) + "°C)"
|
|
||||||
}
|
}
|
||||||
return SysMonitorService.availableGpus
|
return DankgopService.availableGpus
|
||||||
&& SysMonitorService.availableGpus.length
|
&& DankgopService.availableGpus.length
|
||||||
> 0 ? SysMonitorService.availableGpus[0].driver.toUpperCase(
|
> 0 ? DankgopService.availableGpus[0].driver.toUpperCase() : ""
|
||||||
) + " (" + Math.round(
|
|
||||||
SysMonitorService.availableGpus[0].temperature
|
|
||||||
|| 0) + "°C)" : ""
|
|
||||||
}
|
}
|
||||||
options: {
|
options: {
|
||||||
var gpuOptions = []
|
var gpuOptions = []
|
||||||
if (SysMonitorService.availableGpus
|
if (DankgopService.availableGpus
|
||||||
&& SysMonitorService.availableGpus.length > 0) {
|
&& DankgopService.availableGpus.length > 0) {
|
||||||
for (var i = 0; i < SysMonitorService.availableGpus.length; i++) {
|
for (var i = 0; i < DankgopService.availableGpus.length; i++) {
|
||||||
var gpu = SysMonitorService.availableGpus[i]
|
var gpu = DankgopService.availableGpus[i]
|
||||||
gpuOptions.push(gpu.driver.toUpperCase(
|
gpuOptions.push(gpu.driver.toUpperCase())
|
||||||
) + " (" + Math.round(gpu.temperature
|
|
||||||
|| 0) + "°C)")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gpuOptions
|
return gpuOptions
|
||||||
@@ -188,7 +182,7 @@ Column {
|
|||||||
Item {
|
Item {
|
||||||
width: 32
|
width: 32
|
||||||
height: 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 {
|
DankIcon {
|
||||||
name: "warning"
|
name: "warning"
|
||||||
@@ -207,13 +201,16 @@ Column {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: warningTooltip
|
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
|
radius: Theme.cornerRadius
|
||||||
color: Theme.surfaceContainer
|
color: Theme.surfaceContainer
|
||||||
border.color: Theme.outline
|
border.color: Theme.outline
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: warningArea.containsMouse
|
visible: warningArea.containsMouse && warningText !== ""
|
||||||
opacity: visible ? 1 : 0
|
opacity: visible ? 1 : 0
|
||||||
x: -width - Theme.spacingS
|
x: -width - Theme.spacingS
|
||||||
y: (parent.height - height) / 2
|
y: (parent.height - height) / 2
|
||||||
@@ -222,10 +219,11 @@ Column {
|
|||||||
StyledText {
|
StyledText {
|
||||||
id: warningTooltipText
|
id: warningTooltipText
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: modelData.warning || "Warning"
|
anchors.margins: Theme.spacingS
|
||||||
|
text: warningTooltip.warningText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
width: 300
|
width: Math.min(250, implicitWidth)
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ Rectangle {
|
|||||||
baseColor.a * Theme.widgetTransparency)
|
baseColor.a * Theme.widgetTransparency)
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["cpu"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["cpu"])
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -45,7 +45,7 @@ Rectangle {
|
|||||||
Theme.barHeight + Theme.spacingXS,
|
Theme.barHeight + Theme.spacingXS,
|
||||||
width, section, currentScreen)
|
width, section, currentScreen)
|
||||||
}
|
}
|
||||||
SysMonitorService.setSortBy("cpu")
|
DankgopService.setSortBy("cpu")
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList()
|
root.toggleProcessList()
|
||||||
}
|
}
|
||||||
@@ -59,10 +59,10 @@ Rectangle {
|
|||||||
name: "memory"
|
name: "memory"
|
||||||
size: Theme.iconSize - 8
|
size: Theme.iconSize - 8
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.cpuUsage > 80)
|
if (DankgopService.cpuUsage > 80)
|
||||||
return Theme.tempDanger
|
return Theme.tempDanger
|
||||||
|
|
||||||
if (SysMonitorService.cpuUsage > 60)
|
if (DankgopService.cpuUsage > 60)
|
||||||
return Theme.tempWarning
|
return Theme.tempWarning
|
||||||
|
|
||||||
return Theme.surfaceText
|
return Theme.surfaceText
|
||||||
@@ -72,12 +72,12 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (SysMonitorService.cpuUsage === undefined
|
if (DankgopService.cpuUsage === undefined
|
||||||
|| SysMonitorService.cpuUsage === null
|
|| DankgopService.cpuUsage === null
|
||||||
|| SysMonitorService.cpuUsage === 0) {
|
|| DankgopService.cpuUsage === 0) {
|
||||||
return "--%"
|
return "--%"
|
||||||
}
|
}
|
||||||
return SysMonitorService.cpuUsage.toFixed(0) + "%"
|
return DankgopService.cpuUsage.toFixed(0) + "%"
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ Rectangle {
|
|||||||
baseColor.a * Theme.widgetTransparency)
|
baseColor.a * Theme.widgetTransparency)
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["cpu"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["cpu"])
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -45,7 +45,7 @@ Rectangle {
|
|||||||
Theme.barHeight + Theme.spacingXS,
|
Theme.barHeight + Theme.spacingXS,
|
||||||
width, section, currentScreen)
|
width, section, currentScreen)
|
||||||
}
|
}
|
||||||
SysMonitorService.setSortBy("cpu")
|
DankgopService.setSortBy("cpu")
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList()
|
root.toggleProcessList()
|
||||||
}
|
}
|
||||||
@@ -59,10 +59,10 @@ Rectangle {
|
|||||||
name: "memory"
|
name: "memory"
|
||||||
size: Theme.iconSize - 8
|
size: Theme.iconSize - 8
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.cpuTemperature > 85)
|
if (DankgopService.cpuTemperature > 85)
|
||||||
return Theme.tempDanger
|
return Theme.tempDanger
|
||||||
|
|
||||||
if (SysMonitorService.cpuTemperature > 69)
|
if (DankgopService.cpuTemperature > 69)
|
||||||
return Theme.tempWarning
|
return Theme.tempWarning
|
||||||
|
|
||||||
return Theme.surfaceText
|
return Theme.surfaceText
|
||||||
@@ -72,12 +72,12 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (SysMonitorService.cpuTemperature === undefined
|
if (DankgopService.cpuTemperature === undefined
|
||||||
|| SysMonitorService.cpuTemperature === null
|
|| DankgopService.cpuTemperature === null
|
||||||
|| SysMonitorService.cpuTemperature < 0) {
|
|| DankgopService.cpuTemperature < 0) {
|
||||||
return "--°"
|
return "--°"
|
||||||
}
|
}
|
||||||
return Math.round(SysMonitorService.cpuTemperature) + "°"
|
return Math.round(DankgopService.cpuTemperature) + "°"
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|||||||
@@ -37,19 +37,33 @@ Rectangle {
|
|||||||
baseColor.a * Theme.widgetTransparency)
|
baseColor.a * Theme.widgetTransparency)
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
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: {
|
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: {
|
property real displayTemp: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!DankgopService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0)
|
|| DankgopService.availableGpus.length === 0)
|
||||||
return 0
|
return 0
|
||||||
if (selectedGpuIndex >= 0
|
if (selectedGpuIndex >= 0
|
||||||
&& selectedGpuIndex < SysMonitorService.availableGpus.length) {
|
&& selectedGpuIndex < DankgopService.availableGpus.length) {
|
||||||
return SysMonitorService.availableGpus[selectedGpuIndex].temperature || 0
|
return DankgopService.availableGpus[selectedGpuIndex].temperature || 0
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -70,7 +84,7 @@ Rectangle {
|
|||||||
Theme.barHeight + Theme.spacingXS,
|
Theme.barHeight + Theme.spacingXS,
|
||||||
width, section, currentScreen)
|
width, section, currentScreen)
|
||||||
}
|
}
|
||||||
SysMonitorService.setSortBy("cpu")
|
DankgopService.setSortBy("cpu")
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList()
|
root.toggleProcessList()
|
||||||
}
|
}
|
||||||
@@ -116,4 +130,57 @@ Rectangle {
|
|||||||
easing.type: Theme.standardEasing
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ Rectangle {
|
|||||||
baseColor.a * Theme.widgetTransparency)
|
baseColor.a * Theme.widgetTransparency)
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
SysMonitorService.addRef()
|
DankgopService.addRef(["memory"])
|
||||||
}
|
}
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
SysMonitorService.removeRef()
|
DankgopService.removeRef(["memory"])
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -45,7 +45,7 @@ Rectangle {
|
|||||||
Theme.barHeight + Theme.spacingXS,
|
Theme.barHeight + Theme.spacingXS,
|
||||||
width, section, currentScreen)
|
width, section, currentScreen)
|
||||||
}
|
}
|
||||||
SysMonitorService.setSortBy("memory")
|
DankgopService.setSortBy("memory")
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList()
|
root.toggleProcessList()
|
||||||
}
|
}
|
||||||
@@ -59,10 +59,10 @@ Rectangle {
|
|||||||
name: "developer_board"
|
name: "developer_board"
|
||||||
size: Theme.iconSize - 8
|
size: Theme.iconSize - 8
|
||||||
color: {
|
color: {
|
||||||
if (SysMonitorService.memoryUsage > 90)
|
if (DankgopService.memoryUsage > 90)
|
||||||
return Theme.tempDanger
|
return Theme.tempDanger
|
||||||
|
|
||||||
if (SysMonitorService.memoryUsage > 75)
|
if (DankgopService.memoryUsage > 75)
|
||||||
return Theme.tempWarning
|
return Theme.tempWarning
|
||||||
|
|
||||||
return Theme.surfaceText
|
return Theme.surfaceText
|
||||||
@@ -72,12 +72,12 @@ Rectangle {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: {
|
text: {
|
||||||
if (SysMonitorService.memoryUsage === undefined
|
if (DankgopService.memoryUsage === undefined
|
||||||
|| SysMonitorService.memoryUsage === null
|
|| DankgopService.memoryUsage === null
|
||||||
|| SysMonitorService.memoryUsage === 0) {
|
|| DankgopService.memoryUsage === 0) {
|
||||||
return "--%"
|
return "--%"
|
||||||
}
|
}
|
||||||
return SysMonitorService.memoryUsage.toFixed(0) + "%"
|
return DankgopService.memoryUsage.toFixed(0) + "%"
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ PanelWindow {
|
|||||||
return widgetId === "gpuTemp" && widgetEnabled
|
return widgetId === "gpuTemp" && widgetEnabled
|
||||||
})
|
})
|
||||||
|
|
||||||
SysMonitorService.gpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled
|
DankgopService.gpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled
|
||||||
SysMonitorService.nvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled
|
DankgopService.nvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled
|
||||||
SysMonitorService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled
|
DankgopService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -238,13 +238,13 @@ PanelWindow {
|
|||||||
case "clipboard":
|
case "clipboard":
|
||||||
return true
|
return true
|
||||||
case "cpuUsage":
|
case "cpuUsage":
|
||||||
return true
|
return DankgopService.dankgopAvailable
|
||||||
case "memUsage":
|
case "memUsage":
|
||||||
return true
|
return DankgopService.dankgopAvailable
|
||||||
case "cpuTemp":
|
case "cpuTemp":
|
||||||
return true
|
return DankgopService.dankgopAvailable
|
||||||
case "gpuTemp":
|
case "gpuTemp":
|
||||||
return true
|
return DankgopService.dankgopAvailable
|
||||||
case "notificationButton":
|
case "notificationButton":
|
||||||
return true
|
return true
|
||||||
case "battery":
|
case "battery":
|
||||||
|
|||||||
@@ -156,10 +156,16 @@ rm /tmp/FiraCode.zip && fc-cache -f
|
|||||||
|
|
||||||
**Enhanced Functionality:**
|
**Enhanced Functionality:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dankgop on any distro (requires go 1.23+):
|
||||||
|
git clone https://github.com/AvengeMedia/dankgop.git && cd dankgop
|
||||||
|
make && sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Arch Linux
|
# Arch Linux
|
||||||
pacman -S cava wl-clipboard cliphist ddcutil brightnessctl
|
pacman -S cava wl-clipboard cliphist ddcutil brightnessctl
|
||||||
paru -S matugen
|
paru -S matugen dankgop-git
|
||||||
|
|
||||||
# Fedora
|
# Fedora
|
||||||
sudo dnf install cava wl-clipboard ddcutil brightnessctl
|
sudo dnf install cava wl-clipboard ddcutil brightnessctl
|
||||||
@@ -169,6 +175,7 @@ sudo dnf copr enable heus-sueh/packages && sudo dnf install matugen
|
|||||||
|
|
||||||
**What you get:**
|
**What you get:**
|
||||||
|
|
||||||
|
- `dankgop-git`: Ability to have system resource widgets, process list modal, and temperature monitoring.
|
||||||
- `matugen`: Wallpaper-based dynamic theming
|
- `matugen`: Wallpaper-based dynamic theming
|
||||||
- `ddcutil`: External monitor brightness control
|
- `ddcutil`: External monitor brightness control
|
||||||
- `brightnessctl`: Laptop display brightness
|
- `brightnessctl`: Laptop display brightness
|
||||||
|
|||||||
562
Services/DankgopService.qml
Normal file
562
Services/DankgopService.qml
Normal file
@@ -0,0 +1,562 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import qs.Common
|
||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property int refCount: 0
|
||||||
|
property int updateInterval: refCount > 0 ? 3000 : 30000
|
||||||
|
property bool isUpdating: false
|
||||||
|
property bool dankgopAvailable: false
|
||||||
|
|
||||||
|
property var moduleRefCounts: ({})
|
||||||
|
property var enabledModules: []
|
||||||
|
property var gpuPciIds: []
|
||||||
|
property var gpuPciIdRefCounts: ({})
|
||||||
|
property int processLimit: 20
|
||||||
|
property string processSort: "cpu"
|
||||||
|
property bool noCpu: false
|
||||||
|
|
||||||
|
property real cpuUsage: 0
|
||||||
|
property real cpuFrequency: 0
|
||||||
|
property real cpuTemperature: 0
|
||||||
|
property int cpuCores: 1
|
||||||
|
property string cpuModel: ""
|
||||||
|
property var perCoreCpuUsage: []
|
||||||
|
|
||||||
|
property real memoryUsage: 0
|
||||||
|
property real totalMemoryMB: 0
|
||||||
|
property real usedMemoryMB: 0
|
||||||
|
property real freeMemoryMB: 0
|
||||||
|
property real availableMemoryMB: 0
|
||||||
|
property int totalMemoryKB: 0
|
||||||
|
property int usedMemoryKB: 0
|
||||||
|
property int totalSwapKB: 0
|
||||||
|
property int usedSwapKB: 0
|
||||||
|
|
||||||
|
property real networkRxRate: 0
|
||||||
|
property real networkTxRate: 0
|
||||||
|
property var lastNetworkStats: null
|
||||||
|
property var networkInterfaces: []
|
||||||
|
|
||||||
|
property real diskReadRate: 0
|
||||||
|
property real diskWriteRate: 0
|
||||||
|
property var lastDiskStats: null
|
||||||
|
property var diskMounts: []
|
||||||
|
property var diskDevices: []
|
||||||
|
|
||||||
|
property var processes: []
|
||||||
|
property var availableGpus: []
|
||||||
|
|
||||||
|
property string kernelVersion: ""
|
||||||
|
property string distribution: ""
|
||||||
|
property string hostname: ""
|
||||||
|
property string architecture: ""
|
||||||
|
property string loadAverage: ""
|
||||||
|
property int processCount: 0
|
||||||
|
property int threadCount: 0
|
||||||
|
property string bootTime: ""
|
||||||
|
property string motherboard: ""
|
||||||
|
property string biosVersion: ""
|
||||||
|
|
||||||
|
property int historySize: 60
|
||||||
|
property var cpuHistory: []
|
||||||
|
property var memoryHistory: []
|
||||||
|
property var networkHistory: ({ "rx": [], "tx": [] })
|
||||||
|
property var diskHistory: ({ "read": [], "write": [] })
|
||||||
|
|
||||||
|
function addRef(modules = null) {
|
||||||
|
refCount++
|
||||||
|
let modulesChanged = false
|
||||||
|
|
||||||
|
if (modules) {
|
||||||
|
const modulesToAdd = Array.isArray(modules) ? modules : [modules]
|
||||||
|
for (const module of modulesToAdd) {
|
||||||
|
// Increment reference count for this module
|
||||||
|
const currentCount = moduleRefCounts[module] || 0
|
||||||
|
moduleRefCounts[module] = currentCount + 1
|
||||||
|
console.log("Adding ref for module:", module, "count:", moduleRefCounts[module])
|
||||||
|
|
||||||
|
// Add to enabled modules if not already there
|
||||||
|
if (enabledModules.indexOf(module) === -1) {
|
||||||
|
enabledModules.push(module)
|
||||||
|
modulesChanged = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modulesChanged || refCount === 1) {
|
||||||
|
enabledModules = enabledModules.slice() // Force property change
|
||||||
|
moduleRefCounts = Object.assign({}, moduleRefCounts) // Force property change
|
||||||
|
updateAllStats()
|
||||||
|
} else if (gpuPciIds.length > 0 && refCount > 0) {
|
||||||
|
// If we have GPU PCI IDs and active modules, make sure to update
|
||||||
|
// This handles the case where PCI IDs were loaded after modules were added
|
||||||
|
updateAllStats()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeRef(modules = null) {
|
||||||
|
refCount = Math.max(0, refCount - 1)
|
||||||
|
let modulesChanged = false
|
||||||
|
|
||||||
|
if (modules) {
|
||||||
|
const modulesToRemove = Array.isArray(modules) ? modules : [modules]
|
||||||
|
for (const module of modulesToRemove) {
|
||||||
|
const currentCount = moduleRefCounts[module] || 0
|
||||||
|
if (currentCount > 1) {
|
||||||
|
// Decrement reference count
|
||||||
|
moduleRefCounts[module] = currentCount - 1
|
||||||
|
console.log("Removing ref for module:", module, "count:", moduleRefCounts[module])
|
||||||
|
} else if (currentCount === 1) {
|
||||||
|
// Remove completely when count reaches 0
|
||||||
|
delete moduleRefCounts[module]
|
||||||
|
const index = enabledModules.indexOf(module)
|
||||||
|
if (index > -1) {
|
||||||
|
enabledModules.splice(index, 1)
|
||||||
|
modulesChanged = true
|
||||||
|
console.log("Disabling module:", module, "(no more refs)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modulesChanged) {
|
||||||
|
enabledModules = enabledModules.slice() // Force property change
|
||||||
|
moduleRefCounts = Object.assign({}, moduleRefCounts) // Force property change
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setGpuPciIds(pciIds) {
|
||||||
|
gpuPciIds = Array.isArray(pciIds) ? pciIds : []
|
||||||
|
}
|
||||||
|
|
||||||
|
function addGpuPciId(pciId) {
|
||||||
|
const currentCount = gpuPciIdRefCounts[pciId] || 0
|
||||||
|
gpuPciIdRefCounts[pciId] = currentCount + 1
|
||||||
|
|
||||||
|
// Add to gpuPciIds array if not already there
|
||||||
|
if (!gpuPciIds.includes(pciId)) {
|
||||||
|
gpuPciIds = gpuPciIds.concat([pciId])
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Adding GPU PCI ID ref:", pciId, "count:", gpuPciIdRefCounts[pciId])
|
||||||
|
// Force property change notification
|
||||||
|
gpuPciIdRefCounts = Object.assign({}, gpuPciIdRefCounts)
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeGpuPciId(pciId) {
|
||||||
|
const currentCount = gpuPciIdRefCounts[pciId] || 0
|
||||||
|
if (currentCount > 1) {
|
||||||
|
// Decrement reference count
|
||||||
|
gpuPciIdRefCounts[pciId] = currentCount - 1
|
||||||
|
console.log("Removing GPU PCI ID ref:", pciId, "count:", gpuPciIdRefCounts[pciId])
|
||||||
|
} else if (currentCount === 1) {
|
||||||
|
// Remove completely when count reaches 0
|
||||||
|
delete gpuPciIdRefCounts[pciId]
|
||||||
|
const index = gpuPciIds.indexOf(pciId)
|
||||||
|
if (index > -1) {
|
||||||
|
gpuPciIds = gpuPciIds.slice()
|
||||||
|
gpuPciIds.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear temperature data for this GPU when no longer monitored
|
||||||
|
if (availableGpus && availableGpus.length > 0) {
|
||||||
|
const updatedGpus = availableGpus.slice()
|
||||||
|
for (let i = 0; i < updatedGpus.length; i++) {
|
||||||
|
if (updatedGpus[i].pciId === pciId) {
|
||||||
|
updatedGpus[i] = Object.assign({}, updatedGpus[i], { temperature: 0 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
availableGpus = updatedGpus
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Removing GPU PCI ID completely:", pciId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force property change notification
|
||||||
|
gpuPciIdRefCounts = Object.assign({}, gpuPciIdRefCounts)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setProcessOptions(limit = 20, sort = "cpu", disableCpu = false) {
|
||||||
|
processLimit = limit
|
||||||
|
processSort = sort
|
||||||
|
noCpu = disableCpu
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateAllStats() {
|
||||||
|
if (dankgopAvailable && refCount > 0 && enabledModules.length > 0) {
|
||||||
|
isUpdating = true
|
||||||
|
dankgopProcess.running = true
|
||||||
|
} else {
|
||||||
|
isUpdating = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeGpuMetadata() {
|
||||||
|
if (!dankgopAvailable) return
|
||||||
|
// Load GPU metadata once at startup for basic info
|
||||||
|
gpuInitProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildDankgopCommand() {
|
||||||
|
const cmd = ["dankgop", "meta", "--json"]
|
||||||
|
|
||||||
|
if (enabledModules.length === 0) {
|
||||||
|
// Don't run if no modules are needed
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace 'gpu' with 'gpu-temp' when we have PCI IDs to monitor
|
||||||
|
const finalModules = []
|
||||||
|
for (const module of enabledModules) {
|
||||||
|
if (module === "gpu" && gpuPciIds.length > 0) {
|
||||||
|
finalModules.push("gpu-temp")
|
||||||
|
} else if (module !== "gpu") {
|
||||||
|
finalModules.push(module)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add gpu-temp module automatically when we have PCI IDs to monitor
|
||||||
|
if (gpuPciIds.length > 0 && finalModules.indexOf("gpu-temp") === -1) {
|
||||||
|
finalModules.push("gpu-temp")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledModules.indexOf("all") !== -1) {
|
||||||
|
cmd.push("--modules", "all")
|
||||||
|
} else if (finalModules.length > 0) {
|
||||||
|
const moduleList = finalModules.join(",")
|
||||||
|
cmd.push("--modules", moduleList)
|
||||||
|
} else {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpuPciIds.length > 0) {
|
||||||
|
cmd.push("--gpu-pci-ids", gpuPciIds.join(","))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledModules.indexOf("processes") !== -1 || enabledModules.indexOf("all") !== -1) {
|
||||||
|
if (processLimit > 0) {
|
||||||
|
cmd.push("--limit", processLimit.toString())
|
||||||
|
}
|
||||||
|
cmd.push("--sort", processSort)
|
||||||
|
if (noCpu) {
|
||||||
|
cmd.push("--no-cpu")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseData(data) {
|
||||||
|
if (data.cpu) {
|
||||||
|
const cpu = data.cpu
|
||||||
|
cpuUsage = cpu.usage || 0
|
||||||
|
cpuFrequency = cpu.frequency || 0
|
||||||
|
cpuTemperature = cpu.temperature || 0
|
||||||
|
cpuCores = cpu.count || 1
|
||||||
|
cpuModel = cpu.model || ""
|
||||||
|
perCoreCpuUsage = cpu.coreUsage || []
|
||||||
|
addToHistory(cpuHistory, cpuUsage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.memory) {
|
||||||
|
const mem = data.memory
|
||||||
|
const totalKB = mem.total || 0
|
||||||
|
const availableKB = mem.available || 0
|
||||||
|
const freeKB = mem.free || 0
|
||||||
|
|
||||||
|
// Update MB properties
|
||||||
|
totalMemoryMB = totalKB / 1024
|
||||||
|
availableMemoryMB = availableKB / 1024
|
||||||
|
freeMemoryMB = freeKB / 1024
|
||||||
|
usedMemoryMB = totalMemoryMB - availableMemoryMB
|
||||||
|
memoryUsage = totalKB > 0 ? ((totalKB - availableKB) / totalKB) * 100 : 0
|
||||||
|
|
||||||
|
// Update KB properties for compatibility
|
||||||
|
totalMemoryKB = totalKB
|
||||||
|
usedMemoryKB = totalKB - availableKB
|
||||||
|
totalSwapKB = mem.swaptotal || 0
|
||||||
|
usedSwapKB = (mem.swaptotal || 0) - (mem.swapfree || 0)
|
||||||
|
|
||||||
|
addToHistory(memoryHistory, memoryUsage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.network && Array.isArray(data.network)) {
|
||||||
|
// Store raw network interface data
|
||||||
|
networkInterfaces = data.network
|
||||||
|
|
||||||
|
let totalRx = 0
|
||||||
|
let totalTx = 0
|
||||||
|
for (const iface of data.network) {
|
||||||
|
totalRx += iface.rx || 0
|
||||||
|
totalTx += iface.tx || 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastNetworkStats) {
|
||||||
|
const timeDiff = updateInterval / 1000
|
||||||
|
const rxDiff = totalRx - lastNetworkStats.rx
|
||||||
|
const txDiff = totalTx - lastNetworkStats.tx
|
||||||
|
networkRxRate = Math.max(0, rxDiff / timeDiff)
|
||||||
|
networkTxRate = Math.max(0, txDiff / timeDiff)
|
||||||
|
addToHistory(networkHistory.rx, networkRxRate / 1024)
|
||||||
|
addToHistory(networkHistory.tx, networkTxRate / 1024)
|
||||||
|
}
|
||||||
|
lastNetworkStats = { "rx": totalRx, "tx": totalTx }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.disk && Array.isArray(data.disk)) {
|
||||||
|
// Store raw disk device data
|
||||||
|
diskDevices = data.disk
|
||||||
|
|
||||||
|
let totalRead = 0
|
||||||
|
let totalWrite = 0
|
||||||
|
for (const disk of data.disk) {
|
||||||
|
totalRead += (disk.read || 0) * 512
|
||||||
|
totalWrite += (disk.write || 0) * 512
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastDiskStats) {
|
||||||
|
const timeDiff = updateInterval / 1000
|
||||||
|
const readDiff = totalRead - lastDiskStats.read
|
||||||
|
const writeDiff = totalWrite - lastDiskStats.write
|
||||||
|
diskReadRate = Math.max(0, readDiff / timeDiff)
|
||||||
|
diskWriteRate = Math.max(0, writeDiff / timeDiff)
|
||||||
|
addToHistory(diskHistory.read, diskReadRate / (1024 * 1024))
|
||||||
|
addToHistory(diskHistory.write, diskWriteRate / (1024 * 1024))
|
||||||
|
}
|
||||||
|
lastDiskStats = { "read": totalRead, "write": totalWrite }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.diskmounts) {
|
||||||
|
diskMounts = data.diskmounts || []
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.processes && Array.isArray(data.processes)) {
|
||||||
|
const newProcesses = []
|
||||||
|
for (const proc of data.processes) {
|
||||||
|
newProcesses.push({
|
||||||
|
"pid": proc.pid || 0,
|
||||||
|
"ppid": proc.ppid || 0,
|
||||||
|
"cpu": proc.cpu || 0,
|
||||||
|
"memoryPercent": proc.memoryPercent || proc.pssPercent || 0,
|
||||||
|
"memoryKB": proc.memoryKB || proc.pssKB || 0,
|
||||||
|
"command": proc.command || "",
|
||||||
|
"fullCommand": proc.fullCommand || "",
|
||||||
|
"displayName": (proc.command && proc.command.length > 15) ?
|
||||||
|
proc.command.substring(0, 15) + "..." : (proc.command || "")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
processes = newProcesses
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle both gpu and gpu-temp module data
|
||||||
|
const gpuData = (data.gpu && data.gpu.gpus) || data.gpus // Handle both meta format and direct gpu command format
|
||||||
|
if (gpuData && Array.isArray(gpuData)) {
|
||||||
|
// Check if this is temperature update data (has PCI IDs being monitored)
|
||||||
|
if (gpuPciIds.length > 0 && availableGpus && availableGpus.length > 0) {
|
||||||
|
// This is temperature data - merge with existing GPU metadata
|
||||||
|
const updatedGpus = availableGpus.slice()
|
||||||
|
for (let i = 0; i < updatedGpus.length; i++) {
|
||||||
|
const existingGpu = updatedGpus[i]
|
||||||
|
const tempGpu = gpuData.find(g => g.pciId === existingGpu.pciId)
|
||||||
|
// Only update temperature if this GPU's PCI ID is being monitored
|
||||||
|
if (tempGpu && gpuPciIds.includes(existingGpu.pciId)) {
|
||||||
|
updatedGpus[i] = Object.assign({}, existingGpu, { temperature: tempGpu.temperature || 0 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
availableGpus = updatedGpus
|
||||||
|
} else {
|
||||||
|
// This is initial GPU metadata - set the full list
|
||||||
|
const gpuList = []
|
||||||
|
for (const gpu of gpuData) {
|
||||||
|
let displayName = gpu.displayName || gpu.name || "Unknown GPU"
|
||||||
|
let fullName = gpu.fullName || gpu.name || "Unknown GPU"
|
||||||
|
|
||||||
|
gpuList.push({
|
||||||
|
"driver": gpu.driver || "",
|
||||||
|
"vendor": gpu.vendor || "",
|
||||||
|
"displayName": displayName,
|
||||||
|
"fullName": fullName,
|
||||||
|
"pciId": gpu.pciId || "",
|
||||||
|
"temperature": gpu.temperature || 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
availableGpus = gpuList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.system) {
|
||||||
|
const sys = data.system
|
||||||
|
loadAverage = sys.loadavg || ""
|
||||||
|
processCount = sys.processes || 0
|
||||||
|
threadCount = sys.threads || 0
|
||||||
|
bootTime = sys.boottime || ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.hardware) {
|
||||||
|
const hw = data.hardware
|
||||||
|
hostname = hw.hostname || ""
|
||||||
|
kernelVersion = hw.kernel || ""
|
||||||
|
distribution = hw.distro || ""
|
||||||
|
architecture = hw.arch || ""
|
||||||
|
motherboard = (hw.bios && hw.bios.motherboard) || ""
|
||||||
|
biosVersion = (hw.bios && hw.bios.version) || ""
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdating = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function addToHistory(array, value) {
|
||||||
|
array.push(value)
|
||||||
|
if (array.length > historySize) {
|
||||||
|
array.shift()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProcessIcon(command) {
|
||||||
|
const cmd = command.toLowerCase()
|
||||||
|
if (cmd.includes("firefox") || cmd.includes("chrome") || cmd.includes("browser"))
|
||||||
|
return "web"
|
||||||
|
if (cmd.includes("code") || cmd.includes("editor") || cmd.includes("vim"))
|
||||||
|
return "code"
|
||||||
|
if (cmd.includes("terminal") || cmd.includes("bash") || cmd.includes("zsh"))
|
||||||
|
return "terminal"
|
||||||
|
if (cmd.includes("music") || cmd.includes("audio") || cmd.includes("spotify"))
|
||||||
|
return "music_note"
|
||||||
|
if (cmd.includes("video") || cmd.includes("vlc") || cmd.includes("mpv"))
|
||||||
|
return "play_circle"
|
||||||
|
if (cmd.includes("systemd") || cmd.includes("kernel") || cmd.includes("kthread"))
|
||||||
|
return "settings"
|
||||||
|
return "memory"
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatCpuUsage(cpu) {
|
||||||
|
return (cpu || 0).toFixed(1) + "%"
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatMemoryUsage(memoryKB) {
|
||||||
|
const mem = memoryKB || 0
|
||||||
|
if (mem < 1024)
|
||||||
|
return mem.toFixed(0) + " KB"
|
||||||
|
else if (mem < 1024 * 1024)
|
||||||
|
return (mem / 1024).toFixed(1) + " MB"
|
||||||
|
else
|
||||||
|
return (mem / (1024 * 1024)).toFixed(1) + " GB"
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatSystemMemory(memoryKB) {
|
||||||
|
const mem = memoryKB || 0
|
||||||
|
if (mem === 0)
|
||||||
|
return "--"
|
||||||
|
if (mem < 1024 * 1024)
|
||||||
|
return (mem / 1024).toFixed(0) + " MB"
|
||||||
|
else
|
||||||
|
return (mem / (1024 * 1024)).toFixed(1) + " GB"
|
||||||
|
}
|
||||||
|
|
||||||
|
function killProcess(pid) {
|
||||||
|
if (pid > 0) {
|
||||||
|
Quickshell.execDetached("kill", [pid.toString()])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSortBy(newSortBy) {
|
||||||
|
if (newSortBy !== processSort) {
|
||||||
|
processSort = newSortBy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: updateTimer
|
||||||
|
interval: root.updateInterval
|
||||||
|
running: root.dankgopAvailable && root.refCount > 0 && root.enabledModules.length > 0
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: root.updateAllStats()
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: dankgopProcess
|
||||||
|
command: root.buildDankgopCommand()
|
||||||
|
running: false
|
||||||
|
onCommandChanged: {
|
||||||
|
console.log("DankgopService command:", JSON.stringify(command))
|
||||||
|
}
|
||||||
|
onExited: exitCode => {
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
console.warn("Dankgop process failed with exit code:", exitCode)
|
||||||
|
isUpdating = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
if (text.trim()) {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(text.trim())
|
||||||
|
parseData(data)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Failed to parse dankgop JSON:", e)
|
||||||
|
console.warn("Raw text was:", text.substring(0, 200))
|
||||||
|
isUpdating = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: gpuInitProcess
|
||||||
|
command: ["dankgop", "gpu", "--json"]
|
||||||
|
running: false
|
||||||
|
onExited: exitCode => {
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
console.warn("GPU init process failed with exit code:", exitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
if (text.trim()) {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(text.trim())
|
||||||
|
parseData(data)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("Failed to parse GPU init JSON:", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: dankgopCheckProcess
|
||||||
|
command: ["which", "dankgop"]
|
||||||
|
running: false
|
||||||
|
onExited: exitCode => {
|
||||||
|
dankgopAvailable = (exitCode === 0)
|
||||||
|
if (dankgopAvailable) {
|
||||||
|
initializeGpuMetadata()
|
||||||
|
// Load persisted GPU PCI IDs from session state
|
||||||
|
if (SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.length > 0) {
|
||||||
|
for (const pciId of SessionData.enabledGpuPciIds) {
|
||||||
|
addGpuPciId(pciId)
|
||||||
|
}
|
||||||
|
// Trigger update if we already have active modules
|
||||||
|
if (refCount > 0 && enabledModules.length > 0) {
|
||||||
|
updateAllStats()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn("dankgop is not installed or not in PATH")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
dankgopCheckProcess.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,640 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
readonly property string shellDir: Qt.resolvedUrl(".").toString().replace(
|
|
||||||
"file://", "").replace("/Services/", "")
|
|
||||||
|
|
||||||
property int refCount: 0
|
|
||||||
property int updateInterval: refCount > 0 ? 3000 : 30000
|
|
||||||
property int maxProcesses: 100
|
|
||||||
property bool isUpdating: false
|
|
||||||
property bool staticDataInitialized: false
|
|
||||||
|
|
||||||
property var processes: []
|
|
||||||
property string sortBy: "cpu"
|
|
||||||
property bool sortDescending: true
|
|
||||||
property var lastProcTicks: ({})
|
|
||||||
property real lastTotalJiffies: -1
|
|
||||||
|
|
||||||
property real cpuUsage: 0
|
|
||||||
property real totalCpuUsage: 0
|
|
||||||
property int cpuCores: 1
|
|
||||||
property int cpuCount: 1
|
|
||||||
property string cpuModel: ""
|
|
||||||
property real cpuFrequency: 0
|
|
||||||
property real cpuTemperature: -1
|
|
||||||
property var perCoreCpuUsage: []
|
|
||||||
|
|
||||||
property var lastCpuStats: null
|
|
||||||
property var lastPerCoreStats: null
|
|
||||||
|
|
||||||
property real memoryUsage: 0
|
|
||||||
property real totalMemoryMB: 0
|
|
||||||
property real usedMemoryMB: 0
|
|
||||||
property real freeMemoryMB: 0
|
|
||||||
property real availableMemoryMB: 0
|
|
||||||
property int totalMemoryKB: 0
|
|
||||||
property int usedMemoryKB: 0
|
|
||||||
property int totalSwapKB: 0
|
|
||||||
property int usedSwapKB: 0
|
|
||||||
|
|
||||||
property real networkRxRate: 0
|
|
||||||
property real networkTxRate: 0
|
|
||||||
property var lastNetworkStats: null
|
|
||||||
|
|
||||||
property real diskReadRate: 0
|
|
||||||
property real diskWriteRate: 0
|
|
||||||
property var lastDiskStats: null
|
|
||||||
property var diskMounts: []
|
|
||||||
|
|
||||||
property int historySize: 60
|
|
||||||
property var cpuHistory: []
|
|
||||||
property var memoryHistory: []
|
|
||||||
property var networkHistory: ({
|
|
||||||
"rx": [],
|
|
||||||
"tx": []
|
|
||||||
})
|
|
||||||
property var diskHistory: ({
|
|
||||||
"read": [],
|
|
||||||
"write": []
|
|
||||||
})
|
|
||||||
|
|
||||||
property string kernelVersion: ""
|
|
||||||
property string distribution: ""
|
|
||||||
property string hostname: ""
|
|
||||||
property string architecture: ""
|
|
||||||
property string loadAverage: ""
|
|
||||||
property int processCount: 0
|
|
||||||
property int threadCount: 0
|
|
||||||
property string bootTime: ""
|
|
||||||
property string motherboard: ""
|
|
||||||
property string biosVersion: ""
|
|
||||||
property var availableGpus: []
|
|
||||||
|
|
||||||
// Properties to control GPU temperature collection - set externally by shell.qml
|
|
||||||
property bool gpuTempEnabled: false
|
|
||||||
property bool nvidiaGpuTempEnabled: false
|
|
||||||
property bool nonNvidiaGpuTempEnabled: false
|
|
||||||
|
|
||||||
function addRef() {
|
|
||||||
refCount++
|
|
||||||
if (refCount === 1) {
|
|
||||||
if (!staticDataInitialized) {
|
|
||||||
initializeStaticData()
|
|
||||||
}
|
|
||||||
updateAllStats()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeRef() {
|
|
||||||
refCount = Math.max(0, refCount - 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
function initializeStaticData() {
|
|
||||||
if (!staticDataInitialized) {
|
|
||||||
staticDataInitialized = true
|
|
||||||
staticDataProcess.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAllStats() {
|
|
||||||
if (refCount > 0) {
|
|
||||||
isUpdating = true
|
|
||||||
dynamicStatsProcess.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSortBy(newSortBy) {
|
|
||||||
if (newSortBy !== sortBy) {
|
|
||||||
sortBy = newSortBy
|
|
||||||
sortProcessesInPlace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleSortOrder() {
|
|
||||||
sortDescending = !sortDescending
|
|
||||||
sortProcessesInPlace()
|
|
||||||
}
|
|
||||||
|
|
||||||
function sortProcessesInPlace() {
|
|
||||||
if (processes.length === 0)
|
|
||||||
return
|
|
||||||
const sortedProcesses = [...processes]
|
|
||||||
|
|
||||||
sortedProcesses.sort((a, b) => {
|
|
||||||
let aVal, bVal
|
|
||||||
|
|
||||||
switch (sortBy) {
|
|
||||||
case "cpu":
|
|
||||||
aVal = parseFloat(a.cpu) || 0
|
|
||||||
bVal = parseFloat(b.cpu) || 0
|
|
||||||
break
|
|
||||||
case "memory":
|
|
||||||
aVal = parseFloat(a.memoryPercent) || 0
|
|
||||||
bVal = parseFloat(b.memoryPercent) || 0
|
|
||||||
break
|
|
||||||
case "name":
|
|
||||||
aVal = a.command || ""
|
|
||||||
bVal = b.command || ""
|
|
||||||
break
|
|
||||||
case "pid":
|
|
||||||
aVal = parseInt(a.pid) || 0
|
|
||||||
bVal = parseInt(b.pid) || 0
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
aVal = parseFloat(a.cpu) || 0
|
|
||||||
bVal = parseFloat(b.cpu) || 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof aVal === "string") {
|
|
||||||
return sortDescending ? bVal.localeCompare(
|
|
||||||
aVal) : aVal.localeCompare(
|
|
||||||
bVal)
|
|
||||||
} else {
|
|
||||||
return sortDescending ? bVal - aVal : aVal - bVal
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
processes = sortedProcesses
|
|
||||||
}
|
|
||||||
|
|
||||||
function killProcess(pid) {
|
|
||||||
if (pid > 0) {
|
|
||||||
Quickshell.execDetached("kill", [pid.toString()])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function addToHistory(array, value) {
|
|
||||||
array.push(value)
|
|
||||||
if (array.length > historySize)
|
|
||||||
array.shift()
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculateCpuUsage(currentStats, lastStats) {
|
|
||||||
if (!lastStats || !currentStats || currentStats.length < 4) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentTotal = currentStats.reduce((sum, val) => sum + val, 0)
|
|
||||||
const lastTotal = lastStats.reduce((sum, val) => sum + val, 0)
|
|
||||||
|
|
||||||
const totalDiff = currentTotal - lastTotal
|
|
||||||
if (totalDiff <= 0)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
const currentIdle = currentStats[3]
|
|
||||||
const lastIdle = lastStats[3]
|
|
||||||
const idleDiff = currentIdle - lastIdle
|
|
||||||
|
|
||||||
const usedDiff = totalDiff - idleDiff
|
|
||||||
return Math.max(0, Math.min(100, (usedDiff / totalDiff) * 100))
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseStaticData(data) {
|
|
||||||
if (data.cpu) {
|
|
||||||
cpuCores = data.cpu.count || 1
|
|
||||||
cpuCount = data.cpu.count || 1
|
|
||||||
cpuModel = data.cpu.model || ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.system) {
|
|
||||||
kernelVersion = data.system.kernel || ""
|
|
||||||
distribution = data.system.distro || ""
|
|
||||||
hostname = data.system.hostname || ""
|
|
||||||
architecture = data.system.arch || ""
|
|
||||||
motherboard = data.system.motherboard || ""
|
|
||||||
biosVersion = data.system.bios || ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.gpus) {
|
|
||||||
const gpuList = []
|
|
||||||
for (const gpu of data.gpus) {
|
|
||||||
// Parse the display name and PCI ID from rawLine
|
|
||||||
let displayName = ""
|
|
||||||
let fullName = ""
|
|
||||||
let pciId = ""
|
|
||||||
|
|
||||||
if (gpu.rawLine) {
|
|
||||||
// Extract PCI ID [vvvv:dddd]
|
|
||||||
const pciMatch = gpu.rawLine.match(/\[([0-9a-f]{4}:[0-9a-f]{4})\]/i)
|
|
||||||
if (pciMatch) {
|
|
||||||
pciId = pciMatch[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove BDF and class prefix
|
|
||||||
let s = gpu.rawLine.replace(/^[^:]+: /, "")
|
|
||||||
// Remove PCI ID [vvvv:dddd] and everything after
|
|
||||||
s = s.replace(/\[[0-9a-f]{4}:[0-9a-f]{4}\].*$/i, "")
|
|
||||||
|
|
||||||
// Try to extract text after last ']'
|
|
||||||
const afterBracket = s.match(/\]\s*([^\[]+)$/)
|
|
||||||
if (afterBracket && afterBracket[1].trim()) {
|
|
||||||
displayName = afterBracket[1].trim()
|
|
||||||
} else {
|
|
||||||
// Try to get last bracketed text
|
|
||||||
const lastBracket = s.match(/\[([^\]]+)\]([^\[]*$)/)
|
|
||||||
if (lastBracket) {
|
|
||||||
displayName = lastBracket[1]
|
|
||||||
} else {
|
|
||||||
displayName = s
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove vendor prefixes
|
|
||||||
displayName = displayName
|
|
||||||
.replace(/^NVIDIA Corporation\s+/i, "")
|
|
||||||
.replace(/^NVIDIA\s+/i, "")
|
|
||||||
.replace(/^Advanced Micro Devices, Inc\.\s+/i, "")
|
|
||||||
.replace(/^AMD\/ATI\s+/i, "")
|
|
||||||
.replace(/^AMD\s+/i, "")
|
|
||||||
.replace(/^ATI\s+/i, "")
|
|
||||||
.replace(/^Intel Corporation\s+/i, "")
|
|
||||||
.replace(/^Intel\s+/i, "")
|
|
||||||
.trim()
|
|
||||||
} else if (gpu.rawLine && gpu.rawLine.startsWith("NVIDIA")) {
|
|
||||||
// nvidia-smi fallback case
|
|
||||||
displayName = gpu.rawLine.replace(/^NVIDIA\s+/, "")
|
|
||||||
} else {
|
|
||||||
displayName = "Unknown"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build full name with vendor prefix
|
|
||||||
switch(gpu.vendor) {
|
|
||||||
case "NVIDIA": fullName = "NVIDIA " + displayName; break
|
|
||||||
case "AMD": fullName = "AMD " + displayName; break
|
|
||||||
case "Intel": fullName = "Intel " + displayName; break
|
|
||||||
default: fullName = displayName
|
|
||||||
}
|
|
||||||
|
|
||||||
gpuList.push({
|
|
||||||
"driver": gpu.driver,
|
|
||||||
"vendor": gpu.vendor,
|
|
||||||
"displayName": displayName,
|
|
||||||
"fullName": fullName,
|
|
||||||
"pciId": pciId,
|
|
||||||
"temperature": 0,
|
|
||||||
"hwmon": "unknown"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
availableGpus = gpuList
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseDynamicStats(data) {
|
|
||||||
updateGpuTemperatures(data.gputemps || [])
|
|
||||||
parseUnifiedStats(JSON.stringify(data))
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateGpuTemperatures(tempData) {
|
|
||||||
if (availableGpus.length === 0) return
|
|
||||||
|
|
||||||
if (!gpuTempEnabled || tempData.length === 0) {
|
|
||||||
clearGpuTemperatures()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedGpus = []
|
|
||||||
for (let i = 0; i < availableGpus.length; i++) {
|
|
||||||
const gpu = availableGpus[i]
|
|
||||||
const tempInfo = tempData.find(t => t.driver === gpu.driver)
|
|
||||||
if (tempInfo) {
|
|
||||||
updatedGpus.push({
|
|
||||||
"driver": gpu.driver,
|
|
||||||
"vendor": gpu.vendor,
|
|
||||||
"displayName": gpu.displayName,
|
|
||||||
"fullName": gpu.fullName,
|
|
||||||
"pciId": gpu.pciId,
|
|
||||||
"temperature": tempInfo.temperature || 0,
|
|
||||||
"hwmon": tempInfo.hwmon || "unknown"
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
updatedGpus.push({
|
|
||||||
"driver": gpu.driver,
|
|
||||||
"vendor": gpu.vendor,
|
|
||||||
"displayName": gpu.displayName,
|
|
||||||
"fullName": gpu.fullName,
|
|
||||||
"pciId": gpu.pciId,
|
|
||||||
"temperature": gpu.temperature || 0,
|
|
||||||
"hwmon": gpu.hwmon || "unknown"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
availableGpus = updatedGpus
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearGpuTemperatures() {
|
|
||||||
if (availableGpus.length === 0) return
|
|
||||||
|
|
||||||
const clearedGpus = []
|
|
||||||
for (let i = 0; i < availableGpus.length; i++) {
|
|
||||||
const gpu = availableGpus[i]
|
|
||||||
clearedGpus.push({
|
|
||||||
"driver": gpu.driver,
|
|
||||||
"vendor": gpu.vendor,
|
|
||||||
"displayName": gpu.displayName,
|
|
||||||
"fullName": gpu.fullName,
|
|
||||||
"pciId": gpu.pciId,
|
|
||||||
"temperature": 0,
|
|
||||||
"hwmon": "unknown"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
availableGpus = clearedGpus
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseUnifiedStats(text) {
|
|
||||||
function num(x) {
|
|
||||||
return (typeof x === "number" && !isNaN(x)) ? x : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
let data
|
|
||||||
try {
|
|
||||||
data = JSON.parse(text)
|
|
||||||
} catch (error) {
|
|
||||||
isUpdating = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.memory) {
|
|
||||||
const m = data.memory
|
|
||||||
totalMemoryKB = num(m.total)
|
|
||||||
const free = num(m.free)
|
|
||||||
const buf = num(m.buffers)
|
|
||||||
const cached = num(m.cached)
|
|
||||||
const shared = num(m.shared)
|
|
||||||
usedMemoryKB = totalMemoryKB - free - buf - cached
|
|
||||||
totalSwapKB = num(m.swaptotal)
|
|
||||||
usedSwapKB = num(m.swaptotal) - num(m.swapfree)
|
|
||||||
totalMemoryMB = totalMemoryKB / 1024
|
|
||||||
usedMemoryMB = usedMemoryKB / 1024
|
|
||||||
freeMemoryMB = (totalMemoryKB - usedMemoryKB) / 1024
|
|
||||||
availableMemoryMB = num(
|
|
||||||
m.available) ? num(
|
|
||||||
m.available) / 1024 : (free + buf + cached) / 1024
|
|
||||||
memoryUsage = totalMemoryKB > 0 ? (usedMemoryKB / totalMemoryKB) * 100 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.cpu) {
|
|
||||||
cpuFrequency = data.cpu.frequency || 0
|
|
||||||
cpuTemperature = data.cpu.temperature || 0
|
|
||||||
|
|
||||||
if (data.cpu.total && data.cpu.total.length >= 8) {
|
|
||||||
const currentStats = data.cpu.total
|
|
||||||
const usage = calculateCpuUsage(currentStats, lastCpuStats)
|
|
||||||
cpuUsage = usage
|
|
||||||
totalCpuUsage = usage
|
|
||||||
lastCpuStats = [...currentStats]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.cpu.cores) {
|
|
||||||
const coreUsages = []
|
|
||||||
for (var i = 0; i < data.cpu.cores.length; i++) {
|
|
||||||
const currentCoreStats = data.cpu.cores[i]
|
|
||||||
if (currentCoreStats && currentCoreStats.length >= 8) {
|
|
||||||
let lastCoreStats = null
|
|
||||||
if (lastPerCoreStats && lastPerCoreStats[i]) {
|
|
||||||
lastCoreStats = lastPerCoreStats[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
const usage = calculateCpuUsage(currentCoreStats, lastCoreStats)
|
|
||||||
coreUsages.push(usage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JSON.stringify(perCoreCpuUsage) !== JSON.stringify(coreUsages)) {
|
|
||||||
perCoreCpuUsage = coreUsages
|
|
||||||
}
|
|
||||||
|
|
||||||
lastPerCoreStats = data.cpu.cores.map(core => [...core])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.network) {
|
|
||||||
let totalRx = 0
|
|
||||||
let totalTx = 0
|
|
||||||
for (const iface of data.network) {
|
|
||||||
totalRx += iface.rx
|
|
||||||
totalTx += iface.tx
|
|
||||||
}
|
|
||||||
if (lastNetworkStats) {
|
|
||||||
const timeDiff = updateInterval / 1000
|
|
||||||
const rxDiff = totalRx - lastNetworkStats.rx
|
|
||||||
const txDiff = totalTx - lastNetworkStats.tx
|
|
||||||
networkRxRate = Math.max(0, rxDiff / timeDiff)
|
|
||||||
networkTxRate = Math.max(0, txDiff / timeDiff)
|
|
||||||
addToHistory(networkHistory.rx, networkRxRate / 1024)
|
|
||||||
addToHistory(networkHistory.tx, networkTxRate / 1024)
|
|
||||||
}
|
|
||||||
lastNetworkStats = {
|
|
||||||
"rx": totalRx,
|
|
||||||
"tx": totalTx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.disk) {
|
|
||||||
let totalRead = 0
|
|
||||||
let totalWrite = 0
|
|
||||||
for (const disk of data.disk) {
|
|
||||||
totalRead += disk.read * 512
|
|
||||||
totalWrite += disk.write * 512
|
|
||||||
}
|
|
||||||
if (lastDiskStats) {
|
|
||||||
const timeDiff = updateInterval / 1000
|
|
||||||
const readDiff = totalRead - lastDiskStats.read
|
|
||||||
const writeDiff = totalWrite - lastDiskStats.write
|
|
||||||
diskReadRate = Math.max(0, readDiff / timeDiff)
|
|
||||||
diskWriteRate = Math.max(0, writeDiff / timeDiff)
|
|
||||||
addToHistory(diskHistory.read, diskReadRate / (1024 * 1024))
|
|
||||||
addToHistory(diskHistory.write, diskWriteRate / (1024 * 1024))
|
|
||||||
}
|
|
||||||
lastDiskStats = {
|
|
||||||
"read": totalRead,
|
|
||||||
"write": totalWrite
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let totalDiff = 0
|
|
||||||
if (data.cpu && data.cpu.total && data.cpu.total.length >= 4) {
|
|
||||||
const currentTotal = data.cpu.total.reduce((s, v) => s + v, 0)
|
|
||||||
if (lastTotalJiffies > 0)
|
|
||||||
totalDiff = currentTotal - lastTotalJiffies
|
|
||||||
lastTotalJiffies = currentTotal
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.processes) {
|
|
||||||
const newProcesses = []
|
|
||||||
for (const proc of data.processes) {
|
|
||||||
const pid = proc.pid
|
|
||||||
const pticks = Number(proc.pticks) || 0
|
|
||||||
const prev = lastProcTicks[pid] ?? null
|
|
||||||
let cpuShare = 0
|
|
||||||
|
|
||||||
if (prev !== null && totalDiff > 0) {
|
|
||||||
// Per share all CPUs (matches gnome system monitor)
|
|
||||||
//cpuShare = 100 * Math.max(0, pticks - prev) / totalDiff
|
|
||||||
|
|
||||||
// per-share per-core
|
|
||||||
cpuShare = 100 * cpuCores * Math.max(0, pticks - prev) / totalDiff
|
|
||||||
}
|
|
||||||
|
|
||||||
lastProcTicks[pid] = pticks // update cache
|
|
||||||
|
|
||||||
newProcesses.push({
|
|
||||||
"pid": pid,
|
|
||||||
"ppid": proc.ppid,
|
|
||||||
"cpu": cpuShare,
|
|
||||||
"memoryPercent": proc.pssPercent
|
|
||||||
?? proc.memoryPercent,
|
|
||||||
"memoryKB": proc.pssKB ?? proc.memoryKB,
|
|
||||||
"command": proc.command,
|
|
||||||
"fullCommand": proc.fullCommand,
|
|
||||||
"displayName": (proc.command && proc.command.length
|
|
||||||
> 15) ? proc.command.substring(
|
|
||||||
0,
|
|
||||||
15) + "..." : proc.command
|
|
||||||
})
|
|
||||||
}
|
|
||||||
processes = newProcesses
|
|
||||||
sortProcessesInPlace()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.system) {
|
|
||||||
loadAverage = data.system.loadavg || ""
|
|
||||||
processCount = data.system.processes || 0
|
|
||||||
threadCount = data.system.threads || 0
|
|
||||||
bootTime = data.system.boottime || ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.diskmounts) {
|
|
||||||
diskMounts = data.diskmounts
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
addToHistory(cpuHistory, cpuUsage)
|
|
||||||
addToHistory(memoryHistory, memoryUsage)
|
|
||||||
|
|
||||||
isUpdating = false
|
|
||||||
}
|
|
||||||
|
|
||||||
function getProcessIcon(command) {
|
|
||||||
const cmd = command.toLowerCase()
|
|
||||||
if (cmd.includes("firefox") || cmd.includes("chrome") || cmd.includes(
|
|
||||||
"browser"))
|
|
||||||
return "web"
|
|
||||||
if (cmd.includes("code") || cmd.includes("editor") || cmd.includes("vim"))
|
|
||||||
return "code"
|
|
||||||
if (cmd.includes("terminal") || cmd.includes("bash") || cmd.includes("zsh"))
|
|
||||||
return "terminal"
|
|
||||||
if (cmd.includes("music") || cmd.includes("audio") || cmd.includes(
|
|
||||||
"spotify"))
|
|
||||||
return "music_note"
|
|
||||||
if (cmd.includes("video") || cmd.includes("vlc") || cmd.includes("mpv"))
|
|
||||||
return "play_circle"
|
|
||||||
if (cmd.includes("systemd") || cmd.includes("kernel") || cmd.includes(
|
|
||||||
"kthread"))
|
|
||||||
return "settings"
|
|
||||||
return "memory"
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatCpuUsage(cpu) {
|
|
||||||
return (cpu || 0).toFixed(1) + "%"
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatMemoryUsage(memoryKB) {
|
|
||||||
const mem = memoryKB || 0
|
|
||||||
if (mem < 1024)
|
|
||||||
return mem.toFixed(0) + " KB"
|
|
||||||
else if (mem < 1024 * 1024)
|
|
||||||
return (mem / 1024).toFixed(1) + " MB"
|
|
||||||
else
|
|
||||||
return (mem / (1024 * 1024)).toFixed(1) + " GB"
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatSystemMemory(memoryKB) {
|
|
||||||
const mem = memoryKB || 0
|
|
||||||
if (mem < 1024 * 1024)
|
|
||||||
return (mem / 1024).toFixed(0) + " MB"
|
|
||||||
else
|
|
||||||
return (mem / (1024 * 1024)).toFixed(1) + " GB"
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: updateTimer
|
|
||||||
interval: root.updateInterval
|
|
||||||
running: root.refCount > 0
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: root.updateAllStats()
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: staticDataProcess
|
|
||||||
command: [root.shellDir + "/sysmon_static.sh"]
|
|
||||||
running: false
|
|
||||||
onExited: exitCode => {
|
|
||||||
if (exitCode !== 0) {
|
|
||||||
console.warn("Static data collection failed with exit code:", exitCode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (text.trim()) {
|
|
||||||
const fullText = text.trim()
|
|
||||||
const lastBraceIndex = fullText.lastIndexOf('}')
|
|
||||||
if (lastBraceIndex === -1) {
|
|
||||||
console.warn("Invalid static data JSON")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const jsonText = fullText.substring(0, lastBraceIndex + 1)
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(jsonText)
|
|
||||||
parseStaticData(data)
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Failed to parse static data JSON:", e)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: dynamicStatsProcess
|
|
||||||
command: [root.shellDir + "/sysmon_dynamic_lite.sh", root.sortBy, String(root.maxProcesses), root.gpuTempEnabled ? "1" : "0", root.nvidiaGpuTempEnabled ? "1" : "0", root.nonNvidiaGpuTempEnabled ? "1" : "0"]
|
|
||||||
running: false
|
|
||||||
onExited: exitCode => {
|
|
||||||
if (exitCode !== 0) {
|
|
||||||
isUpdating = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (text.trim()) {
|
|
||||||
const fullText = text.trim()
|
|
||||||
const lastBraceIndex = fullText.lastIndexOf('}')
|
|
||||||
if (lastBraceIndex === -1) {
|
|
||||||
isUpdating = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const jsonText = fullText.substring(0, lastBraceIndex + 1)
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(jsonText)
|
|
||||||
parseDynamicStats(data)
|
|
||||||
} catch (e) {
|
|
||||||
isUpdating = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user