Skip to content

Optional desktop app for running the server - #6

Merged
KyleJamesWalker merged 15 commits into
mainfrom
feat/gui-server-handle
Oct 2, 2026
Merged

KyleJamesWalker merged 15 commits into
mainfrom
feat/gui-server-handle

Conversation

@KyleJamesWalker

Copy link
Copy Markdown
Owner

An optional desktop app runs the server from a window. It sets the port, the
token, the state directory and mDNS. It starts and stops the server, lists
rooms with their connected screens, and shows the log. It sits behind the gui
Cargo feature, so the CLI, the static Linux builds and the Docker image do not
change.

What changed

  • server: startup and shutdown move out of main.rs into
    Server::start and run_until, which both binaries share. A failed start
    returns a StartError instead of exiting. A stop also ends the snapshot
    writer and the autopilot, so the app can restart on another port.
  • bin/gui: the egui app, on eframe 0.35. eframe 0.36 needs Rust 1.95, and the
    documented minimum is 1.94. The app remembers every field except the token.
    Closing the window or Ctrl-C stops the server the same way Ctrl-C stops the
    CLI. While the server is open to the network with no token, an amber warning
    shows under the status line.
  • packaging: make app builds a signed Simple Confidence Monitor.app.
    icon.svg is the source for every icon file. make icons rebuilds the
    .icns, the .ico and the window PNG from it, and build.rs embeds the
    .ico in the Windows .exe.
  • CI: clippy and the unit tests run over the app. A new build-gui job
    builds it for Linux, macOS on Apple Silicon and Intel, and Windows. Each
    build uploads as an artifact you can open with a double click: a zipped
    .app, the .exe, or a .tar.gz on Linux.

Why

An operator on a venue laptop should not need a terminal to run a show. The
browser screens stay where they are. The app opens them in the browser rather
than drawing its own console.

egui won over Tauri because the app is a control panel for the server, and its
data already lives in Rust. Tauri's main gain would be the console in a
window, which the browser already does. Per-change rationale is in the commit
bodies.

How it was tested

  • make lint is clean on Rust 1.94 and 1.97.1, with and without gui.
  • make test is clean: 369 Rust tests, including the new tests/server.rs
    and the app's unit tests, and 115 JavaScript tests.
  • On macOS I ran the app with two rooms and three sockets, and the viewer and
    console counts matched.
  • Ctrl-C wrote a pending snapshot before the app exited.
  • I launched the .app through open and quit it with a quit Apple Event.
  • codesign --verify --deep --strict passes on both the Apple Silicon and the
    Intel bundle.

Not covered yet

  • This PR is the first run of the Linux, Windows and Intel Mac build-gui
    jobs, and of the Windows icon embedding.
  • The app has only run on macOS.
  • A release does not ship the app. The new matrix stays out of the ci.yml and
    release.yml sync check until it does.
  • The downloaded .app is not notarized. docs/operations.md gives the
    command that clears its quarantine flag.

(\__/)
(+'.'+)
(")_(")

Bunny helped with this PR and is one step closer to world domination...

main.rs held every step from the snapshot store to the graceful stop.
A second binary could not reuse any of it. `server.rs` now holds it.
`Server::start` restores rooms, spawns the snapshot writer and the
autopilot, and binds the listener. `run_until` serves until its future
resolves, then closes every socket and writes pending snapshots.

A failed start returns a `StartError` rather than exiting. The CLI
still prints the Docker ownership hint and exits on a bad state
directory. A window can show the error and let the operator try again.

A stop now aborts the snapshot writer and the autopilot, so a process
that starts the server twice does not keep the first pair running.
`addr` reports the bound port, which matters when the caller asks for 0.

The missing-token warning drops the flag name, since a window has no
flags.

Made-with: Bunny
`simple-confidence-monitor-gui` runs the server from a window, for an
operator who does not want a terminal. It sits behind the `gui` Cargo
feature, so the default build, the static Linux builds and the Docker
image pull in none of it.

The window sets the port, the bind address, the token, the state
directory and mDNS. It starts and stops the server. It lists each room
with its viewer and console counts, and opens the stage display, the
console or the agenda in the default browser. A console link carries
the token. A log panel shows the last 2,000 lines.

It uses egui through eframe 0.35. eframe 0.36 needs Rust 1.95, and the
documented minimum is 1.94. egui keeps the app in Rust and in one build.
The data it shows is already in the `Hub`. Tauri would show the console
in a window, which a browser already does.

The app remembers every field except the token, so the token never
sits in a plain file. Closing the window, or Ctrl-C from a terminal,
stops the server gracefully, and pending snapshots land first. A
release build on Windows opens no console window.

`make gui` runs it, and `make lint` now lints it too.

Made-with: Bunny
The test job runs clippy with the `gui` feature. A new `build-gui` job
builds a release binary for x86_64 Linux (glibc), Apple Silicon macOS
and x86_64 Windows, and uploads each one as a run artifact.

Linux needs the X11 and xkbcommon headers that eframe lists, so both
jobs install them first.

A release does not ship the desktop app yet. The new matrix stays out
of the ci.yml and release.yml sync check, which compares only the CLI
build matrix.

Made-with: Bunny
operations.md gains a section for the desktop app. It covers which
flag each field stands for, what the app remembers and where, and what
closing the window does. The README shows how to build it and links
there.

architecture.md describes `server.rs` and the app. development.md adds
both to the layout, the Linux build headers, `make gui`, and the second
clippy pass. release.md lists the new CI checks.

Made-with: Bunny
A bare binary opens in Terminal on a double click. `bundle.sh` in
`packaging/macos` wraps the binary in `Simple Confidence Monitor.app`.
It stamps the crate version into `Info.plist`, then signs the bundle
ad hoc.

The linker signs only the binary, so Info.plist sits outside its seal.
Signing the bundle as a whole covers both. A downloaded copy is still
not notarized, so Gatekeeper blocks it until its quarantine flag is
cleared.

`make app` builds the release binary and the bundle into
`target/release`.

Made-with: Bunny
Each `build-gui` artifact now opens with a double click. macOS uploads
the `.app` and Windows uploads the `.exe`. Linux uploads a `.tar.gz`.

upload-artifact drops file modes, so the Linux binary and the
executable inside the `.app` would arrive without their execute bit.
The `.app` is zipped with `ditto`, which keeps the modes and the bundle
signature, and Linux uses tar. A Windows `.exe` needs no mode, so it
goes up as is.

Made-with: Bunny
operations.md lists what each CI artifact holds, and how to clear the
quarantine flag that keeps Gatekeeper from opening a downloaded copy.
The README and development.md add `make app` and the packaging folder.
release.md says how CI packages each build.

Made-with: Bunny
The app showed the generic icon everywhere. `packaging/icon/icon.svg`
is now the single source. It is a stopwatch on a blue tile, with a
crown at the top. The ring runs green for the first 75%, amber for the
next 15% and red for the last 10%. Navy cuts mark each color change,
and the hand points into the red.

`make icons` renders the SVG through Quick Look, because ImageMagick's
own SVG renderer drops gradients and strokes. It writes the macOS
`AppIcon.icns`, the Windows `app.ico` and a 256 px PNG. The generated
files are committed, so a build needs neither tool.

Each platform gets the icon its own way. The `.app` bundle carries the
`.icns`. On Windows, `build.rs` uses `winresource` to embed the `.ico`
in the executable. The window gets the PNG through eframe, which sets
the title bar and taskbar icon on Linux and Windows. winresource is an
optional build dependency behind the `gui` feature, so the CLI build
does not pull it in.

Made-with: Bunny
development.md adds `make icons`, build.rs, and the icon and Windows
folders under packaging to the layout.

Made-with: Bunny
`LogBuffer::append` asked the window to repaint while it still held the
log lock. Anything that logs from inside that call would take the same
std mutex again on the same thread, which hangs the app. Nothing was
seen to hang, but the window toolkit owns that path, not this code.

The append now copies the window handle under the lock, releases the
lock, then asks for the repaint.

Made-with: Bunny
The desktop app's own logic had no tests. The log buffer now has tests
for a line split across writes, several lines in one write, the
2,000-line cap and clear. percent_encode has tests for unreserved
characters, query delimiters and non-ASCII text.

They sit in the binary rather than under tests/, because a binary's
modules are out of reach of an integration test. `make test` runs them.

Made-with: Bunny
The Test step runs the library and its integration tests only. A new step runs the tests inside the desktop app binary, with the gui feature on.

Made-with: Bunny
A server with no token, bound to an address other machines can reach,
lets anyone on the network control every room. The only sign was one
log line, which scrolls away. The status bar now says so in amber for
as long as the server runs that way, and says how to fix it.

Binding to this computer only does not raise the warning, since
nothing off the machine can reach the server.

Made-with: Bunny
The CLI ships for Intel Macs, so the desktop app gets the same target. The macOS runner cross-compiles to x86_64-apple-darwin and bundles the result into its own zipped .app.

Made-with: Bunny
The README puts the log and picker paragraph back after the Docker
setup it describes, ahead of the desktop app.

operations.md lists the Intel Mac artifact and the amber warning the
window shows while it serves the network without a token. release.md
adds the app's unit tests and the second macOS build to the CI checks.

Made-with: Bunny
@KyleJamesWalker
KyleJamesWalker merged commit 4fcc042 into main Oct 2, 2026
13 checks passed
@KyleJamesWalker
KyleJamesWalker deleted the feat/gui-server-handle branch October 2, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant