This patch adds functionality to send custom string to another process STDIN on layout change.
For example, for Awesome3 WM (www.awesomewm.com), add this to xxkb config:
====8<============
XXkb.run.process: /usr/local/bin/awesome-client
XXkb.run.text.1: set_kb_layout_name('en')
XXkb.run.text.2: set_kb_layout_name('ru')
====8<============
and on layout change "awesome" function "set_kb_layout_name" will be running with params "en" or "ru".
patch to add layout state output to another process