default_keymap setting, set wayvr keymap when wayvr starts

This commit is contained in:
galister
2025-12-18 01:29:36 +09:00
parent 595b59b865
commit 2d3c1bb2a3
5 changed files with 29 additions and 3 deletions

View File

@@ -72,6 +72,18 @@ pub fn create_keyboard(app: &mut AppState, wayland: bool) -> anyhow::Result<Over
let mut maybe_keymap = backend
.get_effective_keymap(app)
.inspect_err(|e| log::warn!("{e:?}"))
.or_else(|_| {
if let Some(layout_variant) = app.session.config.default_keymap.as_ref() {
let mut splat = layout_variant.split('-');
XkbKeymap::from_layout_variant(
splat.next().unwrap_or(""),
splat.next().unwrap_or(""),
)
.context("invalid value for default_keymap")
} else {
anyhow::bail!("no default_keymap set")
}
})
.ok();
if let Some(keymap) = maybe_keymap.as_ref() {
@@ -186,7 +198,7 @@ impl KeyboardBackend {
.dbus
.fcitx_keymap()
.context("Could not keymap via fcitx5, falling back to wayland")
.inspect_err(|e| log::warn!("{e:?}"))
.inspect_err(|e| log::info!("{e:?}"))
else {
return get_system_keymap(self.wayland);
};