Hi, was just wondering if layout-per-window feature possible or planned in swaywm.
Thanks for this great project.
This is possible in theory, but no one has started working on it.
I would love to have that feature.
So start working on it.
Could somebody briefly outline what to look at?
Am I correct that "windows" in the code are wrapped into wlr_box?
Where or how "keyboard focused window" is implemented? (as I recently learned, currently focused window is not necessarily the one receiving keyboard input — does that need to be changed btw?)
Some status update:
So far I figured:
sway_view, so I need to keep layout state therestruct xkb_state; with bunch of other stuff such as enabled LEDs and pressed keys.My current problems:
sway_view).sway_view to another).My work-in-progress branch. TODOs:
sway_view to another? I'm guessing it's probably the same place where I'm restoring layout (seat_send_focus()), then I need to figure out, how to get the previously focused sway_view.xkb_layout_index_t is probably specific to a xkb_state, hence I need to store it for every keyboard device.I kind of stuck with the following question: after I updated xkb_state with new layout, I need to forward the update down the stack to change state of LEDs (if needed) and probably something else (not sure yet what is exactly, but without that the next keypress uses old keyboard layout).
So I did some research with debugger, and came to conclusion that physical keyboard state update is done by wlroots. However I didn't see a function that simply makes update, given a changed xkb_state. Do I need to extract that functional, or am I missing something?
Solved by using wlr_keyboard_notify_modifiers() to set keyboard layout.
I tried to implement this as a separate IPC script, which will also serve as layout indicator for Waybar, but I was unable to find any way to programmatically switch layout short of executing sway command (IPC analogue of swaymsg input <input name> xkb_layout en), which is definitely not what I want.
I was unable to find any way to programmatically switch layout short of executing sway command
Hmm. swaymsg -t get_inputs gives xkb_active_layout_name, but we provide no way to list available layouts or to set the active one. IMHO those would be good additions.
@emersion, also it would be good to have an IPC event when layout is switched.
also it would be good to have an IPC event when layout is switched.
Yes. Patches welcome.
Most helpful comment
So start working on it.