Reload shortcuts when layout changed

This commit is contained in:
Junkui Zhang 2025-08-20 17:17:45 +08:00
parent fa3abe789c
commit 366b5d13b0

View file

@ -1308,11 +1308,11 @@ pub fn handle_keymap_file_changes(
})
.detach();
let mut current_mapping = settings::get_key_equivalents(cx.keyboard_layout().id());
let mut current_layout_id = cx.keyboard_layout().id().to_string();
cx.on_keyboard_layout_change(move |cx| {
let next_mapping = settings::get_key_equivalents(cx.keyboard_layout().id());
if next_mapping != current_mapping {
current_mapping = next_mapping;
let next_layout_id = cx.keyboard_layout().id();
if next_layout_id != current_layout_id {
current_layout_id = next_layout_id.to_string();
keyboard_layout_tx.unbounded_send(()).ok();
}
})