Skip to content

Commit ff94735

Browse files
committed
fix(gui): keep a borderless active-device marker on gallery cards
Moving the ring to hover left the active device with no persistent marker once the gallery overflows into a left-aligned scroll (it no longer centres the selection), so only the page dot showed which device owns the live bindings and DPI. Give the active card a faint accent fill — a borderless marker that reads whether or not the carousel centres it — while the accent ring still appears on hover.
1 parent faca372 commit ff94735

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

crates/openlogi-gui/src/app/home.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use super::widgets::{add_device_button, kind_label, settings_button};
2525
use crate::asset::GlowGeometry;
2626
use crate::components::carousel::Carousel;
2727
use crate::state::{AppState, DeviceRecord};
28-
use crate::theme::{self, HEADER_H, Palette};
28+
use crate::theme::{self, HEADER_H, Palette, SelectableStyle as _};
2929

3030
/// Home (gallery) top bar: the "Devices" title, a Settings gear, and the
3131
/// Add-Device button — the entry points the old carousel header used to carry.
@@ -73,7 +73,7 @@ pub(super) fn device_gallery(cx: &mut Context<AppView>) -> impl IntoElement {
7373
.uniform(px(theme::GALLERY_CARD_W))
7474
.gap(px(GALLERY_GAP))
7575
.accent(rgb(theme::ACCENT_BLUE).into())
76-
.render_item(move |idx, _focused, _window, cx| {
76+
.render_item(move |idx, focused, _window, cx| {
7777
let pal = theme::palette(cx);
7878
let Some(record) = cx
7979
.try_global::<AppState>()
@@ -86,10 +86,10 @@ pub(super) fn device_gallery(cx: &mut Context<AppView>) -> impl IntoElement {
8686
.try_global::<AppState>()
8787
.and_then(|s| keyboard_glow(s, &record));
8888
let view = view.clone();
89-
device_card(&record, glow, pal)
89+
device_card(&record, focused, glow, pal)
9090
.id(("device-card", idx))
9191
.cursor_pointer()
92-
.hover(move |s| s.bg(pal.surface).border_color(rgb(theme::ACCENT_BLUE)))
92+
.hover(move |s| s.border_color(rgb(theme::ACCENT_BLUE)))
9393
.on_click(move |_, _, cx| {
9494
view.update(cx, |this, cx| this.open_device(key.clone(), cx));
9595
})
@@ -170,14 +170,16 @@ pub(crate) fn glow_canvas(geom: Arc<GlowGeometry>, color: Hsla) -> impl IntoElem
170170

171171
/// A device card in the Home gallery: the device photo floating on the window
172172
/// background above the name, connectivity dot, kind/slot, and battery. Fixed
173-
/// width so cards stay equal in the scrollable row. The border stays transparent
174-
/// at rest — a card only shows its accent ring on hover (wired by the gallery),
175-
/// so an idle row carries no boxed-in chrome; the live device is marked by the
176-
/// carousel's centring and page dot instead. The transparent 1px is always
177-
/// reserved so the hover ring never nudges the layout. Returns a bare [`Div`] so
173+
/// width so cards stay equal in the scrollable row. No card shows a border at
174+
/// rest — the accent ring appears only on hover (wired by the gallery). The
175+
/// `active` device (whose bindings and DPI are live) keeps a persistent but
176+
/// borderless marker: a faint accent fill, which reads whether or not the
177+
/// carousel centres it. The 1px border is always reserved in a transparent
178+
/// colour so the hover ring never nudges the layout. Returns a bare [`Div`] so
178179
/// the gallery can wire the hover and click handlers.
179180
fn device_card(
180181
record: &DeviceRecord,
182+
active: bool,
181183
glow: Option<(Arc<GlowGeometry>, Hsla)>,
182184
pal: Palette,
183185
) -> Div {
@@ -190,6 +192,7 @@ fn device_card(
190192
.rounded(pal.card_radius)
191193
.border_1()
192194
.border_color(gpui::transparent_black())
195+
.selected_fill(active)
193196
.child(
194197
div()
195198
.relative()

0 commit comments

Comments
 (0)