update ags
This commit is contained in:
1 parent
88822cb8e8
commit
a9c19bd2e1
134 files changed
+4732
-5813
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import { WindowProps, Window } from 'types/widgets/window';
|
||||
const { Gtk, GLib } = imports.gi;
|
||||
|
||||
type _WindowProps = WindowProps<any, unknown, Window<any, unknown>> | undefined[];
|
||||
|
||||
type Type = {
|
||||
name: string,
|
||||
child: any,
|
||||
showClassName?: string,
|
||||
hideClassName?: string,
|
||||
}
|
||||
|
||||
export default <T extends Type>({
|
||||
name,
|
||||
child,
|
||||
showClassName = "",
|
||||
hideClassName = "",
|
||||
...props
|
||||
}: T & Omit<_WindowProps, keyof Type>) => {
|
||||
return Widget.Window({
|
||||
name,
|
||||
visible: false,
|
||||
type: Gtk.WindowType.POPUP,
|
||||
layer: 'overlay',
|
||||
resizable: true,
|
||||
...props,
|
||||
setup: (self) => {
|
||||
self.keybind("Escape", () => App.closeWindow(name));
|
||||
if (showClassName != "" && hideClassName !== "") {
|
||||
self.hook(App, (self, currentName, visible) => {
|
||||
if (currentName === name) {
|
||||
self.toggleClassName(hideClassName, !visible);
|
||||
}
|
||||
});
|
||||
|
||||
if (showClassName !== "" && hideClassName !== "")
|
||||
self.class_name = `${showClassName} ${hideClassName}`;
|
||||
}
|
||||
},
|
||||
child: child,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user