system settings
git clone https://git.lucas.co/cce-system-interface.git
fix: render the ctrl-nav section highlight on System
The last page carrying the bug 573bf43 fixed on Accounts and Storage. `System`,
`System Actions`, `CPU`, `GPU` and `Battery` passed a hardcoded `false` as their
focused argument while only `CPU Governor` and `GPU Power` were threaded, so ctrl+j
moved the app-side section index through all seven groups with nothing on screen to
show for five of them — the keypress looked like a no-op.
Storage is the precedent that sections with no focusable widget still highlight:
its `section_widgets()` is `[[], [], [backup_button]]` and all three flags are
threaded. System's seven groups are likewise mostly empty; the indices already
lined up (add_section order is System, System Actions, CPU, GPU, CPU Governor,
GPU Power, Battery), so only the arguments changed.
Live-verified by a pixel-diffed ctrl+j walk: before, presses landing on sections
0/1/2/3/6 changed 0-288 px (just the CPU% readout ticking) while 4 and 5 changed
239k and 143k; after, all seven change 91k-622k.
Co-Authored-By: Claude Opus 5 <[email protected]>
src/pages/system_info.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/pages/system_info.rs b/src/pages/system_info.rs
index 1914c34..d29d545 100644
--- a/src/pages/system_info.rs
+++ b/src/pages/system_info.rs
@@ -489,7 +489,7 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
let mut builder = PageLayoutBuilder::new(layout, cx, cy, cw, ch, sec_w).with_section_count(8);
// ── 1. System Section ──
- builder.add_section(&mut final_pc, "System", false, |sec| {
+ builder.add_section(&mut final_pc, "System", sec_focused.first().copied().unwrap_or(false), |sec| {
if !state.loaded {
sec.text("Loading system information...", 12.0, 0.0, 14.0, TEXT_FG);
} else {
@@ -499,7 +499,7 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
});
// ── 2. System Actions Section ──
- builder.add_section(&mut final_pc, "System Actions", false, |sec| {
+ builder.add_section(&mut final_pc, "System Actions", sec_focused.get(1).copied().unwrap_or(false), |sec| {
let mut stack = sec.vstack(8.0);
let act_btn_h = 32.0;
@@ -532,7 +532,7 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
});
// ── 3. CPU Section ──
- builder.add_section(&mut final_pc, "CPU", false, |sec| {
+ builder.add_section(&mut final_pc, "CPU", sec_focused.get(2).copied().unwrap_or(false), |sec| {
if !state.loaded {
sec.text("Loading CPU model and utilization...", 12.0, 0.0, 12.0, TEXT_FG);
} else {
@@ -546,7 +546,7 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
});
// ── 4. GPU Section ──
- builder.add_section(&mut final_pc, "GPU", false, |sec_gpu| {
+ builder.add_section(&mut final_pc, "GPU", sec_focused.get(3).copied().unwrap_or(false), |sec_gpu| {
if !state.loaded {
sec_gpu.text("Loading GPU models...", 12.0, 0.0, 12.0, TEXT_FG);
} else {
@@ -633,7 +633,7 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
});
// ── 7. Battery Section ──
- builder.add_section(&mut final_pc, "Battery", false, |sec_bat| {
+ builder.add_section(&mut final_pc, "Battery", sec_focused.get(6).copied().unwrap_or(false), |sec_bat| {
if !state.loaded {
sec_bat.text("Loading battery status...", 12.0, 0.0, 12.0, TEXT_DIM);
} else {