aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/Logic.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-17 12:15:49 +0200
committerDanilo M. <danix@danix.xyz>2026-10-17 12:15:49 +0200
commit59fc42e0e23911abeec84fb3bc6c2fcf77ae08c6 (patch)
tree1780c3430649c0e24924be241d62a76b9085e64b /desktop/island/Logic.js
parent65c664e716a17fa3e200cc86131f514f5a817d60 (diff)
downloadquickshell-59fc42e0e23911abeec84fb3bc6c2fcf77ae08c6.tar.gz
quickshell-59fc42e0e23911abeec84fb3bc6c2fcf77ae08c6.zip
island: elapsed-time helper for the OBS pill
Diffstat (limited to 'desktop/island/Logic.js')
-rw-r--r--desktop/island/Logic.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/desktop/island/Logic.js b/desktop/island/Logic.js
index e79625c..24458cd 100644
--- a/desktop/island/Logic.js
+++ b/desktop/island/Logic.js
@@ -62,3 +62,12 @@ function parseOpenWindow(data) {
const p = String(data || "").split(",");
return { address: p[0] || "", workspace: p[1] || "", appClass: p[2] || "" };
}
+
+// OBS's outputDuration (ms) as mm:ss, or h:mm:ss past an hour.
+function obsElapsed(ms) {
+ const s = Math.floor((ms > 0 ? ms : 0) / 1000);
+ const two = n => String(n).padStart(2, "0");
+ const h = Math.floor(s / 3600);
+ const mmss = `${two(Math.floor(s / 60) % 60)}:${two(s % 60)}`;
+ return h ? `${h}:${mmss}` : mmss;
+}