1d5fe06f8a
this will make easier to work with multiple configuration files at the same time
22 lines
823 B
TypeScript
22 lines
823 B
TypeScript
import { Gtk } from "ags/gtk4";
|
|
import { Windows } from "../../windows";
|
|
import { createBinding } from "ags";
|
|
import { time } from "../../scripts/utils";
|
|
import { generalConfig } from "../../app";
|
|
|
|
|
|
export const Clock = () =>
|
|
<Gtk.Button class={createBinding(Windows.getDefault(), "openWindows").as((wins) =>
|
|
`clock ${wins.includes("center-window") ? "open" : ""}`)}
|
|
$={(self) => {
|
|
const conns: Array<number> = [
|
|
self.connect("clicked", (_) => Windows.getDefault().toggle("center-window")),
|
|
self.connect("destroy", (_) => conns.forEach(id => self.disconnect(id)))
|
|
];
|
|
}}
|
|
label={time((dt) => dt.format(
|
|
generalConfig.getProperty("clock.date_format", "string"))
|
|
?? "An error occurred"
|
|
)}
|
|
/>;
|