parent
5d27b3d975
commit
f3e06554e4
105 changed files with 245 additions and 254 deletions
nixosModules/ags/config/widgets/date
68
nixosModules/ags/config/widgets/date/_index.scss
Normal file
68
nixosModules/ags/config/widgets/date/_index.scss
Normal file
|
@ -0,0 +1,68 @@
|
|||
@use '../../style/colors';
|
||||
|
||||
.date {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.timebox {
|
||||
margin: 30px 0;
|
||||
|
||||
.time-container {
|
||||
.content {
|
||||
font-weight: bolder;
|
||||
font-size: 60px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin: 8px 15px;
|
||||
padding: 0 1px;
|
||||
background: linear-gradient(colors.$red, colors.$magenta, colors.$blue, colors.$cyan);
|
||||
}
|
||||
}
|
||||
|
||||
.date-container {
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.cal-box {
|
||||
padding: 0 1rem .2rem;
|
||||
margin: 0 12px 18px;
|
||||
|
||||
calendar {
|
||||
font-size: 20px;
|
||||
background-color: inherit;
|
||||
padding: .5rem .10rem 0;
|
||||
margin-left: 10px;
|
||||
|
||||
&>* {
|
||||
border: solid 0 transparent;
|
||||
}
|
||||
|
||||
&.highlight {
|
||||
padding: 10rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calendar:selected {
|
||||
color: colors.$cyan;
|
||||
}
|
||||
|
||||
calendar.header {
|
||||
color: colors.$cyan;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
calendar.button {
|
||||
color: colors.$cyan;
|
||||
}
|
||||
|
||||
calendar.highlight {
|
||||
color: colors.$green;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
calendar:indeterminate {
|
||||
color: colors.$lightblack;
|
||||
}
|
18
nixosModules/ags/config/widgets/date/binto.tsx
Normal file
18
nixosModules/ags/config/widgets/date/binto.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Astal } from 'astal/gtk3';
|
||||
|
||||
import PopupWindow from '../misc/popup-window';
|
||||
import { get_gdkmonitor_from_desc } from '../../lib';
|
||||
|
||||
import DateWidget from './main';
|
||||
|
||||
|
||||
export default () => (
|
||||
<PopupWindow
|
||||
name="calendar"
|
||||
gdkmonitor={get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201')}
|
||||
anchor={Astal.WindowAnchor.BOTTOM}
|
||||
transition="slide bottom"
|
||||
>
|
||||
<DateWidget />
|
||||
</PopupWindow>
|
||||
);
|
86
nixosModules/ags/config/widgets/date/main.tsx
Normal file
86
nixosModules/ags/config/widgets/date/main.tsx
Normal file
|
@ -0,0 +1,86 @@
|
|||
import { bind, Variable } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
|
||||
const Divider = () => (
|
||||
<box
|
||||
className="divider"
|
||||
vertical
|
||||
/>
|
||||
);
|
||||
|
||||
const Time = () => {
|
||||
const hour = Variable<string>('').poll(1000, () => GLib.DateTime.new_now_local().format('%H') || '');
|
||||
const min = Variable<string>('').poll(1000, () => GLib.DateTime.new_now_local().format('%M') || '');
|
||||
|
||||
const fullDate = Variable<string>('').poll(1000, () => {
|
||||
const time = GLib.DateTime.new_now_local();
|
||||
|
||||
const dayNameMonth = time.format('%A, %B ');
|
||||
const dayNum = time.get_day_of_month();
|
||||
const date = time.format(', %Y');
|
||||
|
||||
return dayNum && dayNameMonth && date ?
|
||||
dayNameMonth + dayNum + date :
|
||||
'';
|
||||
});
|
||||
|
||||
return (
|
||||
<box
|
||||
className="timebox"
|
||||
vertical
|
||||
>
|
||||
<box
|
||||
className="time-container"
|
||||
halign={Gtk.Align.CENTER}
|
||||
valign={Gtk.Align.CENTER}
|
||||
>
|
||||
<label
|
||||
className="content"
|
||||
label={bind(hour)}
|
||||
/>
|
||||
|
||||
<Divider />
|
||||
|
||||
<label
|
||||
className="content"
|
||||
label={bind(min)}
|
||||
/>
|
||||
</box>
|
||||
|
||||
<box
|
||||
className="date-container"
|
||||
halign={Gtk.Align.CENTER}
|
||||
>
|
||||
<label
|
||||
css="font-size: 20px;"
|
||||
label={bind(fullDate)}
|
||||
/>
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
};
|
||||
|
||||
export default () => {
|
||||
const cal = new Gtk.Calendar({
|
||||
show_day_names: true,
|
||||
show_heading: true,
|
||||
});
|
||||
|
||||
cal.show_all();
|
||||
|
||||
return (
|
||||
<box
|
||||
className="date widget"
|
||||
vertical
|
||||
>
|
||||
<Time />
|
||||
|
||||
<box className="cal-box">
|
||||
{cal}
|
||||
</box>
|
||||
</box>
|
||||
);
|
||||
};
|
15
nixosModules/ags/config/widgets/date/wim.tsx
Normal file
15
nixosModules/ags/config/widgets/date/wim.tsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Astal } from 'astal/gtk3';
|
||||
|
||||
import PopupWindow from '../misc/popup-window';
|
||||
|
||||
import DateWidget from './main';
|
||||
|
||||
|
||||
export default () => (
|
||||
<PopupWindow
|
||||
name="calendar"
|
||||
anchor={Astal.WindowAnchor.TOP}
|
||||
>
|
||||
<DateWidget />
|
||||
</PopupWindow>
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue