qnikst / kbdd

keyboard library for per-window keyboard layout
GNU General Public License v2.0
146 stars 16 forks source link

kbdd doesn't want to change languages in Awesome WM #25

Closed boris-petrov closed 10 years ago

boris-petrov commented 11 years ago

I want to make all Pidgin windows start in a particular layout. So I do this:

client.connect_signal("manage", function(c, startup)
    if c.class == "Pidgin" then
        on_focus_change_language = function(cl)
            cl:disconnect_signal("focus", on_focus_change_language)
            os.execute("dbus-send --type=method_call --dest=ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.set_layout uint32:1")
        end
        c:connect_signal("focus", on_focus_change_language)
    end
end)

The idea is that the first time a Pidgin window is focused, the language will change. However, this doesn't work. The call to dbus-send is made, but the language doesn't change. If I do the call somewhere else (like in the manage signal) it works but a different window has it's language changed, because the Pidgin window is not focused.

The problem is obviously with calling dbus-send in the focus signal, but I can't see why. I tried putting sleep but it doesn't work. In dbus-monitor I see that a method call is invoked (and this is the only call to the kbdd service):

method call sender=:1.266 -> dest=ru.gentoo.KbddService serial=2 path=/ru/gentoo/KbddService; interface=ru.gentoo.kbdd; member=set_layout
   uint32 1

But no matter.

I use the latest kbdd from master. Any ideas?

boris-petrov commented 10 years ago

This actually happens because the focus signal is sent BEFORE the actual window is focused so this is not a kbdd issue. Closing.