Skip to content

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

A pinned Program's Windows stand in its place, its icon returning when the last closes; a Window's Taskbar menu opens its Program again

zohayrslileh7ce612bd192c
diff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsx
index cfc200e..69274ca 100644
--- a/source/client/view/structure/desktop/desktop.tsx
+++ b/source/client/view/structure/desktop/desktop.tsx
@@ -546,6 +546,8 @@ export default function Workspace() {
maximized={window.maximized}
+ program={programs.find(program => program.identity === record.program) ?? null}
+
pinned={pinnedIdentities.has(record.program)}
onTogglePinned={togglePinned}
@@ -578,12 +580,15 @@ export default function Workspace() {
{/* What a press means is composed here because it is a person's
expectation, 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 open Windows right after it;
+ 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 => [
- <PinnedTaskbarItem key={`pinned:${program.identity}`} program={program} icon={icon({ program: program.identity })} position={appearance.taskbar.position} />,
- ...windows.listed.filter(record => record.program === program.identity).map(windowItem)
- ])}
+ {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} />]
+ })}
{windows.listed.filter(record => !pinnedIdentities.has(record.program)).map(windowItem)}
diff --git a/source/client/view/structure/desktop/layers/shell/taskbar/programs/window-taskbar-item.tsx b/source/client/view/structure/desktop/layers/shell/taskbar/programs/window-taskbar-item.tsx
index ac8dd80..d30270c 100644
--- a/source/client/view/structure/desktop/layers/shell/taskbar/programs/window-taskbar-item.tsx
+++ b/source/client/view/structure/desktop/layers/shell/taskbar/programs/window-taskbar-item.tsx
@@ -7,9 +7,11 @@ import TaskbarTooltip from "../taskbar-tooltip"
import TaskbarItem from "./taskbar-item"
import useDragHold from "../../../../drag-hold"
import { memo, useCallback } from "react"
+import type Program from "@client/core/link-manager/auth-manager/program-manager/program"
+import { useLaunch } from "../../start-menu/programs/programs"
/** A taskbar entry rerenders only when what that entry shows changes. */
-export default memo(function ({ record, title, icon, position, labeled, active, minimized, maximized, pinned, onElement, onMinimize, onShow, onGoTo, onBringHere, onMaximize, onTogglePinned, onClose }: WindowTaskbarItemProps) {
+export default memo(function ({ record, program, title, icon, position, labeled, active, minimized, maximized, pinned, onElement, onMinimize, onShow, onGoTo, onBringHere, onMaximize, onTogglePinned, onClose }: WindowTaskbarItemProps) {
const scaleContainer = useDesktopScaleContainer()
@@ -39,6 +41,9 @@ export default memo(function ({ record, title, icon, position, labeled, active,
const bringHere = useCallback(() => onBringHere(record), [onBringHere, record])
const close = useCallback(() => onClose(record), [onClose, record])
const togglePinned = useCallback(() => onTogglePinned(record), [onTogglePinned, record])
+ // Its Program again, as the Start Menu opens it: another of it beside this one.
+ const launch = useLaunch()
+ const open = useCallback(() => { if (program) void launch(program).catch(() => undefined) }, [launch, program])
// The title shows on hover and focus, since a Taskbar standing on its side has room for the icon alone.
return <TaskbarTooltip label={title}><ContextMenu>
@@ -56,7 +61,7 @@ export default memo(function ({ record, title, icon, position, labeled, active,
<ContextMenu.Content portalContainer={scaleContainer ?? undefined}>
<WindowMenu title={title} minimized={minimized} maximized={maximized} pinned={pinned}
- onGoTo={goTo} onBringHere={bringHere} onToggleMinimized={changeVisibility} onToggleMaximized={maximize} onTogglePinned={togglePinned} onClose={close} />
+ onGoTo={goTo} onBringHere={bringHere} onToggleMinimized={changeVisibility} onToggleMaximized={maximize} onOpen={program ? open : undefined} onTogglePinned={togglePinned} onClose={close} />
</ContextMenu.Content>
@@ -67,6 +72,9 @@ interface WindowTaskbarItemProps {
record: Process
+ /** Its Program, which its menu opens again; `null` while the Desktop does not know it. */
+ program: Program | null
+
title: string
icon: string
diff --git a/source/client/view/structure/desktop/layers/shell/window-menu.tsx b/source/client/view/structure/desktop/layers/shell/window-menu.tsx
index 24f2ed9..28632cb 100644
--- a/source/client/view/structure/desktop/layers/shell/window-menu.tsx
+++ b/source/client/view/structure/desktop/layers/shell/window-menu.tsx
@@ -1,17 +1,19 @@
import { Menu } from "@phreshos/react-ui"
-import { ArrowDownLeft, ArrowUpRight, LocateFixed, Magnet, Maximize2, Minimize2, Pin, PinOff, X } from "@phreshos/react-ui/icons"
+import { AppWindow, ArrowDownLeft, ArrowUpRight, LocateFixed, Magnet, Maximize2, Minimize2, Pin, PinOff, X } from "@phreshos/react-ui/icons"
/**
* What can be done to one standard Window, the same wherever it is offered: its Taskbar item and its
* icon on the Map. Going to it and bringing it here move between views; the rest act on the Window
* where it is, with the same icons as the Window's own title bar controls.
*/
-export default function WindowMenu({ title, minimized, maximized, pinned, onGoTo, onBringHere, onToggleMinimized, onToggleMaximized, onTogglePinned, onClose }: Readonly<{
+export default function WindowMenu({ title, minimized, maximized, pinned, onGoTo, onBringHere, onToggleMinimized, onToggleMaximized, onOpen, onTogglePinned, onClose }: Readonly<{
title: string
minimized: boolean
maximized: boolean
/** Whether its Program keeps its place on the Taskbar; offered, as Pin or Unpin, only on the Taskbar. */
pinned?: boolean
+ /** Opens its Program again, as the Start Menu does; offered only on the Taskbar. */
+ onOpen?: () => void
onTogglePinned?: () => void
onGoTo: () => void
onBringHere: () => void
@@ -25,6 +27,7 @@ export default function WindowMenu({ title, minimized, maximized, pinned, onGoTo
else if (action === "bringHere") onBringHere()
else if (action === "visibility") onToggleMinimized()
else if (action === "maximize") onToggleMaximized()
+ else if (action === "open") onOpen?.()
else if (action === "pin") onTogglePinned?.()
else if (action === "close") onClose()
}}>
@@ -39,8 +42,11 @@ export default function WindowMenu({ title, minimized, maximized, pinned, onGoTo
<Menu.Item id="maximize" textValue={maximized ? "Restore" : "Maximize"}>{maximized ? <><Minimize2 aria-hidden />Restore</> : <><Maximize2 aria-hidden />Maximize</>}</Menu.Item>
+ {(onOpen || onTogglePinned) && <Menu.Separator />}
+
+ {onOpen && <Menu.Item id="open" textValue="Open"><AppWindow aria-hidden />Open</Menu.Item>}
+
{onTogglePinned && <>
- <Menu.Separator />
<Menu.Item id="pin" textValue={pinned ? "Unpin" : "Pin"}>{pinned ? <><PinOff aria-hidden />Unpin</> : <><Pin aria-hidden />Pin</>}</Menu.Item>
</>}