Orvial journal

Why window placement is a desired-state problem

Coordinates describe where a window was. A useful workspace system needs to understand where work belongs now.

Window placement becomes a desired-state problem as soon as a computer moves between desks. Coordinates can describe where a window was, but they cannot explain what that window was doing there, which other work it belonged beside, or where it should go when the available displays change.

That distinction is the foundation of Orvial.

Coordinates remember the past

A conventional saved layout can record a useful snapshot: this window occupied these bounds on this display. On the same desk, with the same display identifiers and usable areas, restoring that snapshot may be enough.

Modern laptop work is less stable. At home, a development workspace might span three displays. At the office, the same person may use an ultrawide and the built-in laptop display. Between those desks, the workspace has not stopped being “Development,” but almost every physical coordinate has changed.

This is not merely a theoretical edge case: Apple’s NSScreen.screens documentation says the screen list should not be cached because displays can be added, removed, or reconfigured dynamically.

If the system treats each topology as an unrelated collection of rectangles, the user must maintain several copies of what is conceptually one workspace. Those copies drift. A new application is added to one layout but not another. A priority changes. An old fallback remains hidden until the next trip.

Desired state preserves intent

Desired state starts from a different question:

What relationships should be true when this workspace is ready?

In Orvial’s model, a Scene describes the logical workspace. An Environment describes the desk that exists now. Resolving the Scene against the Environment produces a desired workspace that can actually be satisfied with the current displays and capabilities.

This allows a target to express more than a global position. It can belong to a semantic display role, use an Environment-specific override, or apply a deliberate fallback when the preferred role is unavailable.

The same logical Scene remains intact. Only what genuinely differs is overridden.

Adaptation must still be deterministic

“Adaptive” cannot mean “make something up that looks plausible.” A useful workspace engine must produce the same resolution from the same validated inputs, explain any fallback it applied, and distinguish a deliberate fallback from a best-effort guess.

That is why Orvial’s core is not an unconstrained AI agent. Future natural-language interfaces may help interpret what a person wants, but planning, safety, execution, and verification remain deterministic responsibilities.

The system needs bounded rules for questions such as:

  • Which display role is available?
  • Which explicit fallback applies?
  • Is the observed window identity strong enough to act on?
  • Is the current evidence complete enough to establish absence?
  • Which actions are actually required to converge?

When those questions cannot be answered safely, refusing to act can be the correct result.

The plan should contain only the delta

Desired state also changes how restoration is executed. The goal is not to replay every historical action. It is to compare observed reality with resolved intent and calculate the smallest plan required for convergence.

If five windows are already correct and three need adjustment, the ideal plan leaves five alone. This improves speed, reduces disruption, makes undo more precise, and narrows the surface where macOS or another application can resist.

The final state must be observed again

Even a deterministic plan cannot guarantee that another application accepted every change. macOS Accessibility calls can time out. Applications can correct their own geometry. A window can disappear, enter fullscreen, or be replaced while the plan is running.

For that reason, desired state ends with a comparison against a fresh observation—not with an optimistic “command sent” message.

The promise is larger than placing rectangles. It is preserving the meaning of a workspace as reality changes, then reporting honestly whether that meaning was restored.

In summary

  • Coordinates describe a previous physical arrangement.
  • A Scene describes the logical workspace as intended.
  • An Environment describes the desk and capabilities available now.
  • Resolution adapts intent through explicit, deterministic rules.
  • Planning calculates the minimal delta.
  • Verification checks the real result.

That is the difference between saving window positions and building a desired-state workspace engine.

About the author

Building Orvial from the engine outward.

The founder is developing Orvial as a deterministic macOS workspace orchestration product. Public writing distinguishes product intention, implementation evidence, and measured results.

Follow the build

More notes, when they matter.