fix(ags): make revealers work on first try

This commit is contained in:
matt1432 2023-09-25 12:30:32 -04:00
parent 5a609dc463
commit 0b4c525cf3
6 changed files with 22 additions and 28 deletions

View file

@ -71,6 +71,7 @@ const CalendarWidget = () => Box({
export const Calendar = Window({
name: 'calendar',
layer: 'overlay',
popup: true,
anchor: 'top right',
margin: [ 8, 182, 0, 0],
child: PopUp({

View file

@ -1,31 +1,20 @@
const { Revealer } = ags.Widget;
const { closeWindow, openWindow } = ags.App;
const { Revealer, Box } = ags.Widget;
const { openWindow } = ags.App;
export const PopUp = ({name, child, transition = 'slide_down', ...params}) => Revealer({
...params,
// FIXME: popups don't work with revealers
setup: () => {
setTimeout(() => {
closeWindow(name);
}, 100);
export const PopUp = ({name, child, transition = 'slide_down', ...params}) => Box({
style: 'min-height:1px; min-width:1px',
child: Revealer({
...params,
transition,
transitionDuration: 500,
connections: [[ags.App, (revealer, currentName, visible) => {
if (currentName === name) {
revealer.reveal_child = visible;
// my eyes hurt
if (name == 'overview') {
setTimeout(() => {
openWindow(name);
closeWindow(name);
}, 700);
}
},
transition,
transitionDuration: 500,
connections: [[ags.App, (revealer, currentName, visible) => {
if (currentName === name) {
revealer.reveal_child = visible;
if (visible && name !== 'overview')
openWindow('closer');
}
}]],
child: child,
if (visible && name !== 'overview')
openWindow('closer');
}
}]],
child: child,
}),
});

View file

@ -136,6 +136,7 @@ export const NotificationCenter = Window({
name: 'notification-center',
layer: 'overlay',
anchor: 'top right',
popup: true,
margin: [ 8, 60, 0, 0 ],
child: PopUp({
name: 'notification-center',

View file

@ -8,6 +8,7 @@ import { updateClients } from './clients.js';
export default Window({
name: 'overview',
layer: 'overlay',
popup: true,
child: PopUp({
name: 'overview',

View file

@ -37,6 +37,7 @@ const PowermenuWidget = CenterBox({
export const Powermenu = Window({
name: 'powermenu',
popup: true,
layer: 'overlay',
child: PopUp({
name: 'powermenu',

View file

@ -71,6 +71,7 @@ export const QuickSettings = Window({
name: 'quick-settings',
layer: 'overlay',
anchor: 'top right',
popup: true,
margin: [ 8, 5, 0, ],
child: PopUp({
name: 'quick-settings',