2023-10-31 08:32:40 -04:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
|
|
|
import { Box, 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-10-17 13:47:02 -04:00
|
|
|
import EventBox from '../misc/cursorbox.js';
|
2023-09-11 21:10:00 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-09-05 19:22:54 -04:00
|
|
|
const ClockModule = ({
|
|
|
|
interval = 1000,
|
2023-10-17 13:47:02 -04:00
|
|
|
...props
|
2023-09-05 19:22:54 -04:00
|
|
|
}) => Label({
|
2023-10-17 13:47:02 -04:00
|
|
|
...props,
|
2023-09-05 19:22:54 -04:00
|
|
|
className: 'clock',
|
2023-09-05 19:57:34 -04:00
|
|
|
connections: [
|
2023-10-20 23:11:21 -04:00
|
|
|
[interval, self => {
|
|
|
|
var time = DateTime.new_now_local();
|
|
|
|
self.label = time.format('%a. ') +
|
2023-10-17 13:47:02 -04:00
|
|
|
time.get_day_of_month() +
|
|
|
|
time.format(' %b. %H:%M');
|
2023-10-20 23:11:21 -04:00
|
|
|
}],
|
2023-09-05 19:57:34 -04: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',
|
|
|
|
onPrimaryClickRelease: () => App.toggleWindow('calendar'),
|
|
|
|
connections: [
|
|
|
|
[App, (self, windowName, visible) => {
|
|
|
|
if (windowName == 'calendar')
|
|
|
|
self.toggleClassName('toggle-on', visible);
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
child: Box({
|
|
|
|
child: ClockModule({}),
|
|
|
|
}),
|
2023-09-05 19:22:54 -04:00
|
|
|
});
|