Skip to content

feat(gui): show connection-type icon on device cards#310

Open
laofun wants to merge 1 commit into
AprilNEA:masterfrom
laofun:pr/connection-type-icons
Open

feat(gui): show connection-type icon on device cards#310
laofun wants to merge 1 commit into
AprilNEA:masterfrom
laofun:pr/connection-type-icons

Conversation

@laofun

@laofun laofun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Hard to tell which device is Bolt, Unifying, or plain Bluetooth when you've
got a few in the list — they look the same. This adds a small glyph next to
the battery, picked from the device's route.

Changes

  • Pick an icon from DeviceRoute: bolt, unifying, or bluetooth.
  • Three SVGs embedded alongside the existing action icons.

The bluetooth icon is lucide (already vendored). The bolt and unifying ones
are Logitech's marks — happy to swap for generic if you'd rather not.

Testing

Added a unit test mapping each route to its icon. Verified in the gallery
with devices on both a receiver and direct Bluetooth.

@laofun laofun force-pushed the pr/connection-type-icons branch from 8b87ae5 to 13907b6 Compare June 22, 2026 15:46
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a small connection-type glyph (Bolt, Unifying, or Bluetooth) next to the battery indicator on each device card, making it easy to distinguish receiver-paired from direct-connected devices at a glance. Three SVGs are embedded in the asset pipeline and a new connection_icon_path helper maps DeviceRoute variants to the correct path.

  • connection_icon_path uses fully-explicit match arms (no _ wildcard), so the compiler will catch any future DeviceRoute variant additions — consistent with the exhaustive route_label sibling. The None → bluetooth fallback is clearly documented as a known approximation.
  • app_assets.rs inserts the three icons in correct alphabetical order within the existing ACTION_ICONS table.
  • Unit test covers all four cases (Bolt, Unifying, Direct, None), giving good confidence the mapping won't silently regress.

Confidence Score: 5/5

Safe to merge — the change is purely additive UI, all three icons are statically embedded at compile time, and the route → icon mapping is fully tested.

The logic is straightforward: a pure function maps an enum to a string path, all asset entries are compile-time include_bytes!, and the match is exhaustive. No data mutations, no async paths, no new dependencies. The only acknowledged approximation (None and Direct both resolve to the Bluetooth icon) is explicitly documented in the code comment.

No files require special attention.

Important Files Changed

Filename Overview
crates/openlogi-gui/src/app.rs Adds connection_icon_path helper and inlines a connection-type icon alongside the battery in device_card. Match arms are fully explicit (addressing prior review thread). Unit test covers all four cases (Bolt, Unifying, Direct, None).
crates/openlogi-gui/src/app_assets.rs Three new entries inserted into ACTION_ICONS in correct alphabetical order (bluetooth, bolt between ban/camera; unifying between undo-2/volume-1).
crates/openlogi-gui/action-icons/bluetooth.svg Standard 24×24 lucide Bluetooth stroke icon. Consistent with the lucide set already vendored in the codebase.
crates/openlogi-gui/action-icons/bolt.svg Logitech Bolt logo as a filled SVG; uses a non-zero viewBox origin (7 7 32 32) which is valid and maps the path coordinates correctly to the 24×24 display area.
crates/openlogi-gui/action-icons/unifying.svg Logitech Unifying logo exported from Inkscape; uses Inkscape-native absolute coordinates offset by translate(-33.239067,-367.12994) into the 24×24 viewBox. Mathematically correct; floating-point width (24.002666) is a cosmetic Inkscape artifact.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[device_card] --> B[connection_icon_path
route: Option<&DeviceRoute>]
    B --> C{match route}
    C -->|Some DeviceRoute::Bolt| D[action-icons/bolt.svg]
    C -->|Some DeviceRoute::Unifying| E[action-icons/unifying.svg]
    C -->|Some DeviceRoute::Direct or None| F[action-icons/bluetooth.svg]
    D --> G[svg .size_3 .text_color pal.text_muted]
    E --> G
    F --> G
    G --> H[h_flex: icon + optional battery_view]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[device_card] --> B[connection_icon_path
route: Option<&DeviceRoute>]
    B --> C{match route}
    C -->|Some DeviceRoute::Bolt| D[action-icons/bolt.svg]
    C -->|Some DeviceRoute::Unifying| E[action-icons/unifying.svg]
    C -->|Some DeviceRoute::Direct or None| F[action-icons/bluetooth.svg]
    D --> G[svg .size_3 .text_color pal.text_muted]
    E --> G
    F --> G
    G --> H[h_flex: icon + optional battery_view]
Loading

Reviews (2): Last reviewed commit: "feat(gui): show connection-type icon on ..." | Re-trigger Greptile

Comment thread crates/openlogi-gui/src/app.rs
Comment thread crates/openlogi-gui/action-icons/bolt.svg
Add a small glyph beside the battery on each gallery card so Bolt,
Unifying, and direct Bluetooth connections are distinguishable at a glance.
Three embedded action-icons (bolt, unifying, bluetooth) selected from the
device's DeviceRoute.
@laofun laofun force-pushed the pr/connection-type-icons branch from 13907b6 to ccd0968 Compare June 22, 2026 16:01
@laofun

laofun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Made the connection_icon_path match exhaustive (Some(Direct { .. }) | None) so a new route variant trips the compiler, matching route_label. Left the bluetooth icon as a stroke glyph for now — swapping it to a filled variant is cosmetic and can follow if you prefer visual parity.

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