Skip to content

Bind sticky notes to windows for per-window layout save/restore #85

@kordless

Description

@kordless

Goal

Tag sticky notes with the windowUid of the Hyperia window that owned them at creation time, so layout save (#82) can capture which stickies were visible per window and restore (#83) can show the right ones.

Current state

Sticky notes (app/sticky.ts:252-264 NoteData) are app-global:

type NoteData = {
  id: string;
  name?: string;
  text?: string;
  color?: string;
  filePath?: string;
  x?: number; y?: number; width?: number; height?: number;
  saved_at?: string;
  last_closed_at?: string;
};

Stickies persist to ~/.hyperia/stickys/notes.json as a flat list. They are not bound to any specific Hyperia window — they float free.

Scope

  • Add optional windowUid?: string to NoteData
  • When createStickyNote is called from a window context (e.g. via the MCP sticky_note_create tool issued by an agent in a specific window), tag the note with that window's UID
  • Add helper listStickiesForWindow(windowUid: string): NoteData[] that returns notes with matching windowUid and no last_closed_at (i.e. visible)
  • On layout save (Save window layout on close with modal prompt #82): collect IDs from listStickiesForWindow(windowUid) into SavedLayout.stickyIds
  • On layout restore (Restore window layouts on app launch #83): for each stickyIds[i], ensure the note window is open at its saved geometry

Edge cases

  • Stickies created before this change have no windowUid — they remain global, not tied to any window
  • Closing a sticky removes it from "visible" but not from storage; restore should reopen it
  • If a sticky's windowUid window is gone but the user wants to restore the sticky → fall back to the most recently focused window or skip

Files touched

  • app/sticky.ts — extend NoteData, add listStickiesForWindow, accept windowUid in createStickyNote
  • sidecar/src/ghost/registry.rs and sidecar/src/mcp.rs — when an agent creates a sticky, pass through the originating window UID
  • app/ui/window.ts — pass window UID through to sticky creation calls when relevant

Depends on

#82 (which defines the windowUid concept and SavedLayout.stickyIds field). Can be implemented as data-only first, with restore behavior added in #83.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions