summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-11 15:59:39 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-11 15:59:39 +1000
commit1e1cdd95c1cb81e40c9198ab644badb348332389 (patch)
tree85bfc01b6d7bb366e57891426f57024955d8d303 /utils
parentlock: better scaling for weather & fetch (diff)
downloadcaelestia-shell-1e1cdd95c1cb81e40c9198ab644badb348332389.tar.gz
caelestia-shell-1e1cdd95c1cb81e40c9198ab644badb348332389.tar.bz2
caelestia-shell-1e1cdd95c1cb81e40c9198ab644badb348332389.zip
lock/fetch: shell -> uptime + no qsTr
Diffstat (limited to 'utils')
-rw-r--r--utils/SysInfo.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/utils/SysInfo.qml b/utils/SysInfo.qml
index 968dc52..91ef112 100644
--- a/utils/SysInfo.qml
+++ b/utils/SysInfo.qml
@@ -2,6 +2,7 @@ pragma Singleton
import Quickshell
import Quickshell.Io
+import QtQuick
Singleton {
id: root
@@ -13,6 +14,7 @@ Singleton {
property string logo
property string osIcon: ""
+ property string uptime
readonly property string user: Quickshell.env("USER")
readonly property string wm: Quickshell.env("XDG_CURRENT_DESKTOP") || Quickshell.env("XDG_SESSION_DESKTOP")
readonly property string shell: Quickshell.env("SHELL").split("/").pop()
@@ -44,4 +46,33 @@ Singleton {
}
}
}
+
+ Timer {
+ running: true
+ repeat: true
+ interval: 15000
+ onTriggered: fileUptime.reload()
+ }
+
+ FileView {
+ id: fileUptime
+
+ path: "/proc/uptime"
+ onLoaded: {
+ const up = parseInt(text().split(" ")[0] ?? 0);
+
+ const days = Math.floor(up / 86400);
+ const hours = Math.floor((up % 86400) / 3600);
+ const minutes = Math.floor((up % 3600) / 60);
+
+ let str = "";
+ if (days > 0)
+ str += `${days} day${days === 1 ? "" : "s"}`;
+ if (hours > 0)
+ str += `${str ? ", " : ""}${hours} hour${hours === 1 ? "" : "s"}`;
+ if (minutes > 0 || !str)
+ str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`;
+ root.uptime = str;
+ }
+ }
}