diff --git a/.config/ags/config.js b/.config/ags/config.js index 415d5e51..f7ccabdb 100644 --- a/.config/ags/config.js +++ b/.config/ags/config.js @@ -57,7 +57,7 @@ const Windows = () => [ forMonitors((id) => Corner(id, 'bottom right')), ]; const CLOSE_ANIM_TIME = 210; // Longer than actual anim time to make sure widgets animate fully -export default { +App.config({ css: `${COMPILED_STYLE_DIR}/style.css`, stackTraceOnError: true, closeWindowDelay: { // For animations @@ -66,7 +66,7 @@ export default { 'osk': CLOSE_ANIM_TIME, }, windows: Windows().flat(1), -}; +}); // Stuff that don't need to be toggled. And they're async so ugh... // Bar().catch(print); // Use this to debug the bar. Single monitor only. diff --git a/.config/ags/modules/.widgethacks/popupwindow.js b/.config/ags/modules/.widgethacks/popupwindow.js index 2b85ca7c..26dad59c 100644 --- a/.config/ags/modules/.widgethacks/popupwindow.js +++ b/.config/ags/modules/.widgethacks/popupwindow.js @@ -6,25 +6,27 @@ const { Box, Window } = Widget; export default ({ name, child, - showClassName, - hideClassName, + showClassName = "", + hideClassName = "", ...props -}) => Window({ - name, - popup: true, - visible: false, - layer: 'overlay', - ...props, +}) => { + return Window({ + name, + visible: false, + layer: 'overlay', + ...props, - child: Box({ - className: `${showClassName} ${hideClassName}`, - setup: (self) => self - .hook(App, (self, currentName, visible) => { - if (currentName === name) { - self.toggleClassName(hideClassName, !visible); - } - }) - , - child: child, - }), -}); \ No newline at end of file + child: Box({ + setup: (self) => { + self.hook(App, (self, currentName, visible) => { + if (currentName === name) { + self.toggleClassName(hideClassName, !visible); + } + }).keybind("Escape", () => App.closeWindow(name)) + if (showClassName !== "" && hideClassName !== "") + self.className = `${showClassName} ${hideClassName}`; + }, + child: child, + }), + }); +} \ No newline at end of file diff --git a/.config/ags/modules/cheatsheet/main.js b/.config/ags/modules/cheatsheet/main.js index 0d5b4789..d83a18b8 100644 --- a/.config/ags/modules/cheatsheet/main.js +++ b/.config/ags/modules/cheatsheet/main.js @@ -3,6 +3,7 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import Service from 'resource:///com/github/Aylur/ags/service.js'; import { Keybinds } from "./keybinds.js"; import { setupCursorHover } from "../.widgetutils/cursorhover.js"; +import PopupWindow from '../.widgethacks/popupwindow.js'; const cheatsheetHeader = () => Widget.CenterBox({ vertical: false, @@ -68,11 +69,10 @@ const clickOutsideToClose = Widget.EventBox({ onMiddleClick: () => App.closeWindow('cheatsheet'), }); -export default () => Widget.Window({ +export default () => PopupWindow({ name: 'cheatsheet', exclusivity: 'ignore', keymode: 'exclusive', - popup: true, visible: false, child: Widget.Box({ vertical: true, diff --git a/.config/ags/modules/overview/main.js b/.config/ags/modules/overview/main.js index 436b444e..0bab9194 100644 --- a/.config/ags/modules/overview/main.js +++ b/.config/ags/modules/overview/main.js @@ -1,11 +1,11 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import { SearchAndWindows } from "./windowcontent.js"; +import PopupWindow from '../.widgethacks/popupwindow.js'; -export default () => Widget.Window({ - name: 'overview', +export default (id = '') => PopupWindow({ + name: `overview${id}`, exclusivity: 'ignore', keymode: 'exclusive', - popup: true, visible: false, anchor: ['top'], layer: 'overlay', diff --git a/.config/ags/modules/session/main.js b/.config/ags/modules/session/main.js index acf66ddf..26d33cca 100644 --- a/.config/ags/modules/session/main.js +++ b/.config/ags/modules/session/main.js @@ -1,9 +1,9 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import SessionScreen from "./sessionscreen.js"; +import PopupWindow from '../.widgethacks/popupwindow.js'; -export default () => Widget.Window({ // On-screen keyboard +export default () => PopupWindow({ // On-screen keyboard name: 'session', - popup: true, visible: false, keymode: 'exclusive', layer: 'overlay', diff --git a/scriptdata/installers b/scriptdata/installers index c46015c6..175da758 100644 --- a/scriptdata/installers +++ b/scriptdata/installers @@ -24,7 +24,7 @@ install-ags (){ try git init -b main try git remote add origin https://github.com/Aylur/ags.git x git pull origin main && git submodule update --init --recursive - x git checkout e257efa0a13c50538bed77ca6e557dc4dd3a3482 # add Widget.keybind #248 + x git checkout b40b8d81c5543ef02caee67560ab1c13ebcee49a # "update examples" x npm install x meson setup build x meson install -C build