Detect keyboard layout

is there a way to detect the keyboard layout.
I need a little virtual midi keyboard, so I need to load different mappings for different keyboard layouts or get the key position instead of the value.
Any ideas how this can be done.

I was looking for such a solution some time ago.
on linux I solved it this way:

setxkbmap -query

then I moved to this:

Thanks, I will have a look.
On osx it should be listed in /Library/Preferences/

I will have a look into glfw, maybe I can get the information from there.

1 Like

I have not had the time to get the mapping automatically.
But here is the an (almost) working version: