Native NSPrintPanel bound to selected queue #13

Open
opened 2026-09-08 17:40:55 +01:00 by gronod · 0 comments
Owner

Summary

Preferences opens NSPrintPanel on the AppKit main thread, bound to the CUPS Printer ID.

Spec refs

docs/11-print-macos.md. #188.

Scope

In: panel binding, Use Settings, cancel=nil, PMRelease.
Out: ColorSync SPI (issue 14), lp spool (15).

Implementation notes

  1. Resolve display name OFF main thread (lpoptions -p).
  2. Main thread: PMPrinterCreateFromPrinterID(queueName) — queue id, NOT display name.
  3. PMSessionSetCurrentPMPrinterPMSessionDefaultPrintSettings / DefaultPageFormat.
  4. Fallback NSPrinter(name: displayName) + setUpPrintOperationDefaultValues.
  5. Default button title "Use Settings" (capture, not print).
  6. Cancel → nil (not Error).
  7. PMRelease the PMPrinter on every path where it was created.
    Forbidden: System Settings URL, CUPS web UI localhost:631, NSWorkspace open of the printer.

Rewrite invariants

#188 bind by CUPS Printer ID; main-thread only; never open System Settings.

Dependencies

Blocks-on: 12.
Unblocks: 14, 16.

Test

  • CI/mock: cancel path returns nil; missing queue errors cleanly.
  • Hardware: panel opens on Epson AND Canon with driver PDE visible.

Acceptance criteria

  • Cancel is not an error.
  • No leaks of PMPrinter (manual review of all paths).
## Summary Preferences opens NSPrintPanel on the AppKit main thread, bound to the CUPS Printer ID. ## Spec refs docs/11-print-macos.md. #188. ## Scope In: panel binding, Use Settings, cancel=nil, PMRelease. Out: ColorSync SPI (issue 14), lp spool (15). ## Implementation notes 1. Resolve display name OFF main thread (`lpoptions -p`). 2. Main thread: `PMPrinterCreateFromPrinterID(queueName)` — queue id, NOT display name. 3. `PMSessionSetCurrentPMPrinter` → `PMSessionDefaultPrintSettings` / `DefaultPageFormat`. 4. Fallback `NSPrinter(name: displayName)` + `setUpPrintOperationDefaultValues`. 5. Default button title "Use Settings" (capture, not print). 6. Cancel → `nil` (not Error). 7. `PMRelease` the PMPrinter on every path where it was created. Forbidden: System Settings URL, CUPS web UI `localhost:631`, `NSWorkspace` open of the printer. ## Rewrite invariants #188 bind by CUPS Printer ID; main-thread only; never open System Settings. ## Dependencies Blocks-on: 12. Unblocks: 14, 16. ## Test - CI/mock: cancel path returns nil; missing queue errors cleanly. - Hardware: panel opens on Epson AND Canon with driver PDE visible. ## Acceptance criteria - [ ] Cancel is not an error. - [ ] No leaks of PMPrinter (manual review of all paths).
gronod added this to the M3 — macOS unmanaged printing (lp) milestone 2026-09-08 17:40:55 +01:00
gronod added the
Priority
Critical
1
Project/ICCery-v2Feature/BackendFeature/UI
labels 2026-09-08 17:40:55 +01:00
gronod reopened this issue 2026-09-09 10:08:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gronod/iccery-v2-mac#13