macos-window-activationlisted
Install: claude install-skill qol-tools/qol-skills
# macOS Window Activation & Focus
Foregrounding another process's window on macOS is not `NSRunningApplication.activate`. That call is **non-authoritative** on modern macOS and loses to apps that re-assert frontmost. The reliable path talks to the WindowServer directly via private SkyLight symbols, the way AltTab.app does.
## The core gotcha: `activate(.ignoringOtherApps)` is inert on macOS 14+
`NSRunningApplication.activate(options: .activateIgnoringOtherApps)` (objc2: `activateWithOptions(NSApplicationActivationOptions::ActivateIgnoringOtherApps)`) is **deprecated and has no effect from macOS 14**. The Swift toolchain says so itself:
```
'activateIgnoringOtherApps' was deprecated in macOS 14.0: ignoringOtherApps is
deprecated in macOS 14 and will have no effect.
```
It can still **return `true`** while doing nothing forceful, so a `let ok = app.activate(...)` check is not success evidence. Reproduce against an app that re-asserts frontmost and classify failures by these durable shapes:
- **Mode A** — target app never comes forward (the user's "selected app didn't focus").
- **Mode B** — right app, wrong window (a floating window like Teams' "Sharing Indicator" wins).
## The fix: authoritative activation via SkyLight
Bring the process **and** a specific window to the front through the WindowServer. `_SLPSSetFrontProcessWithOptions` is authoritative; two synthetic event records then make the chosen window key.
```rust
#[repr(C)]
#[derive(Clone, Copy)]
struct ProcessS