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 10, 2024
1 parent 0d048b1 commit 458d0bc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 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,12 @@ impl State {
// is this a normal binding?
if binding.key.is_some()
&& state == KeyState::Pressed
&& handle.raw_syms().contains(&binding.key.unwrap())
// WARN: i guess it could break with something like czech layout? check method documentation
&& 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 458d0bc

Please sign in to comment.