Desktop application shell
The openlogi-desktop application is the user-facing OpenLogi process. It turns agent state, local camera discovery, saved settings, and packaged resources into the device gallery, device workspaces, Flow, Settings, pairing, updates, and diagnostics. The agent owns device I/O and input hooks. The desktop presents the product experience and sends device intent through IPC, with local UVC access as the camera exception. See Application composition, Background agent service, Command-line interface, Interprocess communication, and Cross-device flow.
Application lifecycle
The desktop process starts the GUI, loads user settings, connects to the agent, and runs one event loop. The loop applies complete agent snapshots, discovers local cameras, resolves resources, handles settings work, and accepts openlogi:// actions.
The desktop is an IPC client. The agent remains the source of truth for device inventory, permissions, pairing, Flow peer sessions, and device commands. The desktop discovers UVC cameras locally because they do not use the agent's HID++ inventory.
The startup and runtime flow is:
flowchart TD
A[Start desktop process] --> B[Load settings and locale]
B --> C[Connect to agent]
C --> D[Create shared state]
D --> E[Open or focus the main window]
E --> F[Run event loop]
F --> G[Apply agent snapshots]
F --> H[Discover local cameras]
F --> I[Resolve packaged and cached resources]
F --> J[Accept deep links and settings actions]
G --> K[Render product experience]
H --> K
I --> K
J --> K
K --> L[Send user intent through IPC or local camera access]
The process keeps one desktop instance. A second launch exits instead of creating a second product session. A dock or launcher reopen can restore the main window while the resident agent continues to run. Closing the last GUI window ends the desktop process; it does not need to stop the agent.
The shell uses neutral loading and error states until it has a usable snapshot. It distinguishes reconnecting from an unreachable agent and from an agent that speaks a newer protocol. Configuration failures fail closed instead of presenting controls that may not be safe to save.
References: crates/…/runtime.rs• L71-201 crates/…/app.rs• L641-799 crates/…/status.rs• L66-180 crates/…/ipc.rs• L103-151
Shared application state
Shared application state is the presentation model used by all desktop views. It joins agent observations with the device catalog, active selection, saved configuration, feature readings, Flow status, camera records, and the IPC command sender.
The desktop uses these agent link states:
| State | User-facing meaning |
|---|---|
| Connecting | No usable agent snapshot has arrived. |
| Reconnecting | The link dropped and the client is trying to restore it. |
| Unreachable | The agent has stayed unavailable long enough to show an error. |
| Outdated GUI | The running agent speaks a newer protocol and the desktop must restart. |
| Ready | The desktop has a current agent status snapshot. |
Agent snapshots provide complete state updates. The desktop merges them with standalone devices and local cameras. It keeps known records through short inventory gaps and keeps selection tied to device identity rather than list position. This prevents a reordered or briefly missing device from opening another device's workspace.
Configuration has an ownership boundary. The desktop saves user settings and asks the agent to reload them. Device values become confirmed only after a device read-back or typed result. Camera controls are the local UVC exception. Flow settings are edited by the desktop, while peer link state and pairing progress come from the agent.
The same boundary protects edits made by another OpenLogi process. When the agent reports a different configuration revision, the desktop adopts the newer file, refreshes its projections, and waits for the agent to confirm that exact revision before it treats dependent controls as safe to write again.
References: crates/…/state.rs• L121-223 crates/…/agent.rs• L56-105 crates/…/config.rs• L42-210 crates/…/reconciliation.rs• L15-95
User-facing windows
The desktop shell presents one main device workspace plus single-instance auxiliary windows for Settings, Flow, and pairing. About and Updates are pages inside Settings rather than separate windows.
Device gallery
The device gallery is the main entry to the product. It shows HID++ devices, standalone devices, saved offline devices, and local cameras as one catalog. Each card gives identity, device type, connection state, battery data when available, and product artwork.
Users can choose grid, list, or carousel presentation without changing device order or selection. Connected devices appear before offline devices. The gallery distinguishes scanning, unavailable discovery, and a completed empty result, so a slow scan does not look like a missing device.
Offline records keep useful identity and saved capability data for later review. Their connection label uses only unambiguous history. It does not claim a live Bluetooth, receiver, or cable route from radio support alone.
References: crates/…/home.rs• L49-87 crates/…/home.rs• L156-274 crates/…/views.rs• L32-128 crates/…/devices.rs• L264-389
Device detail workspace
The device detail workspace adapts to the selected device. Its navigation shows product areas supported by measured capabilities or safe offline capability data. Every device has an information view. Other views cover buttons, Actions Ring, keys, pointer behavior, lighting, cameras, headset audio, or standalone lights.
Capability data controls the workspace more strongly than the reported device kind. The Device area groups identity and configuration with keyboard controls such as Fn-lock, host keyboard layout behavior, backlight, Easy-Switch host switching, and Disable Keys. Supported G-series keyboards also expose software ownership and profile or nine-button choices for their gaming keys.
The selected device identity stays in the route. If inventory removes that record, the shell returns to the gallery instead of showing another device under the old detail page. Offline detail pages make pending changes clear rather than implying that hardware accepted them.
References: crates/…/app.rs• L47-235 crates/…/app.rs• L679-799 crates/…/detail.rs• L117-189 crates/…/detail.rs• L943-985 crates/…/host_switch.rs• L18-108
Binding editors
Binding editors use one action model across mouse controls, keyboard controls, and Actions Ring slots. The action catalog groups actions, supports search, supplies localized labels and icons, and validates custom application and command targets. This keeps the same user intent model across device surfaces while allowing each surface to show only the actions that fit its scope.
The mouse workspace and keyboard Keys view pair a visual device surface with a fixed inspector. The keyboard surface adapts to the available product data: it can use marked keys, a keypad model, a measured keypad render, or a conservative function-row fallback. Keypad pages and G-key profiles change which binding scope the inspector edits. The inspector also supports power-user actions such as typed text, scripts, shell commands, application targets, and workflows.
The Actions Ring editor shows eight slots around a ring. It separates ring-wide options from the action assigned to the selected slot. It can edit the default layout or an application-specific layout, with application layouts inheriting the default until changed. Long app-profile lists stay inside the profile strip, so the binding inspector and Add app control remain usable within the window.
Changing device, keypad page, gaming profile, or application profile discards an unfinished editor draft. This keeps an action from being saved to a new scope by accident.
References: crates/…/binding_editor.rs• L24-45 crates/…/binding_editor.rs• L273-384 crates/…/function_row.rs• L159-207 crates/…/function_row.rs• L317-345 crates/…/function_row.rs• L794-909 crates/…/editors.rs• L39-109 crates/…/action_ring.rs• L20-107
Device setting confirmation
Device settings use a common contract: show a reading, accept user intent, send the change through the owning service, and replace the local preview with the confirmed result. Sliders preview during a drag and commit on release, so pointer movement does not become a stream of hardware writes.
Pointer, keyboard, headset, mouse force-sensing, and gaming-key settings remain tied to the selected device and active route. DPI writes are saved only after the device accepts them. A rejected or superseded write leaves the editor on the value the device reports instead of saving the request.
Keyboard lighting provides enablement, brightness, and a small color palette. Standalone lights shape brightness and temperature controls from the device's advertised ranges. Their edits can remain pending until the full command result is known, and a failed multi-command edit keeps accepted values while restoring rejected values.
Disable Keys adds a stronger safety gate because it changes both device behavior and saved policy. The control is writable only when the device is online, persistent, freshly read, and the current configuration revision is confirmed. A device write must be confirmed before the setting is saved, and an external configuration change must be reconciled before writing resumes.
References: crates/…/device_reads.rs• L54-69 crates/…/device_reads.rs• L1311-1347 crates/…/dpi.rs• L130-233 crates/…/disable_keys.rs• L246-273 crates/…/disable_keys.rs• L346-479 crates/…/light.rs• L395-523 crates/…/keyboard_rgb.rs• L44-124 crates/…/standalone.rs• L20-212
Camera experience
The camera tab hosts a live preview beside a separate control panel. The preview starts only for the selected camera while the tab is visible. It uses the camera's capture identity and releases the stream when the user changes device or tab.
The control panel reads UVC state when it becomes visible and reapplies saved values. It writes on slider release and offers Default, Streaming, Video call, and saved custom profiles. Lens and image controls use the camera's supported ranges. Frequency and low-light settings use compact choices when the device reports those forms. Auto modes remain visible beside controls that they own; a manual edit takes that control back.
Profiles apply as one camera edit and custom profiles track later accepted changes while selected. A failed batch is followed by a fresh read, clears the active profile, and leaves the panel waiting for a usable camera state. This prevents saved profiles and controls from claiming values the camera did not take.
References: crates/…/app.rs• L713-783 crates/…/detail.rs• L847-887 crates/…/runtime.rs• L487-522 crates/…/devices.rs• L482-531 crates/…/controls.rs• L42-73 crates/…/controls.rs• L231-278 crates/…/rows.rs• L39-83
Flow window
Flow is the desktop experience for moving the pointer and keyboard between paired computers. Its window shows screen arrangement, devices that can follow a peer, each peer's link state, and whether a transfer is ready.
The window edits Flow preferences such as enablement, screen-edge placement, modifier use, and per-device Easy-Switch channels. Readiness stays conservative: a peer needs a configured route, a reachable agent session, and an online set of switchable devices that can move together. Adding a computer opens an agent-owned pairing session. Invalid arrangements or channel assignments are refused before they replace the saved Flow configuration.
References: crates/…/flow.rs• L79-205 crates/…/flow.rs• L341-599 crates/…/arrangement.rs• L74-164 crates/…/pairing.rs• L94-140
Settings and pairing windows
Settings holds app-wide choices such as appearance, language, startup behavior, assets, updates, permissions, and product information. Appearance changes update open windows. Language changes update window text and menus. Permission pages show the platform-specific access needed by the agent or camera.
The About page presents the build identity, product links, configuration-file location, and a way to copy the current diagnostics report. The Add Device window presents an agent-owned pairing session. The user chooses a receiver, selects a discovered device when needed, follows passkey instructions, and sees the result returned by the agent. A failed or undelivered command produces a direct failure instead of a local session that cannot progress. Receiver choice stays explicit across retries and inventory changes.
References: crates/…/add_device.rs• L1-16 crates/…/add_device.rs• L99-145 crates/…/tests.rs• L64-177 crates/…/about.rs• L11-31 crates/…/about.rs• L34-109 crates/…/assets.rs• L62-150 crates/…/permissions.rs• L38-110 crates/…/permission_guide.rs• L28-63
Updates and diagnostics
The Updates page gives the user one view of release status and one update choice. The desktop can check Stable or Beta channels and stage an accepted update for the next restart. A manual check works when automatic checks are off.
Diagnostics turns the current desktop and agent view into a support report. It includes live link status, build and protocol identity, permissions, update channel, asset source, receivers, and device state. On macOS, the Settings diagnostics page also checks for other applications that intercept mouse input. Debug builds can show the raw event-tap list and recent hook events to explain input lag.
References: crates/…/updater.rs• L1-39 crates/…/updates.rs• L18-89 crates/…/diagnostics.rs• L18-180 crates/…/diagnostics.rs• L18-99 crates/…/diagnostics.rs• L102-184
Window and platform behavior
The shell gives its main and auxiliary windows a shared lifecycle. A window registry keeps each auxiliary window single. Menu actions, deep links, and pairing requests focus existing windows. Window sizes fit the display work area so titlebars and lower controls remain reachable.
The application accepts the openlogi:// URL scheme. External callers and menu-bar actions can show the main window, open Settings or About, check for updates, add a device, open Flow, open a device or application profile, and open a camera on its information or preview page. Device links can arrive before the first complete inventory; the shell holds the latest waiting page and applies it when the named record appears. A later command replaces the waiting page.
On macOS, the desktop registers the bundled agent service because the operating system resolves that service from the calling app bundle. The selected appearance also controls native app chrome. On Linux, the main window advertises the shared application identity so the desktop groups it with the product launcher. When a compositor does not provide a titlebar, the shell supplies one for that window only.
References: crates/…/deeplink.rs• L22-129 crates/…/deeplink.rs• L131-207 crates/…/tests.rs• L99-267 crates/…/main_window.rs• L52-111 crates/…/main.rs• L120-169 crates/…/windows.rs• L106-203
Theme and language system
The theme system gives framework controls and custom device views one appearance model. Users can follow the system appearance or choose Light and Dark modes. They can choose a named theme, interface scale, and corner radius. The shell repairs text and selection contrast when a theme does not meet the app's readability needs.
Build-time theme discovery embeds the upstream theme set and keeps the OpenLogi theme in the product. The shell loads language catalogs before it creates menus and windows. A live language change refreshes open windows, menus, and cached input placeholders without a process restart.
Shared controls use the same palette for panels, toggles, selected states, focus rings, and slider rows. This keeps device workspaces and Settings readable as the user changes themes or interface scale.
References: crates/…/theme.rs• L123-175 crates/…/theme.rs• L239-379 crates/…/theme.rs• L404-500 crates/…/components.rs• L101-220 crates/…/slider_row.rs• L141-211
Bundle and resource model
The desktop crate is a bundled application. Its bundle metadata defines the OpenLogi identity, macOS category and version, icon, openlogi:// scheme, camera permission, and packaged asset tree. Windows executable resources carry the matching icon and version identity.
Runtime device assets resolve from packaged resources first, then from a writable user cache. Device artwork can include hero renders for the gallery, control renders for feature views, metadata for interactive controls, and lighting geometry for keyboard glow. When no verified artwork exists, the UI uses a safe synthetic fallback.
The resource flow is:
flowchart LR
A[Packaged resources] --> C[Asset resolver]
B[User cache] --> C
D[Asset index and mirrors] --> B
C --> E[Gallery and feature views]
C --> F[Synthetic fallback art]
Asset synchronization obtains the shared index and downloads resources needed by known HID++ devices, standalone devices, and local cameras. Hash checks protect files before they enter the cache. Settings can request a refresh or clear the user cache. Bundle resources remain read-only. Live asset subscriptions are keyed by the selected source, so changing the source moves downloads to the new mirror without a restart.
References: crates/…/Cargo.toml• L1-16 crates/…/Cargo.toml• L87-104 crates/…/build.rs• L61-127 crates/…/assets.rs• L1-20 crates/…/assets.rs• L217-279 crates/…/runtime.rs• L524-677
Change checklist
When these files or sections are changed, remember to consider these:
- Keep agent link state, permission state, inventory health, and the first usable snapshot aligned. Reconnecting must remain distinct from confirmed device state.
- Keep device inventory, standalone devices, cameras, saved identities, presence grace, and selected record identity aligned. A source change must not switch the user to another device.
- Keep live routes separate from offline connection history. History may explain a card but must not become a writable hardware route.
- Keep capability-based tabs aligned with feature panels. Measured capability must win over an incorrect reported device kind.
- Keep the action vocabulary, localized labels, and embedded icons aligned. Payload-bearing actions need labels that show their useful value, including modifier-only holds.
- Keep keyboard binding scope tied to the selected persistent device, keypad page, G-key profile, and application profile. Changing scope must discard drafts.
- Keep Actions Ring profile inheritance and button-binding scope separate. Resetting or removing a ring profile must not change unrelated device bindings.
- Keep device readings separate from saved preferences. A local preview is not hardware confirmation until the owning service reports success.
- Keep DPI persistence tied to the device's accepted write result. A rejected or superseded value must not become the reconnect value.
- Keep route and read-flight identity on cached device reads. A later device revision must invalidate older results.
- Keep Disable Keys writes behind both device confirmation and exact configuration-revision reconciliation.
- Keep multi-command standalone-light edits pending until every answer is accounted for. Preserve accepted parts when a batch is partial.
- Keep camera capture IDs separate from camera configuration keys. Keep active camera profiles clear when a batch write cannot be confirmed.
- Keep deep-link pending-page replacement aligned with cold launch, inventory completion, and main-window reuse.
- Keep the singleton window registry, launcher identity, work-area fit, titlebar behavior, native appearance, icons, and platform registration aligned across targets.
- Keep appearance preference, selected theme, contrast adjustment, interface scale, native window chrome, icons, and platform registration aligned across targets.
- Keep resource subscriptions keyed by asset source and model identity. Cache downloads remain hash-checked.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The IPC link drops while the last snapshot still looks healthy | The UI can show stale device state as live | Show reconnecting state and mark the link unreachable when recovery fails. |
| A newer agent answers the handshake | The desktop can look live while its state is frozen | Show the outdated-GUI state and require a restart. |
| A device route or settings revision changes while a read or write is in flight | Old data can appear under the new connection | Match results to device, route, read flight, and request identity. |
| A detail route outlives its selected device | The user can see another device under the old detail page | Validate record identity and return to the gallery. |
| An inventory snapshot briefly omits a device | A device card can disappear during a normal probe gap | Keep persistent records through the bounded presence grace, but do not treat the grace record as a fresh sighting or writable route. |
| A camera preview remains targeted after navigation | The stream can consume resources or show the wrong camera | Set the target only for the visible selected camera tab and use the capture identity. |
| A camera batch write fails partway through | A profile can describe values the camera did not take | Resync from live UVC state, clear the active profile, and wait for a fresh load. |
| A device read from an old route completes after a new route is active | A panel can show a value from the wrong connection | Fence the result by route and read-flight identity. |
| A DPI write is rejected or superseded | The requested value can be saved and replayed even though the device did not use it | Persist only an accepted write and show the device's reported value. |
| A Disable Keys write is confirmed but its save or exact config reload fails | Device behavior and saved policy can disagree | Keep the transaction in recovery and block further writes until save, reload, and a fresh read succeed. |
| A standalone-light batch has both accepted and rejected commands | The UI can claim the full edit succeeded | Keep accepted controls and roll back rejected controls when all answers arrive. |
| A new action variant has no matching localized label or embedded icon | The binding editor can show an invalid label or blank action slot | Add the display and asset contract with the action. |
| A binding draft survives a device, page, gaming profile, or app-profile change | An action can be saved into the wrong scope | Drop the draft whenever its edit scope changes. |
| A Flow arrangement or channel edit breaks the saved invariant | The window can show a route that cannot be used by the agent | Validate the complete Flow configuration before persistence. |
| A deep link arrives before inventory is complete | The app can open Home or later open the wrong record | Hold only the latest unresolved page and match it by stable identity when inventory is ready. |
| A second launch creates another main window | Product navigation and device state can split across sessions | Enforce the GUI single-instance rule and focus or reopen the existing window. |
| The configured asset source changes while subscriptions stay live | Downloads can continue from the old mirror | Include the source in each subscription key and reconcile the live set. |
| The agent lacks a platform permission | Device control or input remapping remains unavailable | Show unknown or denied status and route the user to the platform-specific permission guide. |
Key files
| File | Why to read it |
|---|---|
| crates/…/main.rs | Shows process bootstrap, single-instance behavior, deep-link delivery, and GUI shutdown. |
| crates/…/runtime.rs | Shows how agent snapshots, camera discovery, assets, commands, and deep links meet in the event loop. |
| crates/…/windows.rs | Defines auxiliary-window singletons, work-area fitting, appearance tracking, and titlebar behavior. |
| crates/…/main_window.rs | Shows main-window reuse, session anchoring, navigation, and platform identity. |
| crates/…/app.rs | Defines the main route, capability-based device workspace, connection frames, and camera lifetime. |
| crates/…/deeplink.rs | Defines URL actions, stable device matching, and cold-launch pending pages. |
| crates/…/home.rs | Defines the gallery entry point, device cards, discovery states, and transport presentation. |
| crates/…/detail.rs | Defines the device workspace and its feature areas. |
| crates/…/widgets.rs | Defines shared connection labels, agent-live gating, and main-window header actions. |
| crates/…/state.rs | Defines shared presentation state and the boundary between saved configuration and agent commands. |
| crates/…/agent.rs | Defines snapshot projection and the agent link lifecycle. |
| crates/…/config.rs | Defines configuration persistence, rollback, and fail-closed errors. |
| crates/…/reconciliation.rs | Defines adoption and exact-revision confirmation for external configuration changes. |
| crates/…/devices.rs | Defines the merged catalog, stable device identity, cameras, standalone devices, and offline records. |
| crates/…/device_reads.rs | Defines route-aware cached reads and confirmation of device settings. |
| crates/…/dpi.rs | Defines accepted DPI writes, read-back values, and per-device persistence. |
| crates/…/disable_keys.rs | Defines guarded Disable Keys writes, persistence, and recovery. |
| crates/…/light.rs | Defines optimistic standalone-light edits and partial-write recovery. |
| crates/…/action_ring.rs | Defines default and application-specific Actions Ring layouts and profile edits. |
| crates/…/flow.rs | Defines Flow readiness, device participation, peer state, and saved Flow edits. |
| crates/…/binding_editor.rs | Defines the shared action catalog, custom action editors, labels, and icons. |
| crates/…/function_row.rs | Defines the keyboard, keypad, and function-row binding workspace. |
| crates/…/editors.rs | Defines power-user action and workflow editors inside the keyboard inspector. |
| crates/…/host_switch.rs | Defines the device table for linking supported pointing devices to a keyboard's host switch. |
| crates/…/action_ring.rs | Defines the Actions Ring editor and ring-wide settings. |
| crates/…/controls.rs | Defines camera reads, UVC writes, auto modes, and built-in or saved profiles. |
| crates/…/rows.rs | Defines the camera profile row and the range-aware control presentation. |
| crates/…/keyboard_rgb.rs | Defines keyboard lighting enablement, color, and brightness controls. |
| crates/…/standalone.rs | Defines capability-shaped standalone-light controls and command status. |
| crates/…/permissions.rs | Shows platform-specific permission status and recovery entry points. |
| crates/…/about.rs | Shows build identity, product links, config location, and diagnostics export. |
| crates/…/diagnostics.rs | Shows the macOS input-conflict check and debug event inspection. |
| crates/…/add_device.rs | Shows the agent-owned pairing experience. |
| crates/…/arrangement.rs | Shows the screen arrangement and peer placement experience. |
| crates/…/pairing.rs | Shows the agent-owned Flow peer pairing experience. |
| crates/…/theme.rs | Keeps custom surfaces, framework themes, appearance, contrast, scale, and radius in one model. |
| crates/…/assets.rs | Defines packaged and cached device artwork resolution. |
| crates/…/assets.rs | Defines user controls for asset sources, refresh, cache clearing, and cache location. |
| crates/…/diagnostics.rs | Defines the support report built from the live GUI and agent view. |
| crates/…/build.rs | Defines build-time theme discovery and Windows executable resources. |
| crates/…/Cargo.toml | Defines bundle identity, URL scheme, icons, and packaged resources. |