Skip to content

Follow frontmost app when placing new windows - #45

Merged
qeude merged 1 commit into
mainfrom
t3code/fix-new-window-focus
Aug 28, 2026
Merged

Follow frontmost app when placing new windows#45
qeude merged 1 commit into
mainfrom
t3code/fix-new-window-focus

Conversation

@qeude

@qeude qeude commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Capture the frontmost process when finalizing snapshots.
  • Place non-floating windows spawned by the frontmost app on their assigned workspace and focus them.
  • Add coverage for persisted workspace placement and background discovery.

Testing

  • Not run.

- Preserve focus when new windows target persisted workspaces
@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown

Greptile Summary

Captures the frontmost process while finalizing each snapshot so focus resolution and reconciliation use the latest application state.

  • Routes the captured process identifier into focused-window resolution.
  • Lets non-floating windows from the frontmost application activate and focus their persisted workspace.
  • Adds coverage for persisted placement and background-window discovery behavior.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or non-blocking defects identified.

The updated snapshot timing, focused-process propagation, and workspace-following behavior are internally consistent with the stated policy and added test coverage.

Important Files Changed

Filename Overview
Sources/DefiMacOS/MacOSPlatform+Snapshot.swift Moves frontmost-process capture to snapshot finalization and supplies it to focused-window resolution.
Sources/DefiMacOS/SnapshotEngine.swift Updates focused-window resolution to accept the snapshot’s captured frontmost process identifier.
Sources/DefiRuntime/WindowReconciliation.swift Allows non-floating frontmost-app spawns to activate and focus their assigned workspace.
Tests/DefiRuntimeTests/BackgroundWindowDiscoveryTests.swift Distinguishes frontmost and background processes in discovery coverage.
Tests/DefiRuntimeTests/PlacementPreferencesTests.swift Verifies that a frontmost-app spawn follows persisted workspace placement and becomes selected.

Sequence Diagram

sequenceDiagram
    participant SE as SnapshotEngine
    participant WS as NSWorkspace
    participant AX as Accessibility API
    participant WR as Window Reconciliation
    SE->>WS: Read frontmost process at finalization
    SE->>AX: Resolve focused window for process
    SE->>WR: Reconcile snapshot and process ID
    WR->>WR: Place new window in assigned workspace
    WR->>WR: Focus non-floating frontmost-app spawn
Loading

Reviews (1): Last reviewed commit: "fix(focus): follow frontmost app when pl..." | Re-trigger Greptile

@qeude
qeude merged commit d24edca into main Aug 28, 2026
2 checks passed
@qeude
qeude deleted the t3code/fix-new-window-focus branch August 28, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant