aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 6e7f203c..38827415 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -16,7 +16,7 @@ use smithay::backend::input::{
TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState, TouchEvent,
};
use smithay::backend::libinput::LibinputInputBackend;
-use smithay::input::keyboard::{keysyms, FilterResult, Keysym, ModifiersState};
+use smithay::input::keyboard::{keysyms, FilterResult, Keysym, ModifiersState, XkbContextHandler};
use smithay::input::pointer::{
AxisFrame, ButtonEvent, CursorIcon, CursorImageStatus, Focus, GestureHoldBeginEvent,
GestureHoldEndEvent, GesturePinchBeginEvent, GesturePinchEndEvent, GesturePinchUpdateEvent,
@@ -539,13 +539,18 @@ impl State {
}
}
Action::SwitchLayout(action) => {
- self.niri.seat.get_keyboard().unwrap().with_xkb_state(
- self,
- |mut state| match action {
+ let keyboard = &self.niri.seat.get_keyboard().unwrap();
+ let new_idx = keyboard.with_xkb_state(self, |mut state| {
+ match action {
LayoutSwitchTarget::Next => state.cycle_next_layout(),
LayoutSwitchTarget::Prev => state.cycle_prev_layout(),
- },
- );
+ };
+ state.active_layout().0
+ });
+
+ if let Some(server) = &self.niri.ipc_server {
+ server.keyboard_layout_switched(new_idx as u8);
+ }
}
Action::MoveColumnLeft => {
self.niri.layout.move_left();