Skip to content

An open-source, self-hosted system for apps built with web technologies.

Add Desktop-owned Window header control

zohayrslileh5cc2f8d46e05
diff --git a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
index 1328055..8ba5e84 100644
--- a/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/client/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -339,6 +339,13 @@ export default class ProcessManager extends TheLink {
return this.followed(payload)
}
+ @Subscribe("/change-header")
+ @Publish("/processes", "inbound")
+ protected async changeHeaderHandle(payload: { identity: string, window: WindowSnapshot } | null) {
+
+ return this.followed(payload)
+ }
+
@Subscribe("/maximize")
@Publish("/processes", "inbound")
protected async maximizeHandle(payload: { identity: string, window: WindowSnapshot } | null) {
diff --git a/source/client/core/link-manager/auth-manager/process-manager/window.ts b/source/client/core/link-manager/auth-manager/process-manager/window.ts
index 0d93275..1cc8e8e 100644
--- a/source/client/core/link-manager/auth-manager/process-manager/window.ts
+++ b/source/client/core/link-manager/auth-manager/process-manager/window.ts
@@ -33,6 +33,8 @@ export default class Window implements Omit<WindowState, "front"> {
// window owns it.
public title: string
+ public header: boolean
+
// The authoritative Desktop layer.
public layer: WindowLayer
@@ -40,6 +42,8 @@ export default class Window implements Omit<WindowState, "front"> {
this.title = payload.title
+ this.header = payload.header
+
this.layer = payload.layer
this.processManager = processManager
@@ -63,6 +67,8 @@ export default class Window implements Omit<WindowState, "front"> {
this.title = payload.title
+ this.header = payload.header
+
this.layer = payload.layer
this.position = payload.position
@@ -97,6 +103,11 @@ export default class Window implements Omit<WindowState, "front"> {
await this.processManager.$outbound.publish("/change-title", this.process, title)
}
+ public async changeHeader(header: boolean) {
+
+ await this.processManager.$outbound.publish("/change-header", this.process, header)
+ }
+
// To the front of its own layer, and nothing else. A hidden window
// raised stays hidden and appears at its new place in the order when
// it is shown.
diff --git a/source/client/view/components/desktop-host/host.ts b/source/client/view/components/desktop-host/host.ts
index 92f4971..065713b 100644
--- a/source/client/view/components/desktop-host/host.ts
+++ b/source/client/view/components/desktop-host/host.ts
@@ -743,6 +743,8 @@ export default function host(authManager: AuthManager, pane: string, viewport: (
title: shown.title,
+ header: shown.header,
+
position: shown.position,
size: shown.size,
@@ -828,6 +830,13 @@ export default function host(authManager: AuthManager, pane: string, viewport: (
return []
}
+ if (word === "windowLocalHeader") {
+ const target = localProcess(args[0])
+ if (typeof args[1] !== "boolean") throw new Error("Local Window header state must be true or false")
+ localWindow.header(target.identity, args[1])
+ return []
+ }
+
if (word === "windowLocalMaximize") {
const target = localProcess(args[0])
if (typeof args[1] !== "boolean") throw new Error("Local Window maximize takes a boolean state")
@@ -879,6 +888,15 @@ export default function host(authManager: AuthManager, pane: string, viewport: (
return [pane]
}
+ if (word === "changeHeader") {
+
+ if (typeof args[1] !== "boolean") throw new Error("Window header state must be true or false")
+
+ await clientOf(await permittedProcess(args[0])).window.changeHeader(args[1])
+
+ return [pane]
+ }
+
if (word === "raise") {
await clientOf(await permittedProcess(args[0])).window.raise()
diff --git a/source/client/view/components/desktop-host/local-window.ts b/source/client/view/components/desktop-host/local-window.ts
index ae68b06..bd8b8c3 100644
--- a/source/client/view/components/desktop-host/local-window.ts
+++ b/source/client/view/components/desktop-host/local-window.ts
@@ -41,6 +41,7 @@ export interface LocalWindowHost {
follow(identity: string, target: string, transaction?: AppearanceTransaction | WaitedTransaction): Promise<void>
unfollow(identity: string, transaction?: AppearanceTransaction | WaitedTransaction): Promise<void>
title(identity: string, title: string): void
+ header(identity: string, header: boolean): void
raise(identity: string): void
addSurface(identity: string, transaction?: AppearanceTransaction | WaitedTransaction): Promise<void>
removeSurface(identity: string, transaction?: AppearanceTransaction | WaitedTransaction): Promise<void>
diff --git a/source/client/view/components/loading.tsx b/source/client/view/components/loading.tsx
index 0a8c240..061dbc8 100644
--- a/source/client/view/components/loading.tsx
+++ b/source/client/view/components/loading.tsx
@@ -22,8 +22,8 @@ export default function ({ className, style, ...props }: LoadingProps) {
<Surface
{...props}
- className="absolute inset-0 grid"
- style={{ borderRadius: "inherit" }}
+ className="grid"
+ style={{ position: "absolute", inset: 0, borderRadius: "inherit" }}
>
<Spinner className="m-auto size-6" />
diff --git a/source/client/view/components/window-manager/layer-policy.ts b/source/client/view/components/window-manager/layer-policy.ts
index ed90c54..9f15930 100644
--- a/source/client/view/components/window-manager/layer-policy.ts
+++ b/source/client/view/components/window-manager/layer-policy.ts
@@ -1,11 +1,11 @@
import type { WindowLayer } from "@phreshos/core"
import type { LocalWindowState } from "../desktop-host/local-window"
-type PresentationProperty = "title" | "position" | "size" | "minimized" | "maximized" | "depth" | "surface"
+type PresentationProperty = "title" | "header" | "position" | "size" | "minimized" | "maximized" | "depth" | "surface"
/** Properties owned by Desktop for each local Window role. */
const properties: Readonly<Record<WindowLayer, readonly PresentationProperty[]>> = {
- window: ["title", "position", "size", "minimized", "maximized", "depth"],
+ window: ["title", "header", "position", "size", "minimized", "maximized", "depth"],
under: ["position", "size", "minimized", "maximized", "depth", "surface"],
over: ["position", "size", "minimized", "maximized", "depth", "surface"],
wallpaper: [],
diff --git a/source/client/view/components/window-manager/local-windows.ts b/source/client/view/components/window-manager/local-windows.ts
index ca372ec..60e2217 100644
--- a/source/client/view/components/window-manager/local-windows.ts
+++ b/source/client/view/components/window-manager/local-windows.ts
@@ -262,6 +262,14 @@ export default class LocalWindows implements LocalWindowHost {
this.replace(identity, { ...state, title })
}
+ public header(process: string, header: boolean) {
+
+ const { identity, state } = this.existing(process)
+ requireLocalProperty(state.layer, "header")
+ if (state.header === header) return
+ this.replace(identity, { ...state, header })
+ }
+
public raise(process: string) {
const { identity, state } = this.existing(process)
@@ -451,6 +459,7 @@ function localState(client: ClientState): LocalWindowState {
return {
...authoritativeState(client),
title: window.layer === "window" ? window.title : "",
+ header: window.layer === "window" ? window.header : true,
position: isDesktopReplacementLayer(window.layer) ? { x: 0, y: 0 } : window.position,
size: isDesktopReplacementLayer(window.layer) ? { width: "100%", height: "100%" } : window.size,
minimized: isDesktopReplacementLayer(window.layer) ? false : window.minimized,
@@ -463,6 +472,7 @@ function authoritativeState(client: ClientState): LocalWindowState {
const window = client.window
return {
title: window.title,
+ header: window.header,
position: window.position,
size: window.size,
minimized: window.minimized,
@@ -480,6 +490,7 @@ function windowState(local: LocalWindowState, front: boolean, geometry?: Readonl
return {
title: local.title,
+ header: local.header,
position: geometry?.position ?? local.position,
size: geometry?.size ?? local.size,
minimized: local.minimized,
diff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsx
index 8f32d67..0601e29 100644
--- a/source/client/view/structure/desktop/desktop.tsx
+++ b/source/client/view/structure/desktop/desktop.tsx
@@ -125,6 +125,8 @@ export default function Workspace() {
title={local.title}
+ header={local.header}
+
icon={icon(record)}
position={local.position}
diff --git a/source/client/view/structure/desktop/windows/process-window.tsx b/source/client/view/structure/desktop/windows/process-window.tsx
index 2f93983..a32c3c6 100644
--- a/source/client/view/structure/desktop/windows/process-window.tsx
+++ b/source/client/view/structure/desktop/windows/process-window.tsx
@@ -17,7 +17,7 @@ const settleDelay = 80
* props so memoization can see which process actually changed even though
* the peer deliberately keeps each Process instance alive and mutates it.
*/
-export default memo(function ({ identity, record, assetId, client, title, icon, position, size, localSurface, geometryAnimation, minimizeAnimation, onLocalAnimationComplete, onLocalRepresentation, paintSurfaceSize, depth, active, minimized, maximized, closing, stopping, entering, bare, door, programAccess, theme, onFrame, onFrameLoad, onReady, onRaise, onMinimize, onFill, onClose, onClosed, onUnavailable, onMove, onResize, onSnap }: ProcessWindowProps) {
+export default memo(function ({ identity, record, assetId, client, title, header, icon, position, size, localSurface, geometryAnimation, minimizeAnimation, onLocalAnimationComplete, onLocalRepresentation, paintSurfaceSize, depth, active, minimized, maximized, closing, stopping, entering, bare, door, programAccess, theme, onFrame, onFrameLoad, onReady, onRaise, onMinimize, onFill, onClose, onClosed, onUnavailable, onMove, onResize, onSnap }: ProcessWindowProps) {
const activate = useCallback(() => onRaise(record), [onRaise, record])
@@ -92,6 +92,8 @@ export default memo(function ({ identity, record, assetId, client, title, icon,
title={title}
+ header={header}
+
icon={icon}
position={position}
@@ -206,6 +208,8 @@ interface ProcessWindowProps {
title: string
+ header: boolean
+
icon: string
position: Position
diff --git a/source/client/view/structure/desktop/windows/window-panel.tsx b/source/client/view/structure/desktop/windows/window-panel.tsx
index 1f1f6aa..a5132a0 100644
--- a/source/client/view/structure/desktop/windows/window-panel.tsx
+++ b/source/client/view/structure/desktop/windows/window-panel.tsx
@@ -11,7 +11,7 @@ const WindowPanel = forwardRef<HTMLDivElement, SurfaceProps & { header: ReactNod
ref={ref}
style={{
display: "grid",
- gridTemplateRows: "auto minmax(0, 1fr)",
+ gridTemplateRows: header == null ? "minmax(0, 1fr)" : "auto minmax(0, 1fr)",
minWidth: 0,
minHeight: 0,
overflow: "hidden",
diff --git a/source/client/view/structure/desktop/windows/window.tsx b/source/client/view/structure/desktop/windows/window.tsx
index de9c88d..23e74bc 100644
--- a/source/client/view/structure/desktop/windows/window.tsx
+++ b/source/client/view/structure/desktop/windows/window.tsx
@@ -50,7 +50,7 @@ const edges: { edge: WindowEdge, className: string }[] = [
const minimizedSurfacePose = { scale: 0.86, y: 28, opacity: 0 }
-export default function ({ title, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onLocalAnimationComplete, onLocalRepresentation, onFocusCapture, active = false, bare = false, closing = false, stopping = false, minimized = false, maximized = false, animateEntrance = true, position = { x: 0, y: 0 }, size = { width: 520, height: 340 }, localSurface, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, minWidth = minimumWindowSize.width, minHeight = minimumWindowSize.height, className, style, ...props }: WindowProps) {
+export default function ({ title, header = true, icon, children, onClose, onClosed, onMinimize, onMaximize, onActivate, onUnavailable, onMove, onResize, onSnap, onLocalAnimationComplete, onLocalRepresentation, onFocusCapture, active = false, bare = false, closing = false, stopping = false, minimized = false, maximized = false, animateEntrance = true, position = { x: 0, y: 0 }, size = { width: 520, height: 340 }, localSurface, geometryAnimation, minimizeAnimation, paintSurfaceSize = { width: 0, height: 0 }, minWidth = minimumWindowSize.width, minHeight = minimumWindowSize.height, className, style, ...props }: WindowProps) {
const reducedMotion = useReducedMotion()
const appearanceTransaction = useAppearance().transaction
@@ -496,7 +496,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
>
<WindowPanel
style={{ position: "absolute", inset: 0 }}
- header={<WindowHeader
+ header={header ? <WindowHeader
title={title}
@@ -518,7 +518,7 @@ export default function ({ title, icon, children, onClose, onClosed, onMinimize,
stopping={stopping || closing}
- />}
+ /> : null}
>{children}</WindowPanel>
</motion.div>}
@@ -545,6 +545,9 @@ interface WindowProps extends Omit<ComponentProps<"div">, "onAnimationStart" | "
title?: ReactNode
+ /** Whether the Desktop-owned standard Window header is shown. */
+ header?: boolean
+
// Drawn beside the title. A URL rather than a node: what a window
// shows of its program is a picture the browser fetches, and the
// path it fetches from is the view's to build.
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
index 1007701..481fe17 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -172,6 +172,7 @@ export default class ProcessManager extends TheLink {
return Object.freeze({
title: window.title,
+ header: window.header,
position: window.position,
size: window.size,
minimized: window.minimized,
@@ -931,7 +932,7 @@ export default class ProcessManager extends TheLink {
private window(shape: Shape) {
- const shown = { title: shape.title, layer: shape.layer }
+ const shown = { title: shape.title, header: shape.header, layer: shape.layer }
return new Window(shown, shape.position, shape.size, ++this.highest, shape.minimize, shape.maximize)
}
@@ -2172,6 +2173,15 @@ export default class ProcessManager extends TheLink {
return [target.identity]
}
+ if (word === "changeHeader") {
+
+ const target = heldWindow(rest[0]).process
+
+ await this.system.changeWindowHeader(target, rest[1] as boolean)
+
+ return [target.identity]
+ }
+
if (word === "raise") {
const target = heldWindow(rest[0]).process
@@ -3058,6 +3068,18 @@ export default class ProcessManager extends TheLink {
return { identity, window }
}
+ @Connect("/change-header")
+ public async changeHeader(identity: string, header: boolean) {
+
+ const window = this.mutableWindowOf(identity)
+
+ if (!window.changeHeader(header)) return { identity, window }
+
+ this.said(identity, "changeHeader", window.header)
+
+ return { identity, window }
+ }
+
// To the front of its own layer, and that is the whole of it.
//
// It was called `focus` and it did three things: it showed a hidden
@@ -3326,6 +3348,8 @@ interface ShapeBase {
title: string
+ header: boolean
+
position: Position
size: Size
diff --git a/source/server/core/link-manager/auth-manager/process-manager/window.ts b/source/server/core/link-manager/auth-manager/process-manager/window.ts
index e0eb38c..4f27b1c 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/window.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/window.ts
@@ -8,6 +8,8 @@ export interface Shown {
title: string
+ header: boolean
+
// Which structurally isolated Desktop layer this Window occupies.
layer: WindowLayer
@@ -32,6 +34,8 @@ export default class Window implements Omit<WindowState, "front"> {
// own afterwards.
public title: string
+ public header: boolean
+
// The Window's authoritative Desktop layer.
public readonly layer: WindowLayer
@@ -39,6 +43,8 @@ export default class Window implements Omit<WindowState, "front"> {
this.title = shown.title
+ this.header = shown.header
+
this.layer = shown.layer
this.position = position
@@ -123,12 +129,25 @@ export default class Window implements Omit<WindowState, "front"> {
return true
}
+ public changeHeader(header: boolean) {
+
+ if (typeof header !== "boolean") throw new Error("Window header state must be true or false")
+
+ if (this.header === header) return false
+
+ this.header = header
+
+ return true
+ }
+
public toJSON() {
return {
title: this.title,
+ header: this.header,
+
layer: this.layer,
position: this.position,
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
index 0da926a..5832a8c 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
@@ -1502,6 +1502,8 @@ export default class ProgramManager extends TheLink {
if (asked.title !== undefined && typeof asked.title !== "string") throw new Error("A launch client's title must be text")
+ if (asked.header !== undefined && typeof asked.header !== "boolean") throw new Error("A launch client's header state must be true or false")
+
for (const [what, value] of [["size", asked.size], ["position", asked.position]] as const) {
if (value === undefined) continue
@@ -1521,15 +1523,19 @@ export default class ProgramManager extends TheLink {
const shift = this.authManager.processManager.processes.size % 8 * 32
+ const layer = asked.layer ?? client.layer ?? "window"
+
return {
title: asked.title ?? program.title,
+ header: layer === "window" ? asked.header ?? client.header ?? true : true,
+
position: asked.position ?? client.position ?? { x: 120 + shift, y: 80 + shift },
size: asked.size ?? client.size ?? { width: 520, height: 340 },
- layer: asked.layer ?? client.layer ?? "window",
+ layer,
minimize: asked.minimize ?? client.minimize ?? false,
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program.ts b/source/server/core/link-manager/auth-manager/program-manager/program.ts
index 337735a..7f6f90b 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/program.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/program.ts
@@ -207,6 +207,8 @@ export default class Program {
title: client.title ?? null,
+ header: client.header ?? null,
+
size: client.size ?? null,
position: client.position ?? null,
diff --git a/source/server/core/system.ts b/source/server/core/system.ts
index 17e4f60..d59110f 100644
--- a/source/server/core/system.ts
+++ b/source/server/core/system.ts
@@ -348,6 +348,11 @@ export default class System {
await this.processManager.changeTitle(process.identity, title)
}
+ public async changeWindowHeader(process: Process, header: boolean) {
+
+ await this.processManager.changeHeader(process.identity, header)
+ }
+
public async raiseWindow(process: Process) {
await this.processManager.raise(process.identity)
diff --git a/tests/client-launch.test.ts b/tests/client-launch.test.ts
index e1eb0d3..2086820 100644
--- a/tests/client-launch.test.ts
+++ b/tests/client-launch.test.ts
@@ -14,7 +14,7 @@ test("client launch contract", async () => {
}
const program = {
- client: {},
+ client: { header: false },
title: "Declared title"
}
@@ -27,4 +27,8 @@ test("client launch contract", async () => {
assert.equal(shape({ title: "Fetched title" }).title, "Fetched title")
assert.equal(shape({}).title, "Declared title")
assert.throws(() => shape({ title: 42 } as unknown as ClientLaunch), /title must be text/)
+ assert.equal(shape({ header: false }).header, false)
+ assert.equal(shape({}).header, false)
+ assert.equal(shape({ layer: "over", header: false }).header, true)
+ assert.throws(() => shape({ header: "hidden" } as unknown as ClientLaunch), /header state/)
}, 120_000)
diff --git a/tests/client-layer-permissions.test.ts b/tests/client-layer-permissions.test.ts
index 6cba8cf..32431e0 100644
--- a/tests/client-layer-permissions.test.ts
+++ b/tests/client-layer-permissions.test.ts
@@ -11,7 +11,7 @@ function fixture() {
const program: ProgramSnapshot = {
identity: "owner", reference: "program-reference", assetId: "assets", name: "Owner",
version: null, description: null, hasAgent: false, server: null,
- client: { start: true, service: false, title: null, size: null, position: null, layer: "over", minimize: null, maximize: null }
+ client: { start: true, service: false, title: null, header: null, size: null, position: null, layer: "over", minimize: null, maximize: null }
}
const process = { identity: "caller", reference: "process-reference", program: program.identity, name: null, startedAt: 0, options: {}, server: null, client: null }
const createProcess = vi.fn(async () => process.identity)
diff --git a/tests/client-sandbox.test.ts b/tests/client-sandbox.test.ts
index ed96193..249a335 100644
--- a/tests/client-sandbox.test.ts
+++ b/tests/client-sandbox.test.ts
@@ -27,7 +27,7 @@ test("client sandbox contract", async () => {
process.startClient(new Window(
- { title: "Client", layer: "window" },
+ { title: "Client", header: true, layer: "window" },
{ x: 0, y: 0 },
diff --git a/tests/client-surface.test.ts b/tests/client-surface.test.ts
index 53dcec3..afc2d57 100644
--- a/tests/client-surface.test.ts
+++ b/tests/client-surface.test.ts
@@ -14,7 +14,7 @@ test("client surface contract", async () => {
type RequestedTransaction = AppearanceTransaction | WaitedTransaction
const authoritativeWindow = new ServerWindow(
- { title: "Target", layer: "over" },
+ { title: "Target", header: true, layer: "over" },
{ x: 0, y: 0 },
{ width: 100, height: 100 },
1,
@@ -322,6 +322,7 @@ test("client surface contract", async () => {
return {
window: {
title: "Window",
+ header: true,
position: { x: 0, y: 0 },
size: { width: 300, height: 200 },
minimized: false, maximized: false,
diff --git a/tests/desktop-replacement-lifecycle.test.ts b/tests/desktop-replacement-lifecycle.test.ts
index 832ff83..423dbd7 100644
--- a/tests/desktop-replacement-lifecycle.test.ts
+++ b/tests/desktop-replacement-lifecycle.test.ts
@@ -15,7 +15,7 @@ function fixture(replacementLayer: DesktopReplacementLayer) {
const program = new Program({ identity: "replacement-test", client: { location: "https://example.test/" } })
vi.spyOn(program, "validate").mockResolvedValue()
const shape = (layer: Layer = replacementLayer) => ({
- title: "Replacement", position: { x: 20, y: 30 }, size: { width: 320, height: 240 },
+ title: "Replacement", header: true, position: { x: 20, y: 30 }, size: { width: 320, height: 240 },
layer, minimize: false, maximize: false
})
Object.assign(auth, {
diff --git a/tests/local-window-layers.test.ts b/tests/local-window-layers.test.ts
index ac7f7ef..9566d5c 100644
--- a/tests/local-window-layers.test.ts
+++ b/tests/local-window-layers.test.ts
@@ -4,7 +4,7 @@ import LocalWindows, { type LocalWindowEntry } from "@client/view/components/win
function fixture(layer: WindowLayer) {
const client = (layer: WindowLayer) => ({ window: {
- layer, title: "Original", position: { x: 20, y: 30 }, size: { width: 320, height: 240 },
+ layer, title: "Original", header: true, position: { x: 20, y: 30 }, size: { width: 320, height: 240 },
minimized: true, maximized: false, depth: 5
} })
const own = client(layer)
@@ -20,13 +20,13 @@ function fixture(layer: WindowLayer) {
test.each(["wallpaper", "start-menu"] as const)("%s local geometry and visibility belong to Desktop, not authoritative state", async layer => {
const { own, target, entries, windows } = fixture(layer)
const initial = windows.projection("own")
- expect(initial).toMatchObject({ title: "", position: { x: 0, y: 0 }, size: { width: "100%", height: "100%" }, minimized: false, maximized: true, depth: 0, surface: null })
+ expect(initial).toMatchObject({ title: "", header: true, position: { x: 0, y: 0 }, size: { width: "100%", height: "100%" }, minimized: false, maximized: true, depth: 0, surface: null })
const operations = [
() => windows.move("own", { x: 1, y: 2 }),
() => windows.resize("own", { width: 1, height: 2 }),
() => windows.geometry("own", { position: { x: 1, y: 2 }, size: { width: 1, height: 2 } }),
() => windows.minimize("own", true), () => windows.maximize("own", false),
- () => windows.title("own", "Local"), () => windows.raise("own"),
+ () => windows.title("own", "Local"), () => windows.header("own", false), () => windows.raise("own"),
() => windows.addSurface("own"), () => windows.removeSurface("own")
]
for (const operation of operations) expect(operation).toThrow(new RegExp(`${layer} layer does not allow`))
@@ -47,14 +47,17 @@ test.each(["wallpaper", "start-menu"] as const)("%s local geometry and visibilit
expect(own.window.position).toEqual({ x: 500, y: 600 })
})
-test.each(["under", "over"] as const)("%s follows allowed properties without copying the title", async layer => {
+test.each(["under", "over"] as const)("%s follows allowed properties without copying standard header state", async layer => {
const { own, target, entries, windows } = fixture(layer)
expect(() => windows.title("own", "Local")).toThrow(/local title/)
+ expect(() => windows.header("own", false)).toThrow(/local header/)
await windows.follow("own", "target")
target.window.title = "Changed"
+ target.window.header = false
target.window.position = { x: 100, y: 200 }
windows.reconcile(entries)
expect(windows.projection("own").title).toBe("")
+ expect(windows.projection("own").header).toBe(true)
expect(windows.projection("own").position).toEqual({ x: 100, y: 200 })
expect(own.window.title).toBe("Original")
await windows.unfollow("own")
@@ -65,5 +68,7 @@ test.each(["under", "over"] as const)("%s follows allowed properties without cop
await windows.follow("target", "own")
expect(windows.projection("target").title).toBe("Original")
windows.title("target", "Local title")
+ windows.header("target", false)
expect(windows.projection("target").title).toBe("Local title")
+ expect(windows.projection("target").header).toBe(false)
})
diff --git a/tests/permission-requests.test.ts b/tests/permission-requests.test.ts
index e1bfde2..55e7e7d 100644
--- a/tests/permission-requests.test.ts
+++ b/tests/permission-requests.test.ts
@@ -23,7 +23,7 @@ test("permission requests contract", async () => {
let accessUpdates = 0
const process = new Process("process", null, program, {}, { server: null, client: null, options: {} }, null, {} as HostTraffic, false)
- process.startClient(new Window({ title: "Client", layer: "window" }, { x: 0, y: 0 }, { width: 640, height: 480 }, 1, false), false)
+ process.startClient(new Window({ title: "Client", header: true, layer: "window" }, { x: 0, y: 0 }, { width: 640, height: 480 }, 1, false), false)
const authManager = {
dialogManager: {
diff --git a/tests/process-lifecycle.test.ts b/tests/process-lifecycle.test.ts
index e044b59..ae61854 100644
--- a/tests/process-lifecycle.test.ts
+++ b/tests/process-lifecycle.test.ts
@@ -27,6 +27,7 @@ test("process lifecycle contract", async () => {
return {
title: launch.title ?? "Client",
+ header: true,
position: { x: 0, y: 0 },
size: { width: 640, height: 480 },
layer: "window" as const,
@@ -90,6 +91,7 @@ test("process lifecycle contract", async () => {
true,
{
title: "Client",
+ header: true,
position: { x: 0, y: 0 },
size: { width: 640, height: 480 },
layer: "window",
@@ -186,7 +188,7 @@ test("process lifecycle contract", async () => {
{ ...launch, client: { title: "Partial", position: null, size: null, layer: "window", minimize: false, maximize: false, service: false } },
null,
true,
- { title: "Partial", position: { x: 0, y: 0 }, size: { width: 320, height: 240 }, layer: "window", minimize: false, maximize: false },
+ { title: "Partial", header: true, position: { x: 0, y: 0 }, size: { width: 320, height: 240 }, layer: "window", minimize: false, maximize: false },
null
), /creation publication failed/)
diff --git a/tests/window-geometry.test.ts b/tests/window-geometry.test.ts
index 6457ccc..635c7d6 100644
--- a/tests/window-geometry.test.ts
+++ b/tests/window-geometry.test.ts
@@ -12,7 +12,7 @@ test("window geometry contract", async () => {
}
const authority = new ServerWindow(
- { title: "Geometry", layer: "window" },
+ { title: "Geometry", header: true, layer: "window" },
initial.position,
initial.size,
1,
@@ -66,8 +66,13 @@ test("window geometry contract", async () => {
await ProcessManager.prototype.move.call(manager as unknown as ProcessManager, "process", next.position)
await ProcessManager.prototype.resize.call(manager as unknown as ProcessManager, "process", next.size)
await ProcessManager.prototype.changeTitle.call(manager as unknown as ProcessManager, "process", "Geometry")
+ await ProcessManager.prototype.changeHeader.call(manager as unknown as ProcessManager, "process", true)
assert.equal(events.length, unchangedEvents)
+ await ProcessManager.prototype.changeHeader.call(manager as unknown as ProcessManager, "process", false)
+ assert.equal(authority.header, false)
+ assert.deepEqual(events.at(-1), ["process", "changeHeader", false])
+
const resized = { width: "1/2", height: 260 }
await ProcessManager.prototype.setGeometry.call(manager as unknown as ProcessManager, "process", { position: next.position, size: resized })
assert.deepEqual(events.slice(-2), [
@@ -105,4 +110,5 @@ test("window geometry contract", async () => {
assert.deepEqual(publications.at(-1), ["/maximize", "process", true])
counterpart.follow(authority.toJSON())
assert.equal(counterpart.maximized, false)
+ assert.equal(counterpart.header, false)
}, 120_000)