- All PMSessionSetColorMatchingMode* symbols use the 2-arg (PMPrintSession, *const CFString) signature. - PMSessionSetColorMatchingModeLock sets and locks in one call; it does not take a Boolean. - Remove speculative 3-argument transmutes that caused EXC_BAD_ACCESS. - Restrict color-matching modes to application-managed bypass only (AP_ApplicationColorMatching / ApplicationColorMatching). - Preserve the PMSessionGetCurrentPrinter pre-check. - Return bool from set_session_color_matching_mode and log SPI results. - Update non-macOS stub to return bool. - Improve run_native_print_panel error logging when the printer cannot be resolved. - Add unit tests for color-bypass filtering and detection. - Update AGENTS.md with the corrected SPI notes. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
4.0 KiB
4.0 KiB
ICCery Agent Notes
Build Commands
- Rust backend:
cd src-tauri && CARGO_INCREMENTAL=0 cargo check(the project lives on a network filesystem that doesn't support file locking, soCARGO_INCREMENTAL=0is required) - Rust tests:
cd src-tauri && CARGO_INCREMENTAL=0 cargo test - Frontend:
cd src-tauri && npm run build(ornpm run devfor development)
Architecture Overview
- Backend: Rust + Tauri v2 (
src-tauri/) - Frontend: Vanilla JS modules (
src/js/), HTML (src/index.html) - Print subsystem: Platform-specific code under
src-tauri/src/print/mod.rs: Shared types (PrintOptions,Printer,PrinterCapabilities,PrinterDevModeStore)macos.rs: macOS-specificlpspooling and nativeNSPrintPanelintegrationunix.rs: Generic Unix/CUPS utilities (printer enumeration, PPD parsing,lpargs)windows.rs: Windows-specific printing via Win32 API and DEVMODE
Cross-Platform Printer Field Notes
When adding fields to Printer in src-tauri/src/print/mod.rs, update every platform-specific constructor in src-tauri/src/print/windows.rs, src-tauri/src/print/macos.rs, and src-tauri/src/print/unix.rs to avoid build regressions on any target. Use ..Default::default() where possible, or explicitly provide values (e.g. display_name: None on Windows).
macOS Print Properties (Issue #188)
The "Preferences" button opens the native macOS NSPrintPanel (not CUPS web UI or System Settings).
- The CUPS destination ID is bound to the panel via Core Printing
PMPrinterCreateFromPrinterIDandPMSessionSetCurrentPMPrinter - A
Printer.display_name(from CUPSprinter-info) is cached at enumeration as a fallback forNSPrinter::printerWithName - Pre-configured with both
AP_ColorMatchingMode=AP_ApplicationColorMatchingandAP.ColorMatchingMode=AP_ApplicationColorMatching(dot-notation) as a locked PMPrintSettings value and in theNSPrintInfojob ticket - Uses the private Core Printing
PMSessionSetColorMatchingMode/PMSessionSetColorMatchingModeLock/PMSessionSetColorMatchingModeNoLockSPI (resolved at runtime viadlsym) to gray out and lock the Color Matching controls; all three symbols use the 2-argument(PMPrintSession, *const CFString)signature;PMSessionSetColorMatchingModeLocksets and locks in one call;NoLocksets the mode without locking; falls back to the publicPMPrintSettingsSetValuesetting if the SPI is absent - Pre-selects the driver-specific "no color adjustment" PPD option (Canon
CNIJIntent2=4, EpsonEPIJ_CMat=3, etc.) in the native panel and on thelpcommand line - Captures user's media type / quality selections as a CUPS options string with
PMPrintSettingsToOptions - Returns a
PrintPropertiesResultwith the effectiveselected_printerand capturedPrintOptions - Cancellation is returned as
None, not an error - Captured options are stored in frontend
capturedCupsOptionsmap and passed viaPrintOptions.cups_options build_lp_argsinmacos.rsalways adds both-o AP_ColorMatchingMode=AP_ApplicationColorMatchingand-o AP.ColorMatchingMode=AP_ApplicationColorMatching, and forwards captured options- Only
AP_ApplicationColorMatchingandApplicationColorMatchingare passed to the private SPI;AP_ColorSyncMatchingandAP_VendorColorMatchingare intentionally avoided because they would enable color management on profiling targets
Key Dependencies (macOS only)
objc20.6 — MainThreadMarker, rcobjc2-app-kit0.3.2 — NSPrintPanel, NSPrintInfo, NSPrinterobjc2-foundation0.3.2 — NSStringobjc2-core-foundation0.3.2 — CFString, CFTypeobjc2-application-services0.3.2 — PMCore (PMPrintSettings, PMPrinter, PMSession, etc.)
PPD Option Detection
- Epson media type key:
EPIJ_Medi(in addition toCNIJMediaType,MediaType,StpMediaType) - Epson color bypass:
EPIJ_CMat=3(Off / No Color Adjustment) - Canon color bypass:
CNIJIntent2=4orCNIJIntent=4 - Gutenprint:
StpColorCorrection=Uncorrected