How can a program get a general idea of the current keyboard layout, i.e. (primarily) whether the operating system thinks it's in America or the UK, and (secondarily) whether it's QWERTY or e.g. Dvorak?
Mailing lists / lazarus / 2015-02
Keyboard info
9 messages · 4 people · –
- MMark Morgan Lloyd 5
- MMattias Gaertner 2
- GGraeme Geldenhuys 1
- MMarc Weustink 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
How can a program get a general idea of the current keyboard layout, i.e. (primarily) whether the operating system thinks it's in America or the UK, and (secondarily) whether it's QWERTY or e.g. Dvorak?
Under Linux/X?
Mattias
How can a program get a general idea of the current keyboard layout, i.e. (primarily)…
Mark Morgan Lloyd wroteHow can a program get a general idea of the current keyboard layout,
Just curious... why would that matter? If I press the key 'o' on a QWERTY or Dvorak layout, the OS (and application) treats it the same.... an 'o' key character is generated.
If it is because you want to adjust keyboard shortcuts depending on detected layout... I use Dvorak by the way, I find it best to simply have the ability to customise keyboard shortcuts in the application. Yes I modify some shortcuts to suite my needs, but most I leave as was designed for the default QWERTY. But that is maybe just my personal preference.
Regards,
- Graeme -
On Thu, 05 Feb 2015 09:53:49 +0000 Under Linux/X? Mattias
Mattias Gaertner wrote 8 lines
Principally yes, but if it gave hints under other OSes it would be icing on the cake.
This is not something that I want to rely on to any great extent, but is just an initial starting point for the user to set things up in more detail.
Just curious... why would that matter? If I press the key 'o' on a QWERTY or Dvorak…
Graeme Geldenhuys wrote 7 lines
Because a user might prefer his composite functions such as ? to remain in "the right place" on the keyboard rather than following a letter.
Principally yes, but if it gave hints under other OSes it would be icing on the cake.…
Show quoted text 12 lines
For X:
setxkbmap -print
or via program
https://github.com/nonpop/xkblayout-state
Mattias
Mattias Gaertner wrote 11 lines
Thanks, noted the program stuff which looks useful. I admit that I was rather expecting to be pointed brusquely at some existing LCL or FCL stuff... can I get e.g. current country from locale stuff, and where do I find it?
Mark Morgan Lloyd wrote 22 lines
There isn't. The attached keyboard is in no way related to a locale. Even if you know the country, there may exist multiple layouts.
it took me a lot of work to only extract the necessary info to generate the correct VK_ codes
Marc
Marc Weustink wrote 12 lines
Thanks Marc, noted. I've got something with custom mappings that I want to work properly with IBM and Sun keyboards for both UK and US layouts, but that's as far as I'm going.
