How to make per-window keyboard layouts with plain XMonad?
Install kbdd daemon which does the job.
Run this at startup:
kbdd
setxkbmap "us,ua" -option grp:scroll_toggle
That's all!
To display your layout in a widget you can find this Ruby code useful:
interface = 'ru.gentoo.KbddService'
member = 'layoutChanged'
mon = open "| dbus-monitor --monitor \"sender='#{interface}',member='#{member}'\""
loop do
str = mon.gets
if str =~ /layoutChanged/
lang = mon.gets[/.\Z/] # lang is now either 0 or 1 depending on the current layout
end
end
You may want to have a look at scim and/or ibus. Both daemons can be started in an .Xsession
. From my experience, ibus is the way to go, but might not have support for your input method.
An example configuration is documented for xfce.
Disclaimer: I would have added this as a comment, rather then an answer.