mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
use decimal units for disk space
This commit is contained in:
@@ -582,6 +582,7 @@ PopupWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
anchors.margins: border.width
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
radius: Style.radiusS
|
radius: Style.radiusS
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ ColumnLayout {
|
|||||||
property string commitInfo: ""
|
property string commitInfo: ""
|
||||||
|
|
||||||
readonly property bool isGitVersion: root.currentVersion.endsWith("-git")
|
readonly property bool isGitVersion: root.currentVersion.endsWith("-git")
|
||||||
readonly property int giga: (1024 * 1024 * 1024)
|
readonly property int gigaB: (1024 * 1024 * 1024)
|
||||||
|
readonly property int gigaD: (1000 * 1000 * 1000)
|
||||||
|
|
||||||
// Update status: compare versions (strip -git suffix for comparison)
|
// Update status: compare versions (strip -git suffix for comparison)
|
||||||
readonly property string installedBase: root.currentVersion.replace("-git", "")
|
readonly property string installedBase: root.currentVersion.replace("-git", "")
|
||||||
@@ -96,7 +97,7 @@ ColumnLayout {
|
|||||||
version: UpdateService.currentVersion,
|
version: UpdateService.currentVersion,
|
||||||
compositor: TelemetryService.getCompositorType(),
|
compositor: TelemetryService.getCompositorType(),
|
||||||
os: HostService.osPretty || "Unknown",
|
os: HostService.osPretty || "Unknown",
|
||||||
ramGb: Math.round((root.getModule("Memory")?.result?.total || 0) / root.giga),
|
ramGb: Math.round((root.getModule("Memory")?.result?.total || 0) / root.gigaB),
|
||||||
monitors: monitors,
|
monitors: monitors,
|
||||||
ui: {
|
ui: {
|
||||||
scaleRatio: Settings.data.general.scaleRatio,
|
scaleRatio: Settings.data.general.scaleRatio,
|
||||||
@@ -140,7 +141,7 @@ ColumnLayout {
|
|||||||
info += "GPU: " + gpu.result.map(g => g.name || "Unknown").join(", ") + "\n";
|
info += "GPU: " + gpu.result.map(g => g.name || "Unknown").join(", ") + "\n";
|
||||||
}
|
}
|
||||||
if (mem?.result) {
|
if (mem?.result) {
|
||||||
info += "Memory: " + SystemStatService.formatGigabytes(mem.result.total / root.giga) + "\n";
|
info += "Memory: " + (mem.result.total / root.gigaB).toFixed(1) + " GB \n";
|
||||||
}
|
}
|
||||||
if (wm?.result) {
|
if (wm?.result) {
|
||||||
info += "WM: " + (wm.result.prettyName || wm.result.processName || "N/A") + "\n";
|
info += "WM: " + (wm.result.prettyName || wm.result.processName || "N/A") + "\n";
|
||||||
@@ -734,9 +735,9 @@ ColumnLayout {
|
|||||||
const mem = root.getModule("Memory");
|
const mem = root.getModule("Memory");
|
||||||
if (!mem?.result)
|
if (!mem?.result)
|
||||||
return "N/A";
|
return "N/A";
|
||||||
const used = SystemStatService.formatGigabytes(mem.result.used / root.giga);
|
const used = (mem.result.used / root.gigaB).toFixed(1);
|
||||||
const total = SystemStatService.formatGigabytes(mem.result.total / root.giga);
|
const total = (mem.result.total / root.gigaB).toFixed(1);
|
||||||
return used + " / " + total;
|
return used + " GB / " + total + " GB";
|
||||||
}
|
}
|
||||||
color: Color.mOnSurface
|
color: Color.mOnSurface
|
||||||
pointSize: sysInfo.textSize
|
pointSize: sysInfo.textSize
|
||||||
@@ -758,9 +759,9 @@ ColumnLayout {
|
|||||||
const rootDisk = disk.result.find(d => d.mountpoint === "/");
|
const rootDisk = disk.result.find(d => d.mountpoint === "/");
|
||||||
if (!rootDisk?.bytes)
|
if (!rootDisk?.bytes)
|
||||||
return "N/A";
|
return "N/A";
|
||||||
const used = SystemStatService.formatGigabytes(rootDisk.bytes.used / root.giga);
|
const used = (rootDisk.bytes.used / root.gigaD).toFixed(1);
|
||||||
const total = SystemStatService.formatGigabytes(rootDisk.bytes.total / root.giga);
|
const total = (rootDisk.bytes.total / root.gigaD).toFixed(1);
|
||||||
return used + " / " + total + " (" + rootDisk.filesystem + ")";
|
return used + " GB / " + total + " GB" + " (" + rootDisk.filesystem + ")";
|
||||||
}
|
}
|
||||||
color: Color.mOnSurface
|
color: Color.mOnSurface
|
||||||
pointSize: sysInfo.textSize
|
pointSize: sysInfo.textSize
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ PopupWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: border.width / 2
|
anchors.margins: border.width
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
border.width: Style.borderS
|
border.width: Style.borderS
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ Singleton {
|
|||||||
const newUsedGb = {};
|
const newUsedGb = {};
|
||||||
const newSizeGb = {};
|
const newSizeGb = {};
|
||||||
const newAvailableGb = {};
|
const newAvailableGb = {};
|
||||||
const bytesPerGb = 1024 * 1024 * 1024;
|
const bytesPerGb = 1000 * 1000 * 1000;
|
||||||
// Start from line 1 (skip header)
|
// Start from line 1 (skip header)
|
||||||
for (var i = 1; i < lines.length; i++) {
|
for (var i = 1; i < lines.length; i++) {
|
||||||
const parts = lines[i].trim().split(/\s+/);
|
const parts = lines[i].trim().split(/\s+/);
|
||||||
|
|||||||
Reference in New Issue
Block a user