diff --git a/public/index.html b/public/index.html index 9078ade5..4b0a1bc6 100755 --- a/public/index.html +++ b/public/index.html @@ -124,7 +124,7 @@ - + diff --git a/src/AliceWM.tsx b/src/AliceWM.tsx index 8c638f21..c86ce258 100755 --- a/src/AliceWM.tsx +++ b/src/AliceWM.tsx @@ -15,27 +15,18 @@ type SnappedWindow = { direction: "left" | "right" | "ne" | "nw" | "se" | "sw"; }; -let splitBar: WMSplitBar | null = null; - const minimizedSnappedWindows: SnappedWindow[] = []; const snappedWindows: SnappedWindow[] = []; -/** - * to show a floating dialog displaying the given dom element - * @param {Object} title "title of the dialog" - */ - -const windowInformation = {}; -const windowID = 0; +let splitBar: WMSplitBar | null = null; class WindowInformation { title: string; + height: string; width: string; minwidth: number; - height: string; minheight: number; - allowMultipleInstance = false; resizable: boolean; } @@ -1206,7 +1197,6 @@ let AliceWM = { minwidth: 40, width: "1000px", height: "500px", - allowMultipleInstance: false, resizable: true, }; // Param given in argument diff --git a/src/Anura.ts b/src/Anura.ts index 60e3a7cf..53e5bee8 100755 --- a/src/Anura.ts +++ b/src/Anura.ts @@ -30,7 +30,7 @@ class Anura { uri = new URIHandlerAPI(); files = new FilesAPI(); wm = new WMAPI(); - ContextMenu = ContextMenuAPI; + ContextMenu = ContextMenu; private constructor( fs: AnuraFilesystem, @@ -225,64 +225,6 @@ class Anura { } } -interface AppManifest { - /** - * The name of the app. - */ - name: string; - /** - * The type of the app. This can be "manual", "auto" or "webview". If it is "manual", the app will be handled by the - * handler specified in the handler field. If it is "auto", the app will be handled by the index file - * specified in the index field. If it is "webview", the app will be handled by the website specified in the src field. - * If the type is not "manual", "auto", or "webview", it will be handled by the anura - * library specified in the type field. - */ - type: "manual" | "auto" | "webview" | string; - /** - * The package name of the app. This should be unique to the app and should be in reverse domain notation. - * For example, if the app is called "My App" and is made by "My Company", the package name should be - */ - package: string; - /** - * The index file for the app. This is the file that will be loaded when the app is launched when the app - * is in auto mode. - */ - index?: string; - /** - * The icon for the app. This should be a URL to an image file. - */ - icon: string; - /** - * The handler for the app. This is the file that will be loaded when the app is launched when the app - * is in manual mode. - */ - handler?: string; - /** - * The link for the app. This is the website that will be loaded when the app is launched when the app - * is in webview mode. - */ - src?: string; - /** - * Whether or not the app should be hidden from the app list. This is useful for apps that are - * only meant to be launched by other apps. - */ - hidden?: boolean; - /** - * The background color of the element directly behind the app's window. This is optional and defaults - * to the system theme's background color. - */ - background?: string; - /** - * This contains the properties for the default app window. - */ - wininfo: string | WindowInformation; - /** - * Whether or not the app should use the IDB wrapper. This option allows the app to access indexedDB without - * worrying about the app purging anura's own databases. - */ - useIdbWrapper?: boolean; -} - class SWProcess extends Process { pid = 0; title = "Service Worker"; diff --git a/src/Taskbar.tsx b/src/Taskbar.tsx index cde5d3b1..5f030bd4 100644 --- a/src/Taskbar.tsx +++ b/src/Taskbar.tsx @@ -154,7 +154,8 @@ class Taskbar { )); } - #contextMenu = new ContextMenuAPI(true); // This is going to be before anura is initialized, so we can't use anura.ContextMenu + + #contextMenu = new ContextMenu(true); // This is going to be before anura is initialized, so we can't use anura.ContextMenu showcontext(app: App, e: MouseEvent) { if (app.windows.length > 0) { this.#contextMenu.removeAllItems(); diff --git a/src/Utils.ts b/src/Utils.ts index 464e1b04..3ef095e8 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -9,6 +9,7 @@ function catBufs(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer { tmp.set(new Uint8Array(buffer2), buffer1.byteLength); return tmp.buffer; } + function dbg(ref: object) { const name = Object.keys(ref)[0]!; dg[name] = name; diff --git a/src/api/ContextMenuAPI.tsx b/src/api/ContextMenu.tsx similarity index 99% rename from src/api/ContextMenuAPI.tsx rename to src/api/ContextMenu.tsx index cd209a8f..1f3f258e 100644 --- a/src/api/ContextMenuAPI.tsx +++ b/src/api/ContextMenu.tsx @@ -1,4 +1,4 @@ -class ContextMenuAPI { +class ContextMenu { large = false; #element = (
diff --git a/src/coreapps/ExternalApp.tsx b/src/coreapps/ExternalApp.tsx index 8a8053a3..a499cc8e 100644 --- a/src/coreapps/ExternalApp.tsx +++ b/src/coreapps/ExternalApp.tsx @@ -1,3 +1,61 @@ +interface AppManifest { + /** + * The name of the app. + */ + name: string; + /** + * The type of the app. This can be "manual", "auto" or "webview". If it is "manual", the app will be handled by the + * handler specified in the handler field. If it is "auto", the app will be handled by the index file + * specified in the index field. If it is "webview", the app will be handled by the website specified in the src field. + * If the type is not "manual", "auto", or "webview", it will be handled by the anura + * library specified in the type field. + */ + type: "manual" | "auto" | "webview" | string; + /** + * The package name of the app. This should be unique to the app and should be in reverse domain notation. + * For example, if the app is called "My App" and is made by "My Company", the package name should be + */ + package: string; + /** + * The index file for the app. This is the file that will be loaded when the app is launched when the app + * is in auto mode. + */ + index?: string; + /** + * The icon for the app. This should be a URL to an image file. + */ + icon: string; + /** + * The handler for the app. This is the file that will be loaded when the app is launched when the app + * is in manual mode. + */ + handler?: string; + /** + * The link for the app. This is the website that will be loaded when the app is launched when the app + * is in webview mode. + */ + src?: string; + /** + * Whether or not the app should be hidden from the app list. This is useful for apps that are + * only meant to be launched by other apps. + */ + hidden?: boolean; + /** + * The background color of the element directly behind the app's window. This is optional and defaults + * to the system theme's background color. + */ + background?: string; + /** + * This contains the properties for the default app window. + */ + wininfo: string | WindowInformation; + /** + * Whether or not the app should use the IDB wrapper. This option allows the app to access indexedDB without + * worrying about the app purging anura's own databases. + */ + useIdbWrapper?: boolean; +} + class ExternalApp extends App { manifest: AppManifest; source: string; @@ -36,10 +94,9 @@ class ExternalApp extends App { ); }); } + //@ts-expect-error manual apps exist async open(args: string[] = []): Promise