AvengeMedia / AvengeMedia/DankMaterialShell
Printers: show and allow setting the CUPS default printer
- Dominant language
- QML
- Stars
- 8.1k
- Forks
- 515
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 102
Description
### Feature Description
The Printers UI (Settings → Printers, and the printer widget) should show the real CUPS default printer and offer a per-printer **Set as default** action that actually updates CUPS.
Today `CupsService.selectedPrinter` is a display-only selection:
- it never reads or writes the CUPS `DefaultPrinter` (nothing in the daemon's CUPS API sends `CUPS-Set-Default`, and nothing queries `CUPS-Get-Default`);
- it is not persisted (not in settings or session data);
- `updatePrinters()` initializes it to `printerNames[0]`, i.e. whichever queue happens to sort first.
So a printer can appear "selected" in DMS while `lp` and `lpstat -d` keep using a different queue, and applications that follow the CUPS default may select a different queue. This is not a CUPS bug — CUPS behaves as designed; the gap is that the DMS UI presents a selection that can easily be mistaken for the default because the real default is not indicated, and offers no way to change the actual default.
### Use Case
Two queues: `EPSON-TM-T20II` (receipt printer) and `Smart_Tank_580-590` (CUPS default). DMS shows the Epson as the selected printer because it sorts first, which reads as "Epson is my default" — but jobs submitted without an explicit destination still go to the HP. Nothing in the DMS printer UI can change that; you have to drop to a terminal.
Steps to reproduce:
1. Have two print queues where the CUPS default sorts alphabetically *after* another queue (e.g. `EPSON-TM-T20II` and `Smart_Tank_580-590`, with the latter as default).
2. Open the DMS printer UI → the Epson appears selected.
3. `lpstat -d` → `system default destination: Smart_Tank_580-590`; `lp file.pdf` goes to the HP queue.
4. No action in the DMS printer UI changes this. Running `lpadmin -d EPSON-TM-T20II` outside DMS does — `lpstat -d` then reports `system default destination: EPSON-TM-T20II` — and the DMS printer UI looks identical before and after, since it neither shows nor tracks the real default.
Verified on v1.5.3 (avengemedia COPR, Fedora 44) and unchanged on current `master`:
- `quickshell/Services/CupsService.qml` — `selectedPrinter` is a plain property with the `printerNames[0]` fallback, not persisted;
- the daemon's CUPS surface covers create/delete/pause/resume printers, jobs, classes, test page — but has no set-default or get-default method;
- `core/pkg/ipp/constants.go` already defines `OperationCupsSetDefault` (0x400a) and `OperationCupsGetDefault` (0x4001), but nothing references them yet.
### Compositor(s)
All compositors
### Proposed Solution
1. Show the actual CUPS default clearly in the printers list (via `CUPS-Get-Default`, or the default flag from `CUPS-Get-Printers`).
2. Add a **Set as default** action per printer.
3. Have that action really update CUPS with `CUPS-Set-Default` (the IPP op constant is already defined in `core/pkg/ipp/constants.go`); it likely needs the same PolicyKit/auth path as add/remove printer.
4. Don't present the visual `selectedPrinter` in a way that implies it is the default — either mark it as a view filter or drop the implicit first-queue preselection.
### Alternatives/Existing Solutions
`lpadmin -d ` in a terminal, the CUPS web UI (`localhost:631`), or `system-config-printer` — all outside DMS.
Contributor guide
Research direction
Start with quickshell/Services/CupsService.qml and core/pkg/ipp/constants.go, then inspect the daemon's existing CUPS printer operations and PolicyKit path. Use lpstat -d with multiple queues to verify the UI shows the real default, the per-printer action changes it, and the visual selection no longer implies a default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100