Skip to content

Commit

Permalink
fix(input): binds not working on non-Latin layouts
Browse files Browse the repository at this point in the history
KeysymHandle::raw_syms() returns typed symbols as-is. For example, if "Й"
(Cyrillic letter 'Io', corresponding to "Q" on the English layout) is
pressed, raw_syms() returns "Cyrillic_io". However, keybinds are
usually defined as "<something>+Q" (i.e., in Latin), which causes a mismatch.
  • Loading branch information
dvtfl committed Sep 11, 2024
1 parent 0d048b1 commit 3206377
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use smithay::{
},
xwayland::X11Surface,
};
use tracing::{error, trace};
use tracing::{error, trace, warn};
use xkbcommon::xkb::{Keycode, Keysym};

use std::{
Expand Down Expand Up @@ -483,7 +483,14 @@ impl State {
// is this a normal binding?
if binding.key.is_some()
&& state == KeyState::Pressed
&& handle.raw_syms().contains(&binding.key.unwrap())
&& (handle.raw_syms().contains(&binding.key.unwrap()) ||
// fallback to the Latin or current layout symbol
// if no binding is found for the current layout's key
handle.raw_latin_sym_or_raw_current_sym()
.unwrap_or_else(|| {
warn!("No keysym found for keypress {:?}: passing NoSymbol", handle);
Keysym::NoSymbol
}) == binding.key.unwrap())
&& cosmic_modifiers_eq_smithay(&binding.modifiers, modifiers)
{
modifiers_queue.clear();
Expand Down

0 comments on commit 3206377

Please sign in to comment.