nixos-configs/modules/ags/config/ts/bar/items/clock.ts

17 lines
450 B
TypeScript
Raw Normal View History

const { Label } = Widget;
2024-01-22 10:23:32 -05:00
const { new_now_local } = imports.gi.GLib.DateTime;
2023-11-27 15:50:20 -05:00
export default () => Label({ class_name: 'clock' })
.poll(1000, (self) => {
2024-01-22 10:23:32 -05:00
const time = new_now_local();
2023-11-27 15:50:20 -05:00
2024-01-22 10:23:32 -05:00
const dayName = time.format('%a. ');
const dayNum = time.get_day_of_month();
const date = time.format(' %b. %H:%M');
if (dayNum && dayName && date) {
self.label = dayName + dayNum + date;
}
});