diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-27 21:55:02 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-27 21:55:02 +1100 |
| commit | df3b51399cbe82b083ef04230f3b340e12621afb (patch) | |
| tree | 666a6f23df7cd6f06cd1c00b72ca6312b57f45b3 /src/utils | |
| parent | popupwindow: fix offscreen popup (diff) | |
| download | caelestia-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')
| -rw-r--r-- | src/utils/system.ts | 6 | ||||
| -rw-r--r-- | src/utils/widgets.ts | 7 |
2 files changed, 12 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()); diff --git a/src/utils/widgets.ts b/src/utils/widgets.ts index 64325a0..454a7a6 100644 --- a/src/utils/widgets.ts +++ b/src/utils/widgets.ts @@ -50,3 +50,10 @@ export class MenuItem extends astalify(Gtk.MenuItem) { super(props as any); } } + +@register() +export class Calendar extends astalify(Gtk.Calendar) { + constructor(props: ConstructProps<Calendar, Gtk.Calendar.ConstructorProps>) { + super(props as any); + } +} |