Files
craft-libs/crates/print/src
Juan JuradoandFredApps 1ee01a4c58 craft-print: ask macOS for Auto Select when a job names no tray (#232)
* craft-print: ask macOS for Auto Select when a job names no tray

CUPS gives a job that names no tray the PPD's default tray. On a queue
whose default tray is empty (a Xerox AltaLink defaulting to Tray 1), the
printer holds every job ("Tray 1 is empty") while CUPS reports it
completed, so nothing prints. Preview prints because the macOS Print
dialog's Paper Feed: Auto Select sends AP_D_InputSlot with an empty value,
which drops the PPD's default tray (storytold/pdfcraft#3752).

- lp_args sends `-o AP_D_InputSlot=` on macOS when the job's options name
  no InputSlot. A tray the job names wins; checked with cupsfilter on a
  synthetic PPD: with both, CUPS emits the InputSlot's code.
- apply_queue_defaults (now shared with apps that read options
  themselves, such as PdfCraft) gives the driver's tray option an
  AUTO_SELECT choice, labelled "Auto Select", first and as the default,
  so a dialog shows what lp_args sends. It is left out when the user's
  lpoptions defaults name another tray, since lp adds that tray to every
  job and it wins.

Linux jobs are unchanged: AP_D_InputSlot is Apple's.

* craft-print: match queue defaults to the PPD without regard to case

CUPS treats PPD option and choice names as case-insensitive. A queue
default spelled otherwise than the PPD (inputslot=tray2 for InputSlot
Tray2) was ignored, so on macOS apply_queue_defaults showed Auto Select
although lp would send Tray2. Keys and choices now match case-
insensitively and keep the PPD's spelling. lpoptions -l prints the PPD's
spelling, so this matters for callers passing defaults from elsewhere.

Review: storytold/craft-libs#232 (CodeRabbit).

* README: keep both the macOS tray and the Flatpak notes (the merge left the conflict markers in)

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-10 19:15:15 +01:00
..