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

18 lines
478 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 (
<box spacing={6}>
<icon icon="clock-hands-symbolic" />
<label className="clock" label={bind(time)} />
</box>
)
}