Skip to content

Commit

Permalink
feat: Allow apps to be hidden from launcher via manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
Endercass committed Jan 20, 2024
1 parent 1905f9c commit 2c09826
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Anura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ interface AppManifest {
index?: string;
icon: string;
handler?: string;
hidden?: boolean;
background?: string;
wininfo: string | WindowInformation;
}
2 changes: 1 addition & 1 deletion src/Launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Launcher {
}

addShortcut(app: App) {
if (app.package == "anura.xfrog") return;
if (app.hidden) return;
const shortcut = this.shortcutElement(app);
shortcut.addEventListener("click", (...args) => {
this.hide();
Expand Down
5 changes: 5 additions & 0 deletions src/coreapps/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ class App {
icon: string;
package: string;
name: string;
/**
* This should be set to false by default because apps should
* only be hidden if there is an explicit reason to do so
*/
hidden = false;
windows: WMWindow[] = [];
open(): void {}
}
1 change: 1 addition & 0 deletions src/coreapps/ExternalApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ExternalApp extends App {
this.icon = source + "/" + manifest.icon;
this.source = source;
this.package = manifest.package;
this.hidden = manifest.hidden || false;
}
async open(): Promise<WMWindow | undefined> {
// TODO: have a "allowmultiinstance" option in manifest? it might confuse users, some windows open a second, some focus
Expand Down
2 changes: 2 additions & 0 deletions src/coreapps/XFrogApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class XFrogApp extends App {

activeWin: WMWindow;

hidden = true;

xwindows: { [wid: string]: WMWindow } = {};

constructor() {
Expand Down

0 comments on commit 2c09826

Please sign in to comment.