2023-10-31 08:32:40 -04:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
2023-11-21 01:29:46 -05:00
|
|
|
|
|
|
|
import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-10-02 12:06:35 -04:00
|
|
|
|
|
|
|
import GLib from 'gi://GLib';
|
|
|
|
const { DateTime } = GLib;
|
2023-09-05 19:22:54 -04:00
|
|
|
|
2023-11-16 00:48:50 -05:00
|
|
|
import EventBox from '../../misc/cursorbox.js';
|
2023-09-11 21:10:00 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
const ClockModule = () => Label({
|
|
|
|
className: 'clock',
|
|
|
|
|
|
|
|
setup: (self) => {
|
|
|
|
self.poll(1000, () => {
|
2023-11-21 01:29:46 -05:00
|
|
|
const time = DateTime.new_now_local();
|
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
self.label = time.format('%a. ') +
|
2023-11-21 01:29:46 -05:00
|
|
|
time.get_day_of_month() +
|
|
|
|
time.format(' %b. %H:%M');
|
2023-12-17 00:01:58 -05:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
2023-09-05 19:22:54 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
export default () => EventBox({
|
2023-10-20 23:11:21 -04:00
|
|
|
className: 'toggle-off',
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
onPrimaryClickRelease: () => App.toggleWindow('calendar'),
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
setup: (self) => {
|
|
|
|
self.hook(App, (_, windowName, visible) => {
|
2023-11-21 01:29:46 -05:00
|
|
|
if (windowName === 'calendar') {
|
2023-10-20 23:11:21 -04:00
|
|
|
self.toggleClassName('toggle-on', visible);
|
2023-11-21 01:29:46 -05:00
|
|
|
}
|
2023-12-17 00:01:58 -05:00
|
|
|
});
|
|
|
|
},
|
2023-11-21 01:29:46 -05:00
|
|
|
|
|
|
|
child: ClockModule(),
|
2023-09-05 19:22:54 -04:00
|
|
|
});
|