From b7724c46d298010feb50eed49bdfef76926d6d98 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 28 Nov 2023 00:51:28 -0500 Subject: [PATCH] feat(wim ags overview): force consistent open anim --- devices/wim/config/ags/js/overview/clients.js | 2 +- devices/wim/config/ags/js/overview/main.js | 76 +++++++++++-------- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/devices/wim/config/ags/js/overview/clients.js b/devices/wim/config/ags/js/overview/clients.js index fdb1b8be..ade8db81 100644 --- a/devices/wim/config/ags/js/overview/clients.js +++ b/devices/wim/config/ags/js/overview/clients.js @@ -94,7 +94,7 @@ const Client = (client, active, clients, box) => { child: Icon({ className: `window ${active}`, - css: `${IconStyle(client) }font-size: 10px;`, + css: `${IconStyle(client)} font-size: 10px;`, icon: client.class, }), }), diff --git a/devices/wim/config/ags/js/overview/main.js b/devices/wim/config/ags/js/overview/main.js index d1330a4e..33db276d 100644 --- a/devices/wim/config/ags/js/overview/main.js +++ b/devices/wim/config/ags/js/overview/main.js @@ -9,15 +9,10 @@ import { Highlighter, updateCurrentWorkspace } from './current-workspace.js'; import { updateClients } from './clients.js'; -const update = (box, highlight) => { - getWorkspaces(box); - updateWorkspaces(box); - updateClients(box); - updateCurrentWorkspace(box, highlight); -}; + // TODO: have a 'page' for each monitor, arrows on both sides to loop through -export default () => { +export const Overview = () => { const highlighter = Highlighter(); const mainBox = Box({ @@ -50,7 +45,7 @@ export default () => { return; } - update(self, highlighter); + self.update(); }]], properties: [ @@ -58,34 +53,49 @@ export default () => { ], }); + mainBox.update = () => { + getWorkspaces(mainBox); + updateWorkspaces(mainBox); + updateClients(mainBox); + updateCurrentWorkspace(mainBox, highlighter); + }; + + const widget = Overlay({ + overlays: [highlighter, mainBox], + + child: Box({ + className: 'overview', + css: ` + min-height: ${mainBox.get_allocated_height()}px; + min-width: ${mainBox.get_allocated_width()}px; + `, + }), + + // TODO: throttle his? + connections: [['get-child-position', (self, ch) => { + if (ch === mainBox) { + self.child.setCss(` + transition: min-height 0.2s ease, min-width 0.2s ease; + min-height: ${mainBox.get_allocated_height()}px; + min-width: ${mainBox.get_allocated_width()}px; + `); + } + }]], + }); + + widget.getChild = () => mainBox; + + return widget; +}; + +export default () => { const window = PopupWindow({ name: 'overview', closeOnUnfocus: 'none', - onOpen: () => update(mainBox, highlighter), - - child: Overlay({ - overlays: [highlighter, mainBox], - - child: Box({ - className: 'overview', - css: ` - min-height: ${mainBox.get_allocated_height()}px; - min-width: ${mainBox.get_allocated_width()}px; - `, - }), - - // TODO: throttle his? - connections: [['get-child-position', (self, ch) => { - if (ch === mainBox) { - self.child.setCss(` - transition: min-height 0.2s ease, min-width 0.2s ease; - min-height: ${mainBox.get_allocated_height()}px; - min-width: ${mainBox.get_allocated_width()}px; - `); - } - }]], - }), - + onOpen: () => { + window.setChild(Overview()); + window.getChild().getChild().update(); + }, }); return window;