Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
"use client";
import { useSyncExternalStore } from "react";
import { shellStore } from "../lib/store";
import type { WindowState, WinId } from "../lib/types";
// Each hook subscribes to the whole store but reads ONE slice. React bails out
// when the returned snapshot ref is unchanged, so a move on window A only
// re-renders the component reading window A.
export function useWindow(id: WinId): WindowState | undefined {
return useSyncExternalStore(
shellStore.subscribe,
() => shellStore.getWindow(id),
() => shellStore.getWindow(id),
);
}
export function useWindowOrder(): WinId[] {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getOrder,
shellStore.getOrder,
);
}
// The windows map — for components that read several windows during render
// (dock hover list, Window menu) and must re-render when any window patches.
export function useWindowsMap(): Record<WinId, WindowState> {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getWindows,
shellStore.getWindows,
);
}
export function useFocused(): WinId | null {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getFocused,
shellStore.getFocused,
);
}
export function useLauncherOpen(): boolean {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getLauncherOpen,
shellStore.getLauncherOpen,
);
}
export function useSpotlightOpen(): boolean {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getSpotlightOpen,
shellStore.getSpotlightOpen,
);
}
export function useInspectorOpen(): boolean {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getInspectorOpen,
shellStore.getInspectorOpen,
);
}
export function useNotificationCenterOpen(): boolean {
return useSyncExternalStore(
shellStore.subscribe,
shellStore.getNotificationCenterOpen,
shellStore.getNotificationCenterOpen,
);
}
// The app id of the focused window (or null) — what the Inspector inspects.
export function useFocusedApp(): string | null {
const focused = useFocused();
return useWindow(focused ?? "")?.app ?? null;
}