nixrice/misc/.config/ags/modules/bar/clock.js
2024-03-18 17:14:15 -04:00

32 lines
802 B
JavaScript

const { exec, execAsync } = Utils;
export const Date = () => Widget.Button({
child: Widget.Label({
class_name: "module",
setup: (self) => {
self.poll(1000, (self) =>
execAsync(["date", "+ %a %b %e"])
.then((time) => (self.label = time))
.catch(console.error),
);
},
}),
on_clicked: () => {
},
});
export const Time = () => Widget.Button({
child: Widget.Label({
class_name: "module",
setup: (self) => {
self.poll(1000, (self) =>
execAsync(["date", "+ %R"])
.then((time) => (self.label = time))
.catch(console.error),
);
},
}),
on_clicked: () => {
},
});