Win95Key v3

1. About

This program is intended to assign actions on key pressing in OS/2 PM environment, It allows to use Windows specific keys and multimedia keyboards as well. For example, you can call WarpCenter menu by pressing Windows button or launch Mozilla by pressing Ctrl-Shift-M. The program is written in the way that allows to assign new actions easily and (for developers) to increase its functionality using plugin scheme. Starting from version 3, the kbdfix utility is included in the package. It allows to use keys that do not return correct scancode in OS/2 PM and cannot be used in OS/2 in standart manner (e.g. Power and Sleep buttons and some Multimedia buttons).

2. Installation

To install the program extract the archive into any directory and run REXX script install.cmd. It will create "Win95Key" folder on your desktop. Brief description of folder content:

"PM Conf Configuration program" - PM program for Win95Key configuration
"Win 95 Key" - the program :-)
"Tools" - utilities that can be useful (see below)
"src" - source code of the project

NB: installation of Win95Key over existing old version can cause problems and therefore is not recommended.

3. Configuration

Run PM Conf program to configure Win95Key. You can do this from Win95Key folder or by pressing Ctrl-Shift-S (Win95Key must be launched).

3.1 PM Conf possibilities

PM Conf allows to:

3.2 Adding actions

After program launch you will see the "Hotkeys" tab. In this tab you may view the list of assigned key combinations and the actions assigned to these combinations.

To add new combination you have to:

  1. Enter the key scancode or its name (e.g. "F") in the "Code" input field.
  2. Select modifiers (e.g. Ctrl and Shift) for this key in the "Modifiers" field. Modifiers can be added or changed in the "Settings" tab. Do not mark any modifiers if you want to use scancode without modifiers.
  3. Select plugin that you want to assign to this key combination in the "Plugin" window and press the "Settings" button. Plugins can be added or removed in the "Settings" tab.

To edit a key combination select it in the "Hotkey" list, modify settings and press "Change button"

To remove a key combination select it in the "Hotkey" list and press the "Remove" button.

To apply the changes you have made press the "Apply" button.

3.3 Adding/removing plugins

If you want to add a plugin press the button "Add new" in the plugin section of the "Settings" bookmark. Then in the dialog window press the "Locate" button and choose the DLL with plugins.

In the "Add plugin" window there appears the plugin list stored in the chosen library. and press the "Add" button. After this the selected plugins will appear in the "Function" window.

To delete a plugin select it in the "Function" window and press the "Remove" button.

3.4 Adding modifiers

The "Modifiers" section describes the keys that are used in addition to standart "Ctrl", "Alt" and "Shift" modifiers. To add a modifier press the "Add new" button in the "Modifiers" section. Enter the scancode of the modifier and its name. New modifier will be available in the "Hotkeys" tab for adding new key combination.
To remove or edit modifier select it in the "Modifiers" window and press the "Remove" or "Edit" button.

3.4 Changing Win95Key parameters

The "Global" section in the "Setting" tab contains 3 options that affect Win95Key's operation.
The "Immediately key reaction" option is responsible for program reaction on key pressing. If it is enabled, reaction takes place immediately after the corresponding keys were pressed. If it is disabled, reaction takes place after the corresponding keys were released.
If the "run minimized" option is enabled, Win95Key will be run minimized next launch.
If the "hide in tasklist" option is enabled, Win95Key will not be shown in the OS/2 Window List.

You must press the "Apply" button after setup of these parameters.

4. KBDfix utility

OS/2 does not recognize some keys on modern keyboards correctly. Win95Key cannot use these keys (e.g. "Power" and "Sleep"). KBDfix utility was written to provide a workaround for this system bug.

4.1. Determing the scancode of "dead keys"

If your keyboard has some keys that are not recognized by PM Conf program and you want to use these keys in OS/2, you have to find out their scancodes that are returned by keyboard driver. To do this, launch "Keyboard DosMon* tester" from the Win95Key —> Tools folder. After launch of the program press the keys that do not work in OS/2 and write down their scancodes (scan=xxx). Then open file kbdfix.cfg and add lines like Key=xxx to this file (xxx is the scancode for corresponding key). The number of these lines is not limited. By default kbdfix.cfg contains records for "Power" and "Sleep" keys already.

4.2. Starting up daemon

To launch KBDfix at system startup edit your config.sys file. Add a line like the following:
RUN=D:\apps\Win95Key\bin\kbdfixd.exe
(sure the correct path should be specified :) and reboot OS/2.

4.3. Usage

The keys listed in kbdfix.cfg file must be recognized correctly after system reboot. Edit kbdfix.cfg and run the "Reload KBDfixD configuration" utility from Win95Key –> Tools folder to change KBDfix configuration without system reboot.

NB! If this utility appears to be really useful to you, send your kbdfix.cfg file to samm@os2.ru, I will add your scancodes to standart package subsequently.

5. Win95Key plugins

At present Win95Key package contains several plugin libraries. Plugin library is a DLL with functions that can be assigned as action on key pressing. This section contains brief description of plugins and examples of plugin usage.

5.1 w95k_std.dll library

  1. SwitchTo - switches to the task specified.
    With this plugin one may call the required window. If more than one window match the pattern, they will be switched cyclically.
    Search pattern can be specified in two ways:
    1. simple way: "string1|string2|string3|string..."
      This will search for windows with title that contains string1 or string2 or string... .
      If stringI looks like *text then "text" substring is searched in window title.
      If stringI looks like text (no leading asterisk) then the beginning of window title is compared with "text" (i.e. window title must begin with "text" to match).
      Limitation: first symbol of window title can not be '/' (this is explained at point 2)
    2. using regular expressions: "/string" (search pattern starts with '/')
      All window titles that match the search pattern are searched in this case. PCRE library is used for regexp implementation.
  2. WindowList - calls OS/2 Task List.
  3. DesktopMenu - calls context menu of Desktop. The name of your desktop is an optional parameter.
  4. WarpcenterMenu - plugin for operations with WarpCenter.
    This plugin allows to operate WarpCenter using keyboard.
  5. OpenObject - opens WPS object or launches a program.
    The name of the program (e.g. d:\os2\e.exe) or WPS object (e.g. <WP_SYSTEM>) must be specified. Also run parameters must be set. Acceptable values are: DEFAULT, HELP, PALETTE, PROMPTDLG, RUNNING, SETTINGS, TREE, CONTENTS, DETAILS
  6. Volume - manages main volume control.
    You need to specify method (0 - MMOS2 MCI, 1 - LIBMIX PIPE API, 2 - WPS "Volume" object) and action UP , DOWN or MUTE.
  7. MinimizeAll - minimizes all windows.
    Exceptions may be specified with comma delimiter.

5.2. w95k_od.dll library

SwitchToVirtualDesktop - changes active desktop in the Object Desltop program.

5.3. w95k_p.dll library

SendToPipe - sends text to the pipe specified by user.
With this function one may easily control programs with pipe interface. For instance, Z! mp3 player allows to control nearly all its functions. So "*pause" command should be send to \pipe\zmp3 pipe to pause playback.
I plan to add plugin for LBMIX program control to this library in the future.

5.4. w95k_apm.dll library

ProcessAPM - manages APM (advanced power management) subsystem in OS/2.
This plugin allows to power off your box (POWER_OFF) or suspend it (STANDBY or SUSPEND).
Plugin requires OS/2 APM drivers to be installed (they are shipped with the system). Also your hardware must support APM.

5.5. w95k_sem.dll library

SemPoster - posts an OS/2 event semaphore.
This plugin sends an OS/2 event semaphore with name specified by user. For instance, it may be used to call "WarpButton" of the SysTray program (semaphore name is \SEM32\SYSTRAY\WARPBTN).

6. Additional utilities

The "Win95Key –> Tools" folder contains some utilities that can be useful.

"Key Info" - shows scancodes of pressed keys using OS/2 PM.
"Keyboard DosMon* tester" - shows scancodes of pressed keys using DosMonRead function.
"Remove win95key <2.xx dll" - removes dlls from old (0.xx) versions of Win95Key.

7. Authors

Win95Key: Viktor Remennik.
PM Conf, KBDfix, APM plugin, PIPE Plugin and some Win95Key additions: Alex Samorukov
SEM plugin, PCRE switchto plugin and some Win95Key changes: nickk

8. Special thanks to

Samuel Audet (guardia@cam.org) for original idea
Dmitry Ban for event processing idea and translation of this text
Sergey Yevtushenko for help with WarpCenter's sizes
Stangl Roman (rstangl@vnet.ibm.com) - for APM/OS2 toolkit.
Vadim Yegorov (vy@org.vrn.ru) - for PCRE port.

9. Changes

changelist.txt contains the list of changes.