For_window will only be run when the window is opened, not everytime it is focused.
What you need to do is hook into the focus event on the IPC, match the window there and execute the command. Regards Ingo Sent from TypeMail On Sep 1, 2015, 17:07, at 17:07, Nokan Emiro <uzleep...@gmail.com> wrote: >Hi i3wm gurus, > >I use i3 with kbdd in order to have different keyboard layouts in >different >windows: > >exec_always --no-startup-id kbdd >exec_always setxkbmap -layout de,us -option grp:shift_caps_toggle > > >I figured out that the following command changes the current layout >into >the US version: > >$ dbus-send --dest=ru.gentoo.KbddService /ru/gentoo/KbddService >ru.gentoo.kbdd.set_layout uint32:1 > >...and replacing the uint32:1 with uint32:0 switches to the DE layout. > > >Now, what I couldn't figure out is that how can I set up a default >layout >for certain types >of windows. New windows start with the DE version (I guess because >that >one comes >first in the list with the 'setxkbmap -layout de,us' command). So far, >so >go. But on >terminals I want to use the US layout. I tried something like this in >the >i3wm config: > >for_window [window_role="terminal"] exec dbus-send >--dest=ru.gentoo.KbddService /ru/gentoo/KbddService >ru.gentoo.kbdd.set_layout uint32:1 > >Unfortunately this doesn't work. Can you please tell me how can I do >this >kind of >setup from the i3 config? (Maybe I could run the dbus-send command >from the >bash_profile or something like that, but I hope this can be done with >for_window >in the i3 config somehow.) > >Thanks, >Uz.