89 lines
3.7 KiB
Markdown
89 lines
3.7 KiB
Markdown
# lore-forge desktop client
|
|
|
|
A tray application for people working in Lore repositories, and the per-user service it talks
|
|
to. The design is in [.ai/designs/desktop-client.md](../.ai/designs/desktop-client.md).
|
|
|
|
| Program | What it is |
|
|
| --- | --- |
|
|
| `forge-desktop` | The GUI: a UHDK window and tray icon, drawn with Dear ImGui (C++) in a pixel-art style |
|
|
| `forge-service` | The client service: does the Lore work and runs policies (Rust) |
|
|
| `forge-tui` | A terminal frontend. Not written yet |
|
|
|
|
On first run the window asks which Lore server you work on (for example
|
|
`lore.example.com`), signs you in through the forge in your browser, and lists the
|
|
repositories you can clone. Nothing needs configuring first.
|
|
|
|
## Build and run
|
|
|
|
You need Zig 0.17.1 and Rust. On macOS you also need the Xcode Command Line Tools. From this
|
|
directory:
|
|
|
|
```sh
|
|
zig build # both programs, installed in zig-out/bin/
|
|
zig build run # open the GUI; it starts the service if none is running
|
|
zig build test # the GUI's self-test against a private service, then cargo test
|
|
```
|
|
|
|
Closing the window hides it to the tray when there is one. The tray's Quit ends the GUI and
|
|
leaves the service running; STOP SERVICE in the window stops it.
|
|
|
|
`forge-desktop --licenses` prints the licences of what is compiled in: the IBM VGA 8x16 font
|
|
(CC BY-SA 4.0, by VileR), Dear ImGui, UHDK and glad.
|
|
|
|
The service keeps its socket, `desktop.toml` and `service.log` in:
|
|
|
|
| Platform | Directory |
|
|
| --- | --- |
|
|
| macOS | `~/Library/Application Support/lore-forge/` |
|
|
| Linux | `~/.config/lore-forge/`; the socket is in `$XDG_RUNTIME_DIR/lore-forge/` |
|
|
| Windows | `%APPDATA%\lore-forge\`; the socket is a named pipe |
|
|
|
|
Set `LORE_FORGE_DESKTOP_DIR` to use one directory instead. A Unix socket path must stay under
|
|
about 100 bytes, so keep that directory's path short.
|
|
|
|
The GUI keeps the server you chose in `server` in the same directory. Workspaces are added
|
|
from the window; the service records them in `desktop.toml`:
|
|
|
|
```toml
|
|
# desktop.toml
|
|
[[workspace]]
|
|
name = "my-game"
|
|
path = "/Users/me/lore/my-game"
|
|
remote = "lores://lore.example.com:41337/me/my-game"
|
|
autosync = "off" # off, interval or on_change
|
|
```
|
|
|
|
## Self-test
|
|
|
|
`forge-desktop --test` runs against a private service in a new temporary directory and exits 0
|
|
once the service has answered and a frame has been drawn.
|
|
|
|
- **`--config-from desktop.toml`** gives that service workspaces. The test then syncs the
|
|
first one and waits for its progress.
|
|
- **`--tab files|graph|tree`** opens on that tab.
|
|
- **`--screenshot out.png`** saves the final frame. Use it to check UI changes; it needs a
|
|
display that is awake (on macOS a sleeping display makes the window fail to open).
|
|
- **`--service PATH`** picks the service binary to start.
|
|
|
|
## Other platforms
|
|
|
|
`zig build check -Dtarget=x86_64-windows-gnu` (or `x86_64-linux-gnu`) cross-compiles the GUI.
|
|
|
|
Cargo builds the service for the host only. For another platform, build it with Cargo for that
|
|
target and put `forge-service` beside `forge-desktop`.
|
|
|
|
Platform limits come from UHDK:
|
|
|
|
- **Linux:** Wayland only. The tray needs a StatusNotifier host.
|
|
- **Windows:** builds target `x86_64-windows-gnu`.
|
|
|
|
## Layout
|
|
|
|
| Path | Contents |
|
|
| --- | --- |
|
|
| `gui/src/` | The GUI: frame loop, sidebar and service handling (`main.cpp`), the explorer tabs (`explorer.cpp`), protocol client, platform glue, the pixel-art theme and icons (`theme.cpp`), the compiled-in font and licences (`embedded.cpp`) |
|
|
| `gui/uhdk_imgui/` | UHDK's ImGui platform backend, copied from UHDK's examples |
|
|
| `protocol/` | Message types and socket location; the reference the C++ client follows |
|
|
| `service/` | The client service |
|
|
| `vendor/` | UHDK, Dear ImGui and the font, unmodified; see [vendor/README.md](vendor/README.md) |
|