Introducing a new way to review your PRs.

Read the announcement

aprilnea / openlogi

⚡️A native, local-first alternative to Logitech Options+, written in Rust 🦀 — remap buttons, DPI, and SmartShift over HID++. No account, no telemetry.

View on GitHub

25 documents · Updated Nov 23, 2026

docs / permissions-and-assets

Permissions and packaged assets

Permissions and packaged assets are shared services that help OpenLogi reach protected device interfaces and show device art at run time. Permission checks adapt to each operating system, while reusable Linux rules can be installed only after the user asks. See Shared platform services for the wider service model, Core domain and configuration for device and settings concepts, User interface foundation for shared UI resources, and Desktop application for the runtime that consumes these services.

Permission model

The permission model reports whether a capability is available without prompting the user during a status check. The service stays separate from the UI, so the process that owns a protected resource remains responsible for any consent prompt or system change.

Permission states

PermissionStatus has three meanings: Granted, Denied, and Unknown. Unknown covers a platform state that is not yet decided and a missing device, so the UI does not treat device absence as a user denial.

References: crates/…/lib.rs• L42-52 crates/…/linux.rs• L17-40

macOS capabilities

macOS separates access by resource. Accessibility enables the event hook used for remapping. Input Monitoring enables the agent to open HID devices. Bluetooth is shown as a platform status even though supported BLE mice normally use the HID path. Camera access enables a connected Logitech webcam preview.

Status reads never prompt. The agent owns the event hook and HID handles, so it requests the related access. The camera feature owns its camera access. The GUI can open the matching System Settings pane, but it does not claim consent for resources owned by another process.

References: crates/…/lib.rs• L1-29 crates/…/lib.rs• L54-71

Linux device access

Linux uses device-file access instead of privacy consent records. OpenLogi checks three access paths: read/write access to /dev/uinput for virtual input devices, read/write access to a Logitech /dev/hidraw* device for HID communication, and read access to each hookable Logitech /dev/input/event* node for remapping.

The probe maps these checks into the same three states used by the GUI. It reports Denied when uinput is unavailable, a present Logitech hidraw device is inaccessible, or a physical mouse event node needed by the hook is inaccessible. It reports Unknown when uinput is available but no Logitech hidraw device is present. A missing event node does not by itself block Granted because it can mean that the system did not expose a node to inspect.

Only hookable physical mouse nodes affect the event result. The probe excludes non-mouse companion nodes, OpenLogi's pass-through device, and nodes that udev does not classify as mice. Any definite denial among the remaining physical nodes takes priority over readable siblings because one inaccessible mouse can otherwise make remapping fail silently. The uinput probe uses the same read/write access needed to create the virtual device.

References: crates/…/linux.rs• L17-40 crates/…/linux.rs• L75-113 crates/…/linux.rs• L146-187 crates/…/linux.rs• L229-240 crates/…/linux.rs• L263-340 crates/…/tests.rs• L7-35 crates/…/tests.rs• L50-89 crates/…/tests.rs• L137-277

Linux rule installation

Linux repairs a denied device-access state by installing OpenLogi's udev rules. The desktop asks polkit to run the same executable as root with one fixed install argument. The root half writes the bundled rules, reloads udev, and re-applies them to the covered input devices so connected hardware can receive access without a reconnect.

The installation path is limited to a fixed executable, fixed argument, bundled rule content, and fixed destination. It writes through a temporary file and renames it into place, so a partial write cannot become the active rule file and a destination symlink is not followed. If the rules are managed by Flatpak or NixOS, OpenLogi does not write them; it shows the host-specific manual path instead. The rules use seat-based uaccess ACLs where a seat manager is available, while systems without one require the more deliberate input-group guide.

The user-facing request waits for authentication and installation to finish, so callers must keep it off the UI thread. A successful result means the rules were applied; the caller still re-checks device access because the seat manager must grant the final ACL.

References: crates/…/udev.rs• L1-34 crates/…/udev.rs• L79-141 crates/…/udev.rs• L191-240 crates/…/udev.rs• L243-293 crates/…/tests.rs• L10-50 crates/…/tests.rs• L52-107

Asset lifecycle

The asset lifecycle moves a shared device registry and its files from an asset source into either a release bundle or a user cache. The same registry format serves packaging and desktop runtime use, so both paths can identify a product and verify the files they use.

Asset registry

The asset registry is an index of device depots. A depot is a reusable asset group for one product family and can list several model IDs when transports or hardware revisions share the same art. Each file entry carries its expected size and SHA-256 value.

The registry also describes the baseline files that make a device useful to the UI: interaction metadata, model or colour variants, and a hero render. A separate buttons render can support views that need accurate button positions. Metadata accepts current and older depot formats, so optional assignment fields do not discard image dimensions needed by the renderer. When a slot ID contains a HID++ control ID, the runtime can connect that interaction point to the matching control. Legacy and current file naming schemes remain part of the registry contract.

References: crates/…/index.rs• L1-26 crates/…/index.rs• L40-86 crates/…/index.rs• L88-126 crates/…/metadata.rs• L1-14 crates/…/metadata.rs• L48-98

Asset source selection

A sync run selects one complete source and keeps that source for all files in the run. Automatic mode races the built-in OpenLogi, Cloudflare Pages, and jsDelivr sources. The first source with a complete valid catalog wins. A saved preference can pin one source, while OPENLOGI_ASSETS can provide an explicit source for development or controlled deployments.

The jsDelivr path adds a routing catalog because device depots can live in different package shards. The route catalog must use the supported schema and asset release version. It must also provide a route for every depot in the main registry before jsDelivr can supply files. These checks keep a sync from mixing catalogs, package versions, or file hosts.

References: crates/…/source.rs• L1-10 crates/…/source.rs• L21-50 crates/…/source.rs• L87-114 crates/…/source.rs• L149-170 crates/…/source.rs• L173-229 crates/…/source.rs• L242-291 crates/…/sync.rs• L279-310

Asset packaging

The packaging path downloads the registry and the files needed by known device depots into the desktop asset directory before the application bundle is built. It removes depot directories that no longer exist in the registry, so a release snapshot stays aligned with the current catalog.

The macOS distribution flow can include this snapshot for offline use. When it does not include the snapshot, the bundle is intentionally created without device art and the runtime can fetch it on first launch.

References: crates/…/sync.rs• L1-8 crates/…/sync.rs• L54-115 xtask/…/bundle.rs• L43-60

Asset integrity

Remote files enter a cache only when their bytes match the hash recorded in the registry. Existing matching files are reused, and replacement writes are atomic, so a failed or partial transfer does not become the active asset.

Remote depot and file names are limited to single safe path components. This keeps registry data from writing outside the cache or bundle area.

References: crates/…/http.rs• L190-220 crates/…/http.rs• L294-335 crates/…/sync.rs• L209-231

Runtime asset availability

Runtime components resolve device art from the best local source before they use fallback behavior. A release bundle is read first, then the writable user cache. The bundle stays read-only while sync writes only to the user cache.

Device resolution

The runtime maps a connected device to a registry depot by using its model identity. It first uses the strict model form, then a model-ID suffix when transport formatting differs, and finally an exact firmware-name match for older registry data. Standalone devices resolve directly from their registry model ID without creating HID++ identity data.

Once a depot is found, the resolver selects the matching model or hand variant from its manifest. It keeps the interaction view and gallery hero view separate when the depot provides both, and it reads the actual PNG or WebP dimensions so hotspot positions remain aligned with the rendered image. Older metadata and legacy file names remain usable. A missing or unreadable optional variant can fall back to another drawable render, while an encrypted variant can use the base model's render and metadata. Keyboard assets can also provide live lighting geometry from a stored mask or from enclosed transparent areas in the render. The result gives downstream device views a display name, device kind, interaction metadata, image dimensions, and optional live keyboard lighting geometry.

The resolver also supports standalone devices with an exact registry model lookup. It remembers successful reads for the life of the resolver, while a new resolver exposes files that arrive after a download or disappear after cache clearing.

References: crates/…/assets.rs• L118-215 crates/…/assets.rs• L217-335 crates/…/assets.rs• L338-480 crates/…/assets.rs• L482-533 crates/…/assets.rs• L602-651 crates/…/images.rs• L8-18 crates/…/images.rs• L104-118 crates/…/images.rs• L120-253 crates/…/glow.rs• L35-77 crates/…/glow.rs• L79-187 crates/…/glow.rs• L189-237 crates/…/tests.rs• L132-227 crates/…/tests.rs• L307-389 crates/…/tests.rs• L1185-1301

Runtime synchronization

The desktop sync loads the shared index once before it fetches device depots. It does this even when no device is connected, so the resolver is ready for the next device. It then fetches only the model-level targets needed by the current device set. HID++ targets use model identity and firmware name, while standalone targets use the driver's registry model ID. The sync reuses verified cache hits and treats individual depot or optional-variant failures as recoverable. The index failure is more serious because device resolution depends on it.

Automatic sync runs in debug builds and in release builds without a populated bundle, unless the user or environment disables it. Settings actions can refresh or clear the cache at any time. A completed sync rebuilds the resolver so new files become visible to device views.

The following flow shows how packaged files and downloaded files reach a runtime device view.

flowchart LR
    Registry[Asset registry] --> Package[Release package]
    Registry --> Sync[Runtime sync]
    Package --> Bundle[Read-only app bundle]
    Sync --> Cache[Per-user asset cache]
    Bundle --> Resolver[Asset resolver]
    Cache --> Resolver
    Device[Connected device] --> Resolver
    Resolver -->|match and load| View[Device view]
    Resolver -->|no usable asset| Silhouette[Synthetic silhouette]

References: crates/…/sync.rs• L23-41 crates/…/sync.rs• L43-143 crates/…/sync.rs• L145-207 crates/…/runtime.rs• L190-203 crates/…/runtime.rs• L390-405

Asset settings

The Assets settings page exposes the user controls for this lifecycle. Users can choose automatic source selection or pin a source, enable automatic downloads, refresh known-device assets, clear the user cache, and open its folder in the platform file manager. Turning automatic downloads off still leaves packaged art and the silhouette available.

The page sends refresh and clear requests to the runtime instead of changing files in the UI event handler. This keeps network and file work away from the interface and lets the runtime rebuild device views after cache changes.

References: crates/…/assets.rs• L58-147 crates/…/assets.rs• L171-200 crates/…/assets.rs• L224-229 crates/…/assets.rs• L38-59 crates/…/assets.rs• L64-115

Shared UI asset source

The desktop application has a small asset source for assets used by its own interface. It makes the application logo available from the binary, exposes shared action-ring glyphs, and delegates other component icons to the UI library's bundled set.

This source is separate from device art. Device art is model data that can be packaged or downloaded. UI assets are stable application resources that runtime components can request by their UI asset path.

References: crates/…/app_assets.rs• L1-24 crates/…/app_assets.rs• L26-39

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the owner of a consent prompt aligned with the process that opens the protected resource. A GUI-only change can silently authorize the wrong binary.
  • Keep the permission status meaning aligned across platform probes and Settings labels, especially the difference between Unknown, Denied, and “not requested.”
  • Keep the Linux permission probe aligned with every access path used by the hook and injector: uinput read/write, Logitech hidraw read/write, and hookable physical event nodes.
  • Keep event-node filtering aligned with the hook's device filter and udev's mouse classification. Counting companion nodes or OpenLogi pass-through nodes can create false denials.
  • Keep the udev installation path aligned with the fixed root command, managed-host checks, atomic rule replacement, and the reload and trigger steps needed for connected devices.
  • Keep the registry's model IDs, depot paths, file hashes, and manifest variant IDs consistent with the files published by each asset source.
  • Keep metadata readers tolerant of older depot schemas and keep HID++ control-ID mapping aligned with the slot IDs used by keyboard assets.
  • Keep packaging file selection aligned with runtime resolution. A file that is optional in the bundle must still have a runtime fallback.
  • Keep source preference, environment override, and built-in source probing aligned so a sync uses one complete catalog and one file host.
  • Keep the jsDelivr route schema, asset release version, and depot-to-package entries aligned with the main registry.
  • Keep cache writes limited to verified files and refresh the resolver after a sync or cache clear.
  • Keep HID++ and standalone asset targets keyed by model identity rather than by one physical device, so shared depots are fetched once and reused.
  • Keep variant downloads aligned with the resolver's image and metadata fallback order. Optional files must not prevent a usable hero or buttons view.
  • Keep render format checks based on file contents rather than extensions, and keep image dimensions tied to the exact render used for hotspot placement.
  • Keep keyboard glow masks bounded and valid, and retain a safe fallback when a depot has no usable mask or image decoder.
  • Keep legacy glow cleanup limited to obsolete glow files so it does not remove current renders or metadata.

Important failure modes

TriggerConsequenceGuard
Accessibility or HID consent is requested by the GUI instead of the agentmacOS grants the wrong process, so the hook or HID access still failsRoute the prompt to the agent that owns the resource; use the GUI only for status and System Settings navigation
Linux udev rules do not grant /dev/uinput read/write access, Logitech hidraw access, or read access to a hookable physical event nodeVirtual input creation, HID communication, or remapping cannot startProbe the same access modes and device classes used by the runtime, then show the device-access state and udev-rule guidance in Settings
The udev installer runs inside Flatpak or on NixOSThe package overwrites a host-managed path or reports a repair that cannot workDetect the host rule manager and show its manual installation path
The user dismisses polkit, pkexec is missing, or a reload step failsDevice access remains denied and the user needs an actionable reasonMap the authentication and command outcomes to a clear grant error, then re-probe access after success
A readable Logitech event node is found before an inaccessible physical mouse nodeThe check reports success even though remapping silently misses one mouseTreat any definite denial among hookable physical nodes as Denied, regardless of walk order
A companion keyboard node or OpenLogi pass-through node is counted as a physical mouse nodeA working Linux setup is reported as DeniedFilter event nodes by the hookable mouse capabilities, udev mouse classification, and OpenLogi-owned device names
The registry is missing or cannot be parsedThe runtime cannot map devices to packaged or cached artTreat the index as a required sync result and fall back to the synthetic silhouette
The jsDelivr route catalog has an unsupported schema, wrong release version, or missing depot routeThe jsDelivr source is rejected instead of supplying a mixed asset setValidate the route catalog against the supported schema, asset version, and every registry depot
A remote file hash does not match the registryThe file is rejected and the previous cache file remains activeVerify SHA-256 before the atomic replacement
A release bundle has no usable asset indexBundled art is not available at launchTreat the bundle as absent and allow runtime sync to recover it
A device model or variant is absent from the registryThe device view lacks curated art or uses a generic renderTry the documented identity fallbacks, then render the synthetic silhouette
A standalone model is not registered or its front image is unavailableThe standalone device uses fallback art instead of a model viewKeep standalone lookup exact and allow the generic fallback path
A buttons or colour-variant file is missing or fails to downloadThe resolver uses another usable render, so interaction or gallery detail can be less preciseKeep optional variant fetches best-effort and preserve the baseline hero path
A depot uses an older metadata schema or a slot ID without a usable control IDThe device image remains available, but one or more interaction hotspots are not mappedTreat optional fields as absent and use control IDs only when the slot format supports them
A render is encrypted, malformed, or named without a standard extensionThe resolver may select a file that the UI cannot draw or may scale hotspots from the wrong imageRecognize image formats from file bytes, require a drawable render, and fall back to the base or another valid variant
Render dimensions are taken from metadata instead of the selected fileHotspots drift from the visible controls when the file has transparent padding or a different sizeRead dimensions from the selected PNG or WebP render and keep each side view's dimensions separate
A glow mask has invalid dimensions or run data, or the render has no enclosed transparent areasKeyboard lighting geometry is omitted rather than painted over the wrong pixelsReject invalid masks and derive bounded geometry only from valid image alpha data

Key files

FileWhy to read it
crates/…/lib.rsDefines the cross-platform permission states and the boundary between status checks and platform actions.
crates/…/Cargo.tomlDefines platform-specific dependencies and keeps status checks separate from UI dependencies.
crates/…/linux.rsShows how Linux uinput, hidraw, udev, and hookable event-node access becomes a permission state.
crates/…/udev.rsShows how a user-approved Linux repair installs and reapplies the bundled device rules.
crates/…/tests.rsShows the Linux permission truth table and the cases that prevent false access results.
crates/…/tests.rsShows the safe rule-file replacement and the mapping of polkit outcomes.
crates/…/permissions.rsExplains why the agent must own the macOS Input Monitoring request.
crates/…/permissions.rsConnects permission states and actions to the user-facing Settings flow.
crates/…/index.rsDefines the shared device registry and the files needed for each depot.
crates/…/metadata.rsDefines the shared metadata shape for image dimensions, interaction points, older depot formats, and HID++ control IDs.
crates/…/source.rsExplains mirror selection, route validation, and source consistency during a sync.
crates/…/http.rsDefines download verification and safe cache writes.
crates/…/manifest.rsDefines model and colour-variant resource lookup.
crates/…/sync.rsShows how the full asset set is prepared for packaging.
crates/…/sync.rsShows how runtime sync loads one registry and refreshes model-level assets for HID++ and standalone devices.
crates/…/assets.rsShows the bundle-first resolver, model matching, cache controls, image selection, and fallback path for device views.
crates/…/images.rsShows how manifests select render variants and how PNG or WebP files are checked and sized.
crates/…/glow.rsShows how keyboard lighting geometry comes from a verified mask or render transparency.
crates/…/tests.rsShows the compatibility and fallback guarantees for model lookup, render formats, variants, dimensions, and cache behavior.
crates/…/assets.rsShows the user controls for source choice, downloads, refresh, and cache cleanup.
crates/…/app_assets.rsShows how stable application UI assets are made available to the UI runtime.