Closed timsofteng closed 2 years ago
Hi Tim,
I can't reproduce this issue in my environment. Which version of Sway do you use?
One more detail: your mouse (and any other input device) has layout too. Please, try to use *
instead of type:keyboard
.
Hi Tim, I can't reproduce this issue in my environment. Which version of Sway do you use? One more detail: your mouse (and any other input device) has layout too. Please, try to use
*
instead oftype:keyboard
.
Still doesn't work even with this *
tip.
I'm using sway 1.6.1.
Steps to reproduce.
for_window [app_id="swappy"] input * xkb_switch_layout 0
to some floating window (swappy in my case) in sway.swappy
. (notice that layout was changed correctly).esc
. Focus will back to previous window BUT layout still 0
.Here is small screencast. https://user-images.githubusercontent.com/51912173/149501986-31735324-7a1b-4b80-be7b-b463dcde42cd.mp4
@artemsen can you reproduce it?
Yes, I reproduced the problem, thank you!
This happens because Sway changes the keyboard layout before the new window gets focus.
By the time the window from step 2
loses focus (and the layout save routine is triggered), rule 1
has already been applied.
So, from the swaykbdd
perspective, it looks like an user set layout 0
and then switched to the swappy
.
And I still have no idea how to fix it :(
UPD. We can consider the timeout between layout change and focus lost events.
@timsofteng, I will be grateful if you check this fix. There is a timeout (50ms) which is an ignored amount of time between layout change and focus loss. It works for me.
@artemsen can you please describe how to do it?
Just update the package using AUR: https://aur.archlinux.org/packages/swaykbdd Or build and install from source:
meson build
ninja -C build
sudo ninja -C build install
Looks like it works. Thanks!
Hello. I have this options for some apps: for_window [app_id="swappy"] input type:keyboard xkb_switch_layout 0 for_window [app_id="fuzzel"] input type:keyboard xkb_switch_layout 0 for_window [app_id="mpv"] input type:keyboard xkb_switch_layout 0
When I go back to previous window from one of them
swaykbdd
doesn't switch to its previous layout.