Try default when configured xkb keymap fails to compile
Browse files at this commitee0e2c7f1b4edae42d2f1b05466adbdffe156e61Parent: 4f16be91 changed file +14 -3
- src/niri.rs +14 -3
src/niri.rsmodified+14 -3
| @@ -1965,12 +1965,23 @@ impl Niri { | ||
| 1965 | 1965 | let single_pixel_buffer_state = SinglePixelBufferState::new::<State>(&display_handle); |
| 1966 | 1966 | |
| 1967 | 1967 | let mut seat: Seat<State> = seat_state.new_wl_seat(&display_handle, backend.seat_name()); |
| 1968 | - seat.add_keyboard( | |
| 1968 | + if let Err(err) = seat.add_keyboard( | |
| 1969 | 1969 | config_.input.keyboard.xkb.to_xkb_config(), |
| 1970 | 1970 | config_.input.keyboard.repeat_delay.into(), |
| 1971 | 1971 | config_.input.keyboard.repeat_rate.into(), |
| 1972 | - ) | |
| 1973 | - .unwrap(); | |
| 1972 | + ) { | |
| 1973 | + if let smithay::input::keyboard::Error::BadKeymap = err { | |
| 1974 | + warn!("error loading the configured xkb keymap, trying default"); | |
| 1975 | + } else { | |
| 1976 | + warn!("error adding keyboard: {err:?}"); | |
| 1977 | + } | |
| 1978 | + seat.add_keyboard( | |
| 1979 | + Default::default(), | |
| 1980 | + config_.input.keyboard.repeat_delay.into(), | |
| 1981 | + config_.input.keyboard.repeat_rate.into(), | |
| 1982 | + ) | |
| 1983 | + .unwrap(); | |
| 1984 | + } | |
| 1974 | 1985 | seat.add_pointer(); |
| 1975 | 1986 | |
| 1976 | 1987 | let cursor_shape_manager_state = CursorShapeManagerState::new::<State>(&display_handle); |