2023-09-05 19:22:54 -04:00
|
|
|
const { Box, Label } = ags.Widget;
|
2023-09-21 20:01:14 -04:00
|
|
|
const { toggleWindow } = ags.App;
|
2023-09-05 19:22:54 -04:00
|
|
|
const { DateTime } = imports.gi.GLib;
|
|
|
|
|
2023-09-11 21:10:00 -04:00
|
|
|
import { EventBox } from '../misc/cursorbox.js';
|
|
|
|
|
2023-09-05 19:22:54 -04:00
|
|
|
const ClockModule = ({
|
|
|
|
interval = 1000,
|
2023-09-10 23:24:58 -04:00
|
|
|
...params
|
2023-09-05 19:22:54 -04:00
|
|
|
}) => Label({
|
2023-09-10 23:24:58 -04:00
|
|
|
...params,
|
2023-09-05 19:22:54 -04:00
|
|
|
className: 'clock',
|
2023-09-05 19:57:34 -04:00
|
|
|
connections: [
|
|
|
|
[interval, label => {
|
|
|
|
var time = DateTime.new_now_local();
|
|
|
|
label.label = time.format('%a. ') + time.get_day_of_month() + time.format(' %b. %H:%M');
|
|
|
|
}],
|
|
|
|
],
|
2023-09-05 19:22:54 -04:00
|
|
|
});
|
|
|
|
|
2023-09-11 21:10:00 -04:00
|
|
|
export const Clock = EventBox({
|
2023-09-05 19:22:54 -04:00
|
|
|
className: 'toggle-off',
|
2023-09-12 09:37:48 -04:00
|
|
|
onPrimaryClickRelease: () => toggleWindow('calendar'),
|
|
|
|
connections: [
|
|
|
|
[ags.App, (box, windowName, visible) => {
|
|
|
|
if (windowName == 'calendar') {
|
2023-09-21 20:01:14 -04:00
|
|
|
box.toggleClassName('toggle-on', visible);
|
2023-09-12 09:37:48 -04:00
|
|
|
}
|
|
|
|
}],
|
|
|
|
],
|
2023-09-11 21:10:00 -04:00
|
|
|
child: Box({
|
|
|
|
child: ClockModule({}),
|
|
|
|
}),
|
2023-09-05 19:22:54 -04:00
|
|
|
});
|