Author Topic: Soft keymap utility  (Read 367 times)

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 131
  • Greetings. I come in peace (for OS/2 things only).
    • View Profile
Soft keymap utility
« on: November 07, 2018, 06:19:53 pm »
Is there a utility I can run that will recognize which app is in the foreground and perform auto-key translations from what I type to what the app expects?  If not, does anyone know the general direction I'd need to head in to write such a utility?

I'd like to use Ctrl+C, Ctrl+X, Ctrl+V for Copy/Cut/Paste, and I have a dozen other keystrokes I'd like to use rather than the ones in the OS/2 apps.

TYIA.
--
Rick C. Hodgin

André Heldoorn

  • Sr. Member
  • ****
  • Thank You
  • -Given: 38
  • -Receive: 9
  • Posts: 371
    • View Profile
Re: Soft keymap utility
« Reply #1 on: November 10, 2018, 12:43:03 pm »
Is there a utility I can run that will recognize which app is in the foreground and perform auto-key translations from what I type to what the app expects?

Certainly not. The industry actually makes money by selling certificates and by changing designs, so "your average user has no clue what's new, and your expert requires a new cerificate and may experience difficulties with the new menu structure".

An Open Menu design would be better, in theory. If you believe that "Exit F4" has nothing to do with the "File" of its menu, then you can channge menus and define other keys.

You will have to hack (all) apps. If you are using WordPerfect for DOS to manage old documents and press Alt-F4, then what should happen?

And you will have to manage your own database, to define what you'd like to use and what apps should expect. Without any conflicts.

Quote
I'd like to use Ctrl+C, Ctrl+X, Ctrl+V for Copy/Cut/Paste, and I have a dozen other keystrokes I'd like to use rather than the ones in the OS/2 apps.

Those keystrokes may work too, with more than one OS, and I presume it will be easier to contact authors of apps to change assigned keystrokes. I wouldn't consider customized changes for one user, though. Unless it's a quality improvement, like supporting both Ctrl+V and Shift-Insert.

I guess different keystrokes may account for over 50% of the existing editors (vi, ...) and file managers (Norton Commander, ...). :-\

The last version of MS Office for Win-OS/2 does offer the user a few optional different keystrokes of that era, like IIRC the "/" of Lotus for DOS in Excel or w.r.t. Alt-F4 of WordPerfect for DOS.

"Dynamic Keyboard Remapping" won't be worth the extraordinary efforts, if it's possible at all. "Esc" doesn't always escape, and so on.

Andreas Schnellbacher

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 16
  • Posts: 333
    • View Profile
Re: Soft keymap utility
« Reply #2 on: November 10, 2018, 02:03:51 pm »
In some cases the PM accelerator key table of an executable can be changed by editing its resources. That handles keys defined as accelerator keys. For those that are defined via WM_CHAR messages, you probably need to recompile it.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 110
  • Posts: 1611
    • View Profile
Re: Soft keymap utility
« Reply #3 on: November 10, 2018, 09:04:09 pm »
There'll be programs such as the Mozilla apps that use both the common accelerators as well as the Apple ones.
Simpler just to learn the proper keys as they work most everywhere accepting possibly Apples. Even Linux mostly recognizes CTRL-INS, SHIFT-INS and SHIFT-DEL for copying and pasting.

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 131
  • Greetings. I come in peace (for OS/2 things only).
    • View Profile
Re: Soft keymap utility
« Reply #4 on: November 10, 2018, 10:40:14 pm »
Is there a utility I can run that will recognize which app is in the foreground and perform auto-key translations from what I type to what the app expects?

"Dynamic Keyboard Remapping" won't be worth the extraordinary efforts, if it's possible at all. "Esc" doesn't always escape, and so on.

It would be a patch to they keyboard driver.  Based on what app has foreground focus, let the incoming keyboard keystroke pass thru natively, or replace it with another keystroke.  It would require minor keystroke buffering for candidate keys, but little else apart from translation.

It wouldn't need to even be smart.  Just the ability to intercept and replace, all setup by the user, or loaded from a shared file setup by another.
« Last Edit: November 10, 2018, 10:49:26 pm by Rick C. Hodgin »
--
Rick C. Hodgin

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 131
  • Greetings. I come in peace (for OS/2 things only).
    • View Profile
Re: Soft keymap utility
« Reply #5 on: November 10, 2018, 10:52:13 pm »
There'll be programs such as the Mozilla apps that use both the common accelerators as well as the Apple ones.
Simpler just to learn the proper keys as they work most everywhere accepting possibly Apples. Even Linux mostly recognizes CTRL-INS, SHIFT-INS and SHIFT-DEL for copying and pasting.

I've gotten somewhat used to them in OS/2, but would prefer F10/F11 for step over/step into, F9 for toggle breakpoint, F5 for run, etc.  Also other keystrokes like Ctrl+S to save, Ctrl+W to save and close, etc.

It would be nice to have globally uniform keystrokes regardless of the application.
--
Rick C. Hodgin

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 9
  • -Receive: 110
  • Posts: 1611
    • View Profile
Re: Soft keymap utility
« Reply #6 on: November 11, 2018, 02:14:16 am »
Yes, all the debuggers here seem to vary a lot, with the OpenWatcom closest to your preferences.
I'm not an expert but assume you'd just have to replace KBDCALLS.DLL, perhaps renaming KBDCALLS and forwarding to it after translating your keystrokes.
Or perhaps capture the PM input queue, examples with source are hookkbs.zip and by the same author, mkhkb2.zip. These seem designed to add hotkeys, to open programs or such, but might be a good starting point.
« Last Edit: November 12, 2018, 02:33:24 am by Martin Iturbide »

André Heldoorn

  • Sr. Member
  • ****
  • Thank You
  • -Given: 38
  • -Receive: 9
  • Posts: 371
    • View Profile
Re: Soft keymap utility
« Reply #7 on: November 12, 2018, 12:15:59 am »
There's no such thing as a standard for keystrokes, if your Ctrl-S is anything to go by and OS components E (save) and EPM (srearch) should be representing that random standard. If there are any keys left, because a debugger claims a few. )(

Besides that, any author has the freedom of choice and can ignore any possible outdated pseudo-standards quite easily. Even Esc doesn't always work as expected.

KBDCALLS and forwarding to it after translating your keystrokes.

Ye olde VoiceType? Say F9... :P

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 308
  • -Receive: 60
  • Posts: 2022
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Soft keymap utility
« Reply #8 on: November 12, 2018, 02:35:01 am »
Hi

Dave: I corrected the URL tags on your post, I hope they alright.

Just in case here it is a list of ArcaOS shortcuts that I consolidated once, it may not be what had been asked for but it kind of related.... I think.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Rick C. Hodgin

  • Full Member
  • ***
  • Thank You
  • -Given: 6
  • -Receive: 0
  • Posts: 131
  • Greetings. I come in peace (for OS/2 things only).
    • View Profile
Re: Soft keymap utility
« Reply #9 on: November 12, 2018, 02:46:34 am »
There's no such thing as a standard for keystrokes, if your Ctrl-S is anything to go by and OS components E (save) and EPM (srearch) should be representing that random standard. If there are any keys left, because a debugger claims a few. )(

Besides that, any author has the freedom of choice and can ignore any possible outdated pseudo-standards quite easily. Even Esc doesn't always work as expected.

KBDCALLS and forwarding to it after translating your keystrokes.

Ye olde VoiceType? Say F9... :P

You misunderstand.

Consider a keyboard connected to a second keyboard.  The second keyboard has robot hands such that I type Ctrl+S, and it knows I'm in an application that to save you hit F7.  I type Ctrl+S to signal the robot "Save," and it then keys in F7 into the computer.  For other unrecognized keys, they pass thru.  I type J, the robot types J.  I type Ctrl+ F14, it types Ctrl + F14.  Only in those apps I've specified are there keystrokes I've setup being intercepted and retyped differently by the robot, to match the intended meaning of my common keystroke to the specific mechanical needs of each app.

I setup which apps.  I setup which keystrokes I type go into which translated keystroke in each app.

--
Rick C. Hodgin
« Last Edit: November 12, 2018, 02:54:52 am by Rick C. Hodgin »
--
Rick C. Hodgin