An open-source, self-hosted system for apps built with web technologies.
A pinned Program's place holds its first Window only; a closed one is its icon alone
zohayrslileh0a75d7bd1147
diff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsxindex 1ee36ee..864eddf 100644--- a/source/client/view/structure/desktop/desktop.tsx+++ b/source/client/view/structure/desktop/desktop.tsx@@ -512,6 +512,11 @@ export default function Workspace() {const pinnedIdentities = new Set(pinnedPrograms.map(program => program.identity))+ // The Window that holds each pinned Program's place: the first of it still open.+ const slotHolders = new Map<string, Process>()++ for (const record of windows.listed) if (pinnedIdentities.has(record.program) && !slotHolders.has(record.program)) slotHolders.set(record.program, record)+const togglePinned = useCallback(function (record: Process) {const program = programs.find(entry => entry.identity === record.program)@@ -581,17 +586,17 @@ export default function Workspace() {{/* What a press means is composed here because it is a person'sexpectation, not a system operation: the front window hides;pressing another takes you to its view and brings it forward.- A pinned Program keeps its place: its Windows stand there, the first- in its icon's stead, and its icon returns once the last is closed;- the Windows of other Programs follow, as they opened. */}- {pinnedPrograms.flatMap(program => {- const its = windows.listed.filter(record => record.program === program.identity)- return its.length- ? its.map(windowItem)- : [<PinnedTaskbarItem key={`pinned:${program.identity}`} program={program} icon={icon({ program: program.identity })} position={appearance.taskbar.position} />]+ A pinned Program keeps its place: its first Window stands there in+ its icon's stead, and its icon returns once its last is closed; every+ other Window follows, as they opened. */}+ {pinnedPrograms.map(program => {+ const first = slotHolders.get(program.identity)+ return first+ ? windowItem(first)+ : <PinnedTaskbarItem key={`pinned:${program.identity}`} program={program} icon={icon({ program: program.identity })} position={appearance.taskbar.position} />})}- {windows.listed.filter(record => !pinnedIdentities.has(record.program)).map(windowItem)}+ {windows.listed.filter(record => slotHolders.get(record.program) !== record).map(windowItem)}</OverflowRow>diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/programs/pinned-taskbar-item.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/programs/pinned-taskbar-item.tsxindex 41985b5..f796d3b 100644--- a/source/client/view/structure/desktop/layers/shell/taskbar/programs/pinned-taskbar-item.tsx+++ b/source/client/view/structure/desktop/layers/shell/taskbar/programs/pinned-taskbar-item.tsx@@ -24,7 +24,7 @@ export default function PinnedTaskbarItem({ program, icon, position }: Readonly<<ContextMenu.Trigger>- <TaskbarItem icon={icon} position={position} labeled={false} onPress={open}>{program.name}</TaskbarItem>+ <TaskbarItem closed icon={icon} position={position} labeled={false} onPress={open}>{program.name}</TaskbarItem></ContextMenu.Trigger>diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/programs/taskbar-item.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/programs/taskbar-item.tsxindex 0eb91b0..005aa68 100644--- a/source/client/view/structure/desktop/layers/shell/taskbar/programs/taskbar-item.tsx+++ b/source/client/view/structure/desktop/layers/shell/taskbar/programs/taskbar-item.tsx@@ -3,10 +3,11 @@ import { type TaskbarPosition } from "@phreshos/core"import { forwardRef, type ReactNode } from "react"/**- * A window on the Taskbar. The windows sit flat and translucent in the bar, so- * the active one, raised in the primary color, is the one that stands out.+ * A window on the Taskbar, or a pinned Program with no window. The windows sit flat and translucent+ * in the bar, so the active one, raised in the primary color, is the one that stands out; a Program+ * with no window is its icon alone, part of the bar until pointed at.*/-export default forwardRef<HTMLButtonElement, TaskbarItemProps>(function TaskbarItem({ active = false, icon, position, labeled = true, children, className, ...props }, ref) {+export default forwardRef<HTMLButtonElement, TaskbarItemProps>(function TaskbarItem({ active = false, closed = false, icon, position, labeled = true, children, className, ...props }, ref) {const horizontal = position === "top" || position === "bottom"@@ -18,7 +19,7 @@ export default forwardRef<HTMLButtonElement, TaskbarItemProps>(function TaskbarIref={ref}aria-pressed={active}size="small"- depth={active ? "raised" : "flat"}+ depth={active ? "raised" : closed ? "none" : "flat"}color={active ? "primary:soft" : undefined}material={active ? undefined : resting}iconOnly={horizontal && !named}@@ -41,6 +42,9 @@ interface TaskbarItemProps extends Omit<ButtonActionProps, "children"> {active?: boolean+ /** A pinned Program with no window: nothing painted around its icon at rest. */+ closed?: boolean+// Every system entry has either its Program icon or the system default.icon: string