nixos-configs/devices/wim/config/ags/ts/bar/items/clock.ts
matt1432 7c0e1658da
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(ags wim): bundle all files through imports
2024-01-13 23:38:31 -05:00

31 lines
839 B
TypeScript

import App from 'resource:///com/github/Aylur/ags/app.js';
import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
const { DateTime } = imports.gi.GLib;
import CursorBox from '../../misc/cursorbox.ts';
export default () => CursorBox({
class_name: 'toggle-off',
on_primary_click_release: () => App.toggleWindow('calendar'),
setup: (self) => {
self.hook(App, (_, windowName, visible) => {
if (windowName === 'calendar') {
self.toggleClassName('toggle-on', visible);
}
});
},
child: Label({ class_name: 'clock' })
.poll(1000, (self) => {
const time = DateTime.new_now_local();
self.label = time.format('%a. ') +
time.get_day_of_month() +
time.format(' %b. %H:%M');
}),
});