Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-02

Keyboard info

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

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?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd
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

Reply by email

Graeme Geldenhuys
to Mark Morgan Lloyd: How can a program get a general idea of the current keyboard layout, i.e. (primarily)…
Mark Morgan Lloyd wrote
How 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 -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner: On Thu, 05 Feb 2015 09:53:49 +0000 Under Linux/X? Mattias
Mattias Gaertner wrote 8 lines
On Thu, 05 Feb 2015 09:53:49 +0000 Mark Morgan Lloyd wrote: > 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?

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.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Graeme Geldenhuys: Just curious... why would that matter? If I press the key 'o' on a QWERTY or Dvorak…
Graeme Geldenhuys wrote 7 lines
On 2015-02-05 09:53, Mark Morgan Lloyd wrote: > How 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.

Because a user might prefer his composite functions such as ? to remain in "the right place" on the keyboard rather than following a letter.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd: Principally yes, but if it gave hints under other OSes it would be icing on the cake.…
Show quoted text 12 lines
Mattias Gaertner wrote: > On Thu, 05 Feb 2015 09:53:49 +0000 > Mark Morgan Lloyd wrote: > >> 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? Principally yes, but if it gave hints under other OSes it would be icing on the cake.

For X:
setxkbmap -print
or via program
https://github.com/nonpop/xkblayout-state

Mattias

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
>>> 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? > Principally yes, but if it gave hints under other OSes it would be icing > on the cake. For X: setxkbmap -print or via program https://github.com/nonpop/xkblayout-state

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 markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marc Weustink
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 22 lines
Mattias Gaertner wrote: >>>> 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? >> Principally yes, but if it gave hints under other OSes it would be icing >> on the cake. > > For X: > setxkbmap -print > or via program > https://github.com/nonpop/xkblayout-state 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?

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

Reply by email

Mark Morgan Lloyd
to Marc Weustink
Marc Weustink wrote 12 lines
>> setxkbmap -print >> or via program >> https://github.com/nonpop/xkblayout-state > 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? 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

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.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email