summaryrefslogtreecommitdiff
path: root/src/utils/system.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-27 21:55:02 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-27 21:55:02 +1100
commitdf3b51399cbe82b083ef04230f3b340e12621afb (patch)
tree666a6f23df7cd6f06cd1c00b72ca6312b57f45b3 /src/utils/system.ts
parentpopupwindow: fix offscreen popup (diff)
downloadcaelestia-shell-df3b51399cbe82b083ef04230f3b340e12621afb.tar.gz
caelestia-shell-df3b51399cbe82b083ef04230f3b340e12621afb.tar.bz2
caelestia-shell-df3b51399cbe82b083ef04230f3b340e12621afb.zip
sideright: make popdown window
Weather requires a weather api key from https://weatherapi.com
Diffstat (limited to 'src/utils/system.ts')
-rw-r--r--src/utils/system.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils/system.ts b/src/utils/system.ts
index c318c64..31e9cfd 100644
--- a/src/utils/system.ts
+++ b/src/utils/system.ts
@@ -1,4 +1,4 @@
-import { execAsync, GLib, type Gio } from "astal";
+import { bind, execAsync, GLib, Variable, type Gio } from "astal";
import type AstalApps from "gi://AstalApps";
import { osIcons } from "./icons";
@@ -63,3 +63,7 @@ export const osIcon = String.fromCodePoint(
return 0xf31a;
})()
);
+
+export const currentTime = Variable(GLib.DateTime.new_now_local()).poll(1000, () => GLib.DateTime.new_now_local());
+export const bindCurrentTime = (format: string, fallback?: (time: GLib.DateTime) => string) =>
+ bind(currentTime).as(c => c.format(format) ?? fallback?.(c) ?? new Date().toLocaleString());