2023-10-02 12:06:35 -04:00
|
|
|
import { Widget } from '../imports.js';
|
2023-10-08 00:43:35 -04:00
|
|
|
const { Box, Label } = Widget;
|
2023-10-02 12:06:35 -04:00
|
|
|
|
|
|
|
import Gtk from 'gi://Gtk';
|
|
|
|
import GLib from 'gi://GLib';
|
|
|
|
const { DateTime } = GLib;
|
2023-09-11 21:10:00 -04:00
|
|
|
|
2023-10-08 00:43:35 -04:00
|
|
|
import { PopupWindow } from './misc/popup.js';
|
2023-09-21 20:01:14 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-09-11 21:10:00 -04:00
|
|
|
const Divider = () => Box({
|
|
|
|
className: 'divider',
|
|
|
|
vertical: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const Time = () => Box({
|
|
|
|
className: 'timebox',
|
|
|
|
vertical: true,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Box({
|
|
|
|
className: 'time-container',
|
|
|
|
halign: 'center',
|
|
|
|
valign: 'center',
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Label({
|
|
|
|
className: 'content',
|
|
|
|
label: 'hour',
|
|
|
|
connections: [[1000, label => {
|
|
|
|
label.label = DateTime.new_now_local().format('%H');
|
|
|
|
}]],
|
|
|
|
}),
|
|
|
|
|
|
|
|
Divider(),
|
|
|
|
|
|
|
|
Label({
|
|
|
|
className: 'content',
|
|
|
|
label: 'minute',
|
|
|
|
connections: [[1000, label => {
|
|
|
|
label.label = DateTime.new_now_local().format('%M');
|
|
|
|
}]],
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
|
|
|
|
Box({
|
|
|
|
className: 'date-container',
|
|
|
|
halign: 'center',
|
|
|
|
child: Label({
|
|
|
|
style: 'font-size: 20px',
|
|
|
|
label: 'complete date',
|
|
|
|
connections: [[1000, label => {
|
|
|
|
var time = DateTime.new_now_local();
|
|
|
|
label.label = time.format("%A, %B ") + time.get_day_of_month() + time.format(", %Y");
|
|
|
|
}]],
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
const CalendarWidget = () => Box({
|
|
|
|
className: 'cal-box',
|
2023-10-02 12:06:35 -04:00
|
|
|
child: Widget({
|
2023-09-11 21:10:00 -04:00
|
|
|
type: Gtk.Calendar,
|
|
|
|
showDayNames: true,
|
|
|
|
showHeading: true,
|
|
|
|
className: 'cal',
|
|
|
|
connections: [/* */]
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
2023-10-16 18:11:19 -04:00
|
|
|
export default () => PopupWindow({
|
2023-10-07 21:02:23 -04:00
|
|
|
anchor: [ 'top', 'right' ],
|
2023-09-12 23:53:48 -04:00
|
|
|
margin: [ 8, 182, 0, 0],
|
2023-10-08 00:43:35 -04:00
|
|
|
name: 'calendar',
|
|
|
|
child: Box({
|
|
|
|
className: 'date',
|
|
|
|
vertical: true,
|
|
|
|
children: [
|
|
|
|
Time(),
|
|
|
|
CalendarWidget(),
|
|
|
|
],
|
2023-09-11 21:10:00 -04:00
|
|
|
}),
|
|
|
|
});
|