diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2024-05-04 15:42:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-04 15:42:48 +0900 |
| commit | 1127bae8815e1b60b637d0c88832bddae7cc5a1a (patch) | |
| tree | 2501119e4914f79535e5bd1e12d64fc6754337c6 /config/ags/modules/.widgethacks/popupwindow.js | |
| parent | 5e304d31a220a64338e5cb84e397d1a102855260 (diff) | |
| parent | dc9f0cd58454b4cb33a704b11e4cc8a7c6594e67 (diff) | |
Merge pull request #231 from SherLock707/dev_overview
Added ags overview widget
Diffstat (limited to 'config/ags/modules/.widgethacks/popupwindow.js')
| -rw-r--r-- | config/ags/modules/.widgethacks/popupwindow.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/config/ags/modules/.widgethacks/popupwindow.js b/config/ags/modules/.widgethacks/popupwindow.js new file mode 100644 index 00000000..26dad59c --- /dev/null +++ b/config/ags/modules/.widgethacks/popupwindow.js @@ -0,0 +1,32 @@ +import App from 'resource:///com/github/Aylur/ags/app.js'; +import Widget from 'resource:///com/github/Aylur/ags/widget.js'; +const { Box, Window } = Widget; + + +export default ({ + name, + child, + showClassName = "", + hideClassName = "", + ...props +}) => { + return Window({ + name, + visible: false, + layer: 'overlay', + ...props, + + 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 |
