fix: put the popup close button in the dock, and clear the printer location

Three things, none of them redesigns.

The close affordance for a secondary Chrome window was a separate
layer-shell surface anchored to that window's corner, repositioned by a
five-per-second poll. Any position change tore the surface down and
built another, so on real hardware it chased the window and flickered.
Removed entirely: the GTK button process, the geometry maths that placed
it, the --close-button mode that spawned it, and the poll loop that
drove it. The window helper no longer imports GTK at all.

The behaviour underneath it was right and is kept. The first Chrome
top-level is the classroom browser, tiled and borderless; later ones
float centred at about three quarters of the output. Creation order is
the only thing that can tell them apart — confirmed on a real session,
where every Chrome top-level shares app_id, shell, PID and a null
transient_for, and sway exposes no window properties for Wayland
toplevels at all. Titles are still not used. It now follows sway's own
window events instead of polling, so dragging a popup costs nothing.

Close moved into the dock, which was already on screen and does not
move, so it cannot chase anything. It appears only while a secondary
window is focused and runs kill on that one container. The helper
publishes which window that is; the dock watches the file rather than
polling. A stock sway title bar has no close button, so restoring the
border would not have solved this either.

Two bugs found by looking rather than by testing state. Chrome
renegotiates the size of a popup opened with explicit dimensions after
the resize returns, which left windows centred for a width they no
longer had; placement now settles and repeats once, at creation only, so
dragging is still free. And the dock's Close button came up empty
because show_all does not recurse into a no-show-all widget.

The printer's Location is now blank. CUPS prints it under the queue name
in every dialog, so "Ekklesia Classroom" was a second line the teacher
had to read past; the identity is one word. The already-configured check
includes Location, so a machine set up before this is corrected rather
than left as close enough.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-06 20:24:51 -05:00
co-authored by Claude Opus 5
parent a1d8150d7c
commit f65c814eff
18 changed files with 1144 additions and 100 deletions
+72
View File
@@ -41,6 +41,30 @@ None of this touches website logins. Wonder Ink, Google and YouTube
sign-ins are ordinary site sessions and are unaffected by
`BrowserSignin: 0`, which governs signing in to the *browser*.
## Secondary Chrome windows
Chrome gives the main browser and additional top-level windows the same
`google-chrome` app ID, the same browser PID, and no reliable distinguishing
properties. Page titles are site content and are deliberately not used.
`classroom-chrome-windows` follows the Sway tree during the session and assigns
roles by creation order:
- the first Chrome top-level is the main classroom browser and remains tiled,
maximised and borderless;
- every later Chrome top-level floats at 76% of the logical workspace, centred
above the main browser;
- a red **Close ×** button is placed at its top-right and kills only that
secondary container;
- when the secondary closes, the still-tiled main browser underneath has not
been moved or resized.
The Sway `for_window` rule still only removes Chrome borders. There is no broad
Chrome floating rule: the session helper issues commands against the exact
`con_id` of each additional container. If the main window is closed first, the
oldest remaining Chrome window is promoted back to the tiled, borderless main
role.
## What the policies do not remove
The avatar button stays in the toolbar. Verified by screenshotting
@@ -97,3 +121,51 @@ These two requirements genuinely conflict, and which one applies depends
on how teachers actually sign in. Worth knowing before Sunday. If
teachers use Wonder Ink email-and-password accounts, there is no
conflict at all.
## Extra browser windows
The first Chrome top-level window is the classroom browser: tiled,
borderless, filling the desktop above the dock. Every later Chrome
top-level floats instead — centred, about three quarters of the output,
borderless — so it sits over the browser rather than tiling beside it
and shoving the lesson to half width.
Which window is which can only be creation order. Verified on a real
session: every Chrome top-level has the same `app_id`, the same
`shell=xdg_shell`, the same PID, a null `transient_for`, and sway
exposes no `window_properties`, `window_role` or `window_type` for
Wayland toplevels at all. Page titles are deliberately not used.
`classroom-chrome-windows` follows sway's own window events rather than
polling, so dragging a popup costs nothing.
### Closing one
The Close button is **in the dock**, and only while a secondary window
is focused. Clicking it runs `[con_id=N] kill` on that exact container:
never the main browser, never a Chrome process.
An earlier attempt anchored a close button to the popup's own corner as
a separate layer-shell surface. On real hardware it chased the window
and flickered, because every position change meant tearing a surface
down and building another. The dock does not move, so it cannot chase
anything.
Note that a stock sway title bar has no close button, so putting the
border back would not have solved closing either.
### Printing
A site's own Print button opens a Chrome window to render the document
and then a print dialog on top of it. Verified in a real session: that
is **three** top-level windows — the browser, the render window, and a
separate `"Print"` dialog — and the render window is
indistinguishable from a genuine popup by anything except its title.
No special case was added, because there is no signal to special-case
on. The generic treatment already produces the right result: the render
window and the print dialog both float centred and borderless over an
untouched main browser, the dialog is the obvious foreground window, and
anything left behind is one dock click away. The render window used to
be the one thing on screen wearing a sway title bar; it no longer is.
+72 -26
View File
@@ -4,39 +4,67 @@ The package installs and enables CUPS, its client/filter stack, and Debian's
compressed Foomatic PPD database. Chrome is configured to open the system
print dialog, which shows the queues configured in CUPS.
The target Ricoh Aficio MP C3502 supports PCL 5c and PCL 6 as standard;
PostScript 3 is optional. Debian Trixie does not provide a model-specific
C3502 PPD in the installed driver set, so the classroom helper uses Trixie's
recommended generic color PCL 6/PCL XL driver. This works with the printer's
standard language and does not require a vendor binary.
The Ricoh Aficio MP C3502 supports PCL 5c and PCL 6 as standard; PostScript 3
is optional. Debian Trixie does not provide a model-specific C3502 PPD in the
installed driver set, so the classroom uses Trixie's recommended generic color
PCL 6/PCL XL driver. This uses the printer's standard language and requires no
vendor binary.
## Configure the church color printer
## Automatic church printer
Give the helper the printer's IP address or DNS name:
Every provisioning pass runs:
```
sudo classroom-printer-setup 10.20.30.40
classroom-printer-setup
```
This creates or updates one queue named `Classroom_Color`, points it directly
to `socket://10.20.30.40:9100`, enables it, accepts jobs, and makes it the
system default. The printer's address is never stored in the package.
It creates or updates this site-wide queue:
An explicit URI is also accepted when deployment requires another supported
transport:
| Setting | Value |
| --- | --- |
| Queue and display name | `Elmer` |
| Printer | Ricoh Aficio MP C3502 |
| Address | `10.10.0.155` |
| Hardware address | `00:26:73:4F:E7:C9` |
| URI | `socket://10.10.0.155:9100` |
| Default | `Elmer` |
| Print quality | `PrintoutMode=Normal` |
| Color | `ColorModel=Color` |
Those two print options are set explicitly. The generic driver otherwise chose
`Normal.Gray` on the physical printer, which silently made jobs grayscale.
If an older release created `Classroom_Color`, provisioning removes it before
creating Elmer. A correct subsequent run reports that Elmer is already
configured and does not rewrite the queue.
The helper can still take an explicit address for diagnostics or future site
changes:
```
sudo classroom-printer-setup ipp://10.20.30.40/ipp/print
sudo classroom-printer-setup --no-default socket://10.20.30.40:9100
sudo classroom-printer-setup 10.10.0.155
sudo classroom-printer-setup ipp://10.10.0.155/ipp/print
sudo classroom-printer-setup --no-default socket://10.10.0.155:9100
```
The command is idempotent: running it again updates the same queue. It does not
contact the printer while configuring CUPS, and an unreachable printer only
leaves jobs queued; it never affects boot.
The command does not contact the printer while configuring CUPS. An
unreachable printer only leaves jobs queued; the provisioning call is also
capped at 30 seconds, so it cannot affect boot.
## Network printer discovery
Automatic remote queue browsing is disabled. `cups-browsed` is stopped and
disabled if another package installed it, so unrelated advertised label and
check-in printers are not turned into local classroom queues.
disabled, and both `avahi-daemon.service` and `avahi-daemon.socket` are stopped,
disabled and masked. No other classroom component uses Avahi.
This removes the direct DNS-SD destinations that `lpstat -e` can show even when
cups-browsed is inactive, including the Brother check-in printer and the
duplicate discovered Ricoh. The intended output is only:
```
$ lpstat -e
Elmer
```
## Administration
@@ -47,31 +75,49 @@ lpinfo -m
lpinfo -m | grep -i -E 'Ricoh|PCL|PostScript|IPP Everywhere'
```
Show the classroom queue, its URI, and the system default:
Show the queue, URI, system default and print defaults:
```
lpstat -p Classroom_Color -v
lpstat -p Elmer -v
lpstat -d
lpoptions -p Elmer -l | grep -E '^(PrintoutMode|ColorModel)/'
```
Set the default manually:
```
sudo lpadmin -d Classroom_Color
sudo lpadmin -d Elmer
```
Print CUPS's test page:
```
lp -d Classroom_Color /usr/share/cups/data/testprint
lp -d Elmer /usr/share/cups/data/testprint
```
Inspect or cancel queued jobs:
```
lpstat -o Classroom_Color
cancel -a Classroom_Color
lpstat -o Elmer
cancel -a Elmer
```
The printer language choice is based on Ricoh's published
[MP C3002/C3502 specifications](https://assets.ricoh-usa.com/j2jqn9lauv41/1CzJla6qwny2d9oBVHHlID/5bfa366a01cf82162ea24287f99c8af9/aficiompc3002.pdf).
## What the teacher sees
The queue is `Elmer`, its Description is `Elmer`, and its **Location is
deliberately blank**. CUPS prints the Location under the queue name in
every print dialog, so anything there becomes a second line the teacher
has to read past. The printer's teacher-facing identity is one word.
`classroom-printer-setup` enforces this idempotently, and its
already-configured check includes the Location, so a machine set up
before this change is corrected on the next run rather than being left
alone as "close enough".
lpstat -l -p Elmer # Description: Elmer, Location: (blank)
lpstat -p -d # Elmer, and the system default
lpstat -e # Elmer, and nothing else
+9 -4
View File
@@ -9,10 +9,10 @@ them. It is a `oneshot` unit that nothing else waits on, so it never
holds the classroom up, and **it is not allowed to fail the boot**: a
machine with no DVD codecs is still a working classroom.
The package `postinst` enables the service but deliberately does not
start it. Every OTA update reboots the moment the install finishes, and
an apt run killed by that reboot would leave dpkg half-configured. The
next boot is a few seconds away and is a clean place to work.
The package `postinst` enables the service and schedules a delayed start after
the outer apt transaction has had time to release its lock. It never runs
provisioning synchronously inside dpkg. If an OTA reboot happens before the
delayed job, the enabled service runs normally on the next boot.
To provision without waiting for a reboot:
@@ -60,6 +60,11 @@ requires Internet access or hardware to be present.
- Wi-Fi administration: [networking.md](networking.md)
- Church color printer setup: [printing.md](printing.md)
The printer helper is part of every provisioning pass. It is capped at 30
seconds and only configures the local scheduler, so an offline Ricoh cannot
hold boot or provisioning open. Failures are logged and retried on the next
boot. A correctly configured queue is a quick no-op.
## What provisioning does not do
The boot provisioning command never upgrades or reconfigures anything already installed, and it
+26 -6
View File
@@ -35,15 +35,35 @@ before promoting to stable with `./update_stable.sh`.
- [ ] `cups.service` is enabled and `lpstat -r` reports that the scheduler runs
- [ ] `lpinfo -m` contains the generic color PCL 6/PCL XL driver documented in
[printing.md](printing.md)
- [ ] `sudo classroom-printer-setup <printer-ip>` creates only
`Classroom_Color`, enables it, and makes it the system default
- [ ] Repeating the helper updates the same queue without creating a duplicate
- [ ] Chrome opens the system print dialog and shows the configured queue
- [ ] Unrelated label/check-in printers are not automatically added
- [ ] `sudo classroom-printer-setup` creates only `Elmer`, enables it, and
makes it the system default
- [ ] Provisioning creates Elmer automatically at
`socket://10.10.0.155:9100` with description `Elmer`
- [ ] `lpoptions -p Elmer -l` shows `*Normal` for `PrintoutMode` and `*Color`
for `ColorModel`
- [ ] An upgrade removes the old `Classroom_Color` queue
- [ ] Repeating provisioning reports Elmer already configured and does not
rewrite the queue
- [ ] Chrome opens the system print dialog and shows only Elmer
- [ ] `lpstat -e` prints only `Elmer`; neither the Brother label printer nor a
discovered duplicate Ricoh appears
- [ ] `avahi-daemon.service` and `avahi-daemon.socket` are masked
- [ ] The CUPS test page prints in color on the Ricoh MP C3502
- [ ] With the Ricoh powered off, the classroom still boots normally and a job
simply remains queued
## Secondary Chrome windows
- [ ] The first Chrome top-level remains maximised, tiled and borderless
- [ ] A second `google-chrome` top-level floats instead of splitting the main
browser
- [ ] It is centred at roughly three quarters of the logical display
- [ ] Its red Close button is visible and mouse-accessible
- [ ] Close removes only the secondary and reveals the untouched main browser
- [ ] Changing either page title does not change the main/secondary roles
- [ ] A third Chrome top-level also floats and Close targets the newest one
- [ ] Chrome minimise/restore and the dock Browser button still behave normally
## UI scale
UI_SCALE sets sway's output scale, so it scales the whole session.
@@ -92,7 +112,7 @@ into separate layer-shell windows.
- [ ] The Home button returns to Wonder Ink
- [ ] Fullscreen YouTube video uses the whole display
- [ ] Leaving fullscreen restores the correct geometry above the dock
- [ ] Chrome has **no sway title bar** — the window starts at Chrome's
- [ ] The main Chrome window has **no sway title bar** — it starts at Chrome's
own tab strip, and Chrome's tabs and address bar are still there
- [ ] Chrome still maximises and minimises as before
- [ ] After a reboot, no "Restore pages? Chrome didn't shut down