refactor(wim ags): make main file for notif widgets
This commit is contained in:
parent
369fd32e54
commit
f85df15e93
5 changed files with 50 additions and 52 deletions
|
@ -7,16 +7,16 @@ import Bar from './js/bar/main.js';
|
|||
import BgFade from './js/misc/background-fade.js';
|
||||
import Calendar from './js/date.js';
|
||||
import Corners from './js/corners/main.js';
|
||||
import NotifCenter from './js/notifications/center.js';
|
||||
import NotifPopups from './js/notifications/popup.js';
|
||||
import { NotifPopups, NotifCenter } from './js/notifications/main.js';
|
||||
import OSD from './js/osd/main.js';
|
||||
import OSK from './js/on-screen-keyboard/main.js';
|
||||
import Overview from './js/overview/main.js';
|
||||
import Powermenu from './js/powermenu.js';
|
||||
import QSettings from './js/quick-settings/main.js';
|
||||
|
||||
const scss = App.configDir + '/scss/main.scss';
|
||||
const css = App.configDir + '/style.css';
|
||||
const scss = `${App.configDir }/scss/main.scss`;
|
||||
const css = `${App.configDir }/style.css`;
|
||||
|
||||
exec(`sassc ${scss} ${css}`);
|
||||
Setup();
|
||||
|
||||
|
|
|
@ -3,12 +3,8 @@ import Notifications from 'resource:///com/github/Aylur/ags/service/notification
|
|||
|
||||
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
|
||||
import Separator from '../../misc/separator.js';
|
||||
import EventBox from '../../misc/cursorbox.js';
|
||||
|
||||
const L_PADDING = 28;
|
||||
const R_PADDING = 8;
|
||||
|
||||
|
||||
export default () => EventBox({
|
||||
className: 'toggle-off',
|
||||
|
@ -26,9 +22,8 @@ export default () => EventBox({
|
|||
vertical: false,
|
||||
|
||||
children: [
|
||||
Separator(L_PADDING),
|
||||
|
||||
Icon({
|
||||
hpack: 'center',
|
||||
connections: [[Notifications, (self) => {
|
||||
if (Notifications.dnd) {
|
||||
self.icon = 'notification-disabled-symbolic';
|
||||
|
@ -41,9 +36,6 @@ export default () => EventBox({
|
|||
}
|
||||
}]],
|
||||
}),
|
||||
|
||||
Separator(R_PADDING),
|
||||
|
||||
Label({
|
||||
binds: [['label', Notifications, 'notifications',
|
||||
(n) => String(n.length)]],
|
||||
|
|
|
@ -3,7 +3,6 @@ import Notifications from 'resource:///com/github/Aylur/ags/service/notification
|
|||
import { Button, Label, Box, Icon, Scrollable, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
|
||||
import { Notification, HasNotifs } from './base.js';
|
||||
import PopupWindow from '../misc/popup.js';
|
||||
import EventBox from '../misc/cursorbox.js';
|
||||
|
||||
|
||||
|
@ -100,7 +99,7 @@ const Placeholder = () => Revealer({
|
|||
}),
|
||||
});
|
||||
|
||||
const NotificationCenterWidget = () => Box({
|
||||
export default () => Box({
|
||||
className: 'notification-center',
|
||||
vertical: true,
|
||||
children: [
|
||||
|
@ -124,13 +123,3 @@ const NotificationCenterWidget = () => Box({
|
|||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const TOP_MARGIN = 6;
|
||||
const RIGHT_MARGIN = 60;
|
||||
|
||||
export default () => PopupWindow({
|
||||
name: 'notification-center',
|
||||
anchor: ['top', 'right'],
|
||||
margins: [TOP_MARGIN, RIGHT_MARGIN, 0, 0],
|
||||
child: NotificationCenterWidget(),
|
||||
});
|
||||
|
|
26
devices/wim/config/ags/js/notifications/main.js
Normal file
26
devices/wim/config/ags/js/notifications/main.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import PopUpsWidget from './popup.js';
|
||||
import NotifCenterWidget from './center.js';
|
||||
|
||||
import PopupWindow from '../misc/popup.js';
|
||||
|
||||
export const NotifPopups = () => PopupWindow({
|
||||
name: 'notifications',
|
||||
anchor: ['top', 'left'],
|
||||
visible: true,
|
||||
transition: 'none',
|
||||
closeOnUnfocus: 'stay',
|
||||
|
||||
child: PopUpsWidget(),
|
||||
});
|
||||
|
||||
|
||||
const TOP_MARGIN = 6;
|
||||
const RIGHT_MARGIN = 60;
|
||||
|
||||
export const NotifCenter = () => PopupWindow({
|
||||
name: 'notification-center',
|
||||
anchor: ['top', 'right'],
|
||||
margins: [TOP_MARGIN, RIGHT_MARGIN, 0, 0],
|
||||
|
||||
child: NotifCenterWidget(),
|
||||
});
|
|
@ -6,7 +6,6 @@ import { interval } from 'resource:///com/github/Aylur/ags/utils.js';
|
|||
import GLib from 'gi://GLib';
|
||||
|
||||
import { Notification } from './base.js';
|
||||
import PopupWindow from '../misc/popup.js';
|
||||
|
||||
const DELAY = 2000;
|
||||
|
||||
|
@ -55,14 +54,7 @@ const handleDismiss = (box, id, force = false) => {
|
|||
}
|
||||
};
|
||||
|
||||
export default () => PopupWindow({
|
||||
name: 'notifications',
|
||||
anchor: ['top', 'left'],
|
||||
visible: true,
|
||||
transition: 'none',
|
||||
closeOnUnfocus: 'stay',
|
||||
|
||||
child: Box({
|
||||
export default () => Box({
|
||||
vertical: true,
|
||||
|
||||
connections: [
|
||||
|
@ -70,5 +62,4 @@ export default () => PopupWindow({
|
|||
[Notifications, (s, id) => handleDismiss(s, id), 'dismissed'],
|
||||
[Notifications, (s, id) => handleDismiss(s, id, true), 'closed'],
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue