forked from Blendman974/faceclaw
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { shell } from "../../ui/shell/shell";
|
|
import { type AppDefinition } from "../app-definition";
|
|
import { createLauncherWindow, LAUNCHER_SURFACE_ID, LAUNCHER_WINDOW_ID } from "./launcher-app";
|
|
|
|
const launcherApp: AppDefinition = {
|
|
appId: "launcher",
|
|
title: "Apps",
|
|
icon: "layout-grid",
|
|
// The launcher is the app grid itself, not an entry in it.
|
|
showInLauncher: false,
|
|
// Pinned first in the sidebar and the boot foreground; registered at
|
|
// startup rather than launched.
|
|
boot: (ctx) => {
|
|
shell.registerWindow(
|
|
createLauncherWindow({
|
|
actions: {
|
|
...ctx.actions,
|
|
requestRender: () => shell.foregroundWindow()?.requestRender(),
|
|
},
|
|
apps: ctx.apps
|
|
.filter((app) => app.showInLauncher !== false)
|
|
.map((app) => ({ appId: app.appId, label: app.title, icon: app.icon })),
|
|
launchApp: (appId) => ctx.launchApp(appId),
|
|
submitFrame: (image, paintMs, frameId) => ctx.submitWindowFrame(LAUNCHER_SURFACE_ID, image, paintMs, frameId),
|
|
setSurfaceVisible: (visible) => ctx.setWindowSurfaceVisible(LAUNCHER_SURFACE_ID, visible),
|
|
}),
|
|
);
|
|
},
|
|
// The launcher window is pinned and always open; launching means focusing.
|
|
launch: async (ctx) => {
|
|
shell.focusWindow(LAUNCHER_WINDOW_ID);
|
|
ctx.requestShellRender();
|
|
},
|
|
};
|
|
|
|
export default launcherApp;
|