mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
ii bar resources popup: use formatting func from ResourceUsage
This commit is contained in:
@@ -7,11 +7,6 @@ import QtQuick.Layouts
|
||||
StyledPopup {
|
||||
id: root
|
||||
|
||||
// Helper function to format KB to GB
|
||||
function formatKB(kb) {
|
||||
return (kb / (1024 * 1024)).toFixed(1) + " GB";
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: 12
|
||||
@@ -29,17 +24,17 @@ StyledPopup {
|
||||
StyledPopupValueRow {
|
||||
icon: "clock_loader_60"
|
||||
label: Translation.tr("Used:")
|
||||
value: root.formatKB(ResourceUsage.memoryUsed)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.memoryUsed)
|
||||
}
|
||||
StyledPopupValueRow {
|
||||
icon: "check_circle"
|
||||
label: Translation.tr("Free:")
|
||||
value: root.formatKB(ResourceUsage.memoryFree)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.memoryFree)
|
||||
}
|
||||
StyledPopupValueRow {
|
||||
icon: "empty_dashboard"
|
||||
label: Translation.tr("Total:")
|
||||
value: root.formatKB(ResourceUsage.memoryTotal)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.memoryTotal)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,17 +53,17 @@ StyledPopup {
|
||||
StyledPopupValueRow {
|
||||
icon: "clock_loader_60"
|
||||
label: Translation.tr("Used:")
|
||||
value: root.formatKB(ResourceUsage.swapUsed)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.swapUsed)
|
||||
}
|
||||
StyledPopupValueRow {
|
||||
icon: "check_circle"
|
||||
label: Translation.tr("Free:")
|
||||
value: root.formatKB(ResourceUsage.swapFree)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.swapFree)
|
||||
}
|
||||
StyledPopupValueRow {
|
||||
icon: "empty_dashboard"
|
||||
label: Translation.tr("Total:")
|
||||
value: root.formatKB(ResourceUsage.swapTotal)
|
||||
value: ResourceUsage.kbToGbString(ResourceUsage.swapTotal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user