fix: Combo key picker and TD buttons visibility

- Combo picker: pass key index directly instead of relying on selected_key_index
- TD actions: use DarkButton for consistent visibility
- Combo Add: validation message when keys not picked

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mae PUGIN 2026-04-07 09:20:54 +02:00
parent 4cfe2fbb7b
commit 362b0c729c
3 changed files with 30 additions and 41 deletions

View file

@ -705,12 +705,9 @@ fn main() {
adv.set_new_leader_result_name(name); adv.set_new_leader_result_name(name);
} }
"combo-key1" | "combo-key2" => { "combo-key1" | "combo-key2" => {
// For combo key picking, the user clicked on the keyboard view. // code = key index from the mini keyboard in the popup
// The selected key index tells us which physical key was clicked.
let key_idx = w.global::<KeymapBridge>().get_selected_key_index();
if key_idx >= 0 {
let keys = keys_arc.borrow(); let keys = keys_arc.borrow();
let idx = key_idx as usize; let idx = code as usize;
if idx < keys.len() { if idx < keys.len() {
let kp = &keys[idx]; let kp = &keys[idx];
let adv = w.global::<AdvancedBridge>(); let adv = w.global::<AdvancedBridge>();
@ -726,7 +723,6 @@ fn main() {
} }
} }
} }
}
"leader-seq" => { "leader-seq" => {
let adv = w.global::<AdvancedBridge>(); let adv = w.global::<AdvancedBridge>();
let count = adv.get_new_leader_seq_count(); let count = adv.get_new_leader_seq_count();

View file

@ -132,9 +132,8 @@ export component KeySelector inherits Rectangle {
scale: parent.kb-scale; scale: parent.kb-scale;
data: keycap; data: keycap;
clicked(key-index) => { clicked(key-index) => {
KeymapBridge.select-key(key-index); // Pass key index as the code — dispatch reads keys_arc[code] for row/col
// The dispatch in main.rs handles combo-key1/combo-key2 KeySelectorBridge.select-keycode(key-index);
KeySelectorBridge.select-keycode(0); // trigger dispatch
KeymapBridge.key-selector-open = false; KeymapBridge.key-selector-open = false;
} }
} }

View file

@ -94,29 +94,23 @@ export component TabAdvanced inherits Rectangle {
for td in AdvancedBridge.tap-dances : Rectangle { for td in AdvancedBridge.tap-dances : Rectangle {
background: Theme.bg-primary; background: Theme.bg-primary;
border-radius: 4px; border-radius: 4px;
height: 30px;
HorizontalLayout { HorizontalLayout {
padding-left: 8px; padding-right: 8px; spacing: 4px; padding: 4px;
padding-left: 8px;
spacing: 4px;
alignment: start;
Text { text: "TD" + td.index; color: Theme.accent-purple; font-size: 11px; vertical-alignment: center; width: 35px; } Text { text: "TD" + td.index; color: Theme.accent-purple; font-size: 11px; vertical-alignment: center; width: 35px; }
for action[a-idx] in td.actions : Rectangle {
width: 60px;
height: 24px;
border-radius: 3px;
background: td-action-ta.has-hover ? Theme.button-hover : Theme.button-bg;
border-width: 1px;
border-color: Theme.button-border;
Text { text: action.name; color: Theme.fg-primary; font-size: 10px; horizontal-alignment: center; vertical-alignment: center; } for action[a-idx] in td.actions : DarkButton {
text: action.name;
td-action-ta := TouchArea {
clicked => { clicked => {
AdvancedBridge.editing-td-index = td.index; AdvancedBridge.editing-td-index = td.index;
AdvancedBridge.editing-td-slot = a-idx; AdvancedBridge.editing-td-slot = a-idx;
KeymapBridge.selector-target = "td-action"; KeymapBridge.selector-target = "td-action";
KeymapBridge.key-selector-open = true; KeymapBridge.key-selector-open = true;
} }
mouse-cursor: pointer;
}
} }
} }
} }