简体   繁体   中英

How to get event of changing current keyboard layout in Unix?

I searched simple solution, but could not find.

I need getting event of changing system keyboard layout for setting this in my application.

QApplication::keyboardInputLocale() is not suitable, because I need to catch system layout, not the application.

Xkblib also is not suitable, because I use Qt project and this library can lead to crashes ( QEvent , QTimer ).

X sends a MapNotifyEvent (not to be confused with KeymapNotify) when the key mapping is changed (tested with xmodmap, but should work for other methods as well). I don't know if you can get at raw X events under Qt, but if you can, I think that's the event to look for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM