style(ags): make it easier on my eyes

This commit is contained in:
matt1432 2023-09-11 14:18:22 -04:00
parent 49f0ea7750
commit 2bd7b36392
3 changed files with 111 additions and 110 deletions

View file

@ -14,12 +14,12 @@ exec(`sassc ${scss} ${css}`);
exec(`bash -c "$AGS_PATH/startup.sh"`); exec(`bash -c "$AGS_PATH/startup.sh"`);
export default { export default {
style: css, style: css,
windows: [ windows: [
Powermenu, Powermenu,
Bar, Bar,
Closer, Closer,
NotificationCenter, NotificationCenter,
NotificationsPopupList, NotificationsPopupList,
] ],
} };

View file

@ -3,61 +3,62 @@ const { Notifications } = ags.Service;
const { Button, Label, Box, Icon, Scrollable, Window } = ags.Widget; const { Button, Label, Box, Icon, Scrollable, Window } = ags.Widget;
const ClearButton = () => Button({ const ClearButton = () => Button({
onClicked: Notifications.clear, onClicked: Notifications.clear,
connections: [[Notifications, button => { connections: [[Notifications, button => {
button.sensitive = Notifications.notifications.length > 0; button.sensitive = Notifications.notifications.length > 0;
}]], }]],
child: Box({ child: Box({
children: [ children: [
Label('Clear '), Label('Clear '),
Icon({ Icon({
connections: [[Notifications, icon => { connections: [[Notifications, icon => {
icon.icon = Notifications.notifications.length > 0 icon.icon = Notifications.notifications.length > 0
? 'user-trash-full-symbolic' : 'user-trash-symbolic'; ? 'user-trash-full-symbolic' : 'user-trash-symbolic';
}]], }]],
}), }),
], ],
}), }),
}); });
const Header = () => Box({ const Header = () => Box({
className: 'header', className: 'header',
children: [ children: [
Label({ label: 'Notifications', hexpand: true, xalign: 0 }), Label({ label: 'Notifications', hexpand: true, xalign: 0 }),
ClearButton(), ClearButton(),
], ],
}); });
const NotificationList = () => Box({ const NotificationList = () => Box({
vertical: true, vertical: true,
vexpand: true, vexpand: true,
connections: [[Notifications, box => { connections: [[Notifications, box => {
box.children = Notifications.notifications box.children = Notifications.notifications
.reverse() .reverse()
.map(n => Notification(n)); .map(n => Notification(n));
box.visible = Notifications.notifications.length > 0; box.visible = Notifications.notifications.length > 0;
}]], }]],
}); });
const Placeholder = () => Box({ const Placeholder = () => Box({
className: 'placeholder', className: 'placeholder',
vertical: true, vertical: true,
valign: 'center', valign: 'center',
halign: 'center', halign: 'center',
vexpand: true, vexpand: true,
hexpand: true, hexpand: true,
children: [ children: [
Icon('notifications-disabled-symbolic'), Icon('notification-disabled-symbolic'),
Label('Your inbox is empty'), Label('Your inbox is empty'),
], ],
connections: [[Notifications, box => { connections: [[Notifications, box => {
box.visible = Notifications.notifications.length === 0; box.visible = Notifications.notifications.length === 0;
}]], }]],
}); });
export const NotificationCenter = Window({ export const NotificationCenter = Window({
name: 'notification-center', name: 'notification-center',
popup: true,
layer: 'overlay', layer: 'overlay',
anchor: 'top right', anchor: 'top right',
className: 'dashboard', className: 'dashboard',
@ -65,23 +66,23 @@ export const NotificationCenter = Window({
className: 'notifications', className: 'notifications',
vertical: true, vertical: true,
children: [ children: [
Header(), Header(),
Box({ Box({
className: 'notification-wallpaper-box', className: 'notification-wallpaper-box',
children: [Scrollable({ children: [Scrollable({
className: 'notification-list-box', className: 'notification-list-box',
hscroll: 'never', hscroll: 'never',
vscroll: 'automatic', vscroll: 'automatic',
child: Box({ child: Box({
className: 'notification-list', className: 'notification-list',
vertical: true, vertical: true,
children: [ children: [
NotificationList(), NotificationList(),
Placeholder(), Placeholder(),
], ],
}), }),
})], })],
}), }),
], ],
}), }),
}); });

View file

@ -4,56 +4,56 @@ const { Box, Revealer, Window } = ags.Widget;
const { timeout } = ags.Utils; const { timeout } = ags.Utils;
const Popups = () => Box({ const Popups = () => Box({
vertical: true, vertical: true,
properties: [ properties: [
['map', new Map()], ['map', new Map()],
['dismiss', (box, id, force = false) => { ['dismiss', (box, id, force = false) => {
if (!id || !box._map.has(id)) if (!id || !box._map.has(id))
return; return;
if (box._map.get(id)._hovered && !force) if (box._map.get(id)._hovered && !force)
return; return;
if (box._map.size - 1 === 0) if (box._map.size - 1 === 0)
box.get_parent().reveal_child = false; box.get_parent().reveal_child = false;
timeout(200, () => { timeout(200, () => {
box._map.get(id)?.destroy(); box._map.get(id)?.destroy();
box._map.delete(id); box._map.delete(id);
}); });
}], }],
['notify', (box, id) => { ['notify', (box, id) => {
if (!id || Notifications.dnd) if (!id || Notifications.dnd)
return; return;
box._map.delete(id); box._map.delete(id);
box._map.set(id, Notification(Notifications.getNotification(id))); box._map.set(id, Notification(Notifications.getNotification(id)));
box.children = Array.from(box._map.values()).reverse(); box.children = Array.from(box._map.values()).reverse();
timeout(10, () => { timeout(10, () => {
box.get_parent().revealChild = true; box.get_parent().revealChild = true;
}); });
}], }],
], ],
connections: [ connections: [
[Notifications, (box, id) => box._notify(box, id), 'notified'], [Notifications, (box, id) => box._notify(box, id), 'notified'],
[Notifications, (box, id) => box._dismiss(box, id), 'dismissed'], [Notifications, (box, id) => box._dismiss(box, id), 'dismissed'],
[Notifications, (box, id) => box._dismiss(box, id, true), 'closed'], [Notifications, (box, id) => box._dismiss(box, id, true), 'closed'],
], ],
}); });
const PopupList = ({ transition = 'slide_down' } = {}) => Box({ const PopupList = ({ transition = 'slide_right' } = {}) => Box({
className: 'notifications-popup-list', className: 'notifications-popup-list',
style: 'padding: 1px', style: 'padding: 1px',
children: [ children: [
Revealer({ Revealer({
transition, transition,
child: Popups(), child: Popups(),
}), }),
], ],
}); });
export const NotificationsPopupList = Window({ export const NotificationsPopupList = Window({
name: `notifications`, name: `notifications`,
anchor: 'top', anchor: 'top left',
child: PopupList(), child: PopupList(),
}); });