nixos/modules/home/ags/app/widget/Clock.tsx

13 lines
368 B
TypeScript

import GLib from "gi://GLib"
import { Variable, bind } from "astal"
const time = Variable("").poll(1000, () => {
const now = GLib.DateTime.new_now_local()
const clock = now.format("%I:%M %p")!.replace(/^0/, "")
return `${now.format("%a, %d %b")}, ${clock}`
})
export default function Clock() {
return <label className="clock" label={bind(time)} />
}