Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/evilC/TapHoldManager
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Apr 2, 2018
2 parents d1acc8c + 74a7f73 commit 7161740
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,25 @@ If I double-tapped and held on the second tap, then on press the function would

## Syntax
```
thm := new TapHoldManager([ <tapTime = 200>, <prefix = "$"> ])
thm := new TapHoldManager([ <tapTime = 200>, holdTime := -1, <prefix = "$"> ])
thm.Add("<keyname>", <callback (function object)>)
```

The `tapTime` (The amount of time allowed before a tap or hold is called) can be configured and has a default value of 200ms.
The `holdTime` (The amount of time that you need to hold a button for it to be considered a hold) defaults to the same as `tapTime`.
The `prefix` (The prefix used for all hotkeys, default is `$`) can also be configured.

The manager can take these optional parameters.
`thm := new TapHoldManager(100, "$*")`
You can pass as many parameters as you want.
`thm := new TapHoldManager()`
`thm := new TapHoldManager(100, 200, "$*")`

When adding keys, you can also specify parameters to override the manager's default settings
`thm.Add("2", Func("MyFunc2"), 500, "~$")`
When specifying parameters, you can use `-1` to leave that parameter at it's default.
For example, if you only wish to alter the `prefix` (3rd) parameter, you could pass `-1` for the first two parameters.
`thm := new TapHoldManager(-1, -1, "$*")`

When adding keys, you can also add the same parameters to the end to override the manager's default settings
`thm.Add("2", Func("MyFunc2"), 300, 1000, "~$")`

When specifying parameters, you can use `-1` to leave that parameter at it's default.

# Integration with the Interception driver (Multiple Keyboard support)
TapHoldManager can use the [Interception driver](http://www.oblita.com/interception) to add support for per-keyboard hotkeys - you can bind TapHoldManager to keys on a second keyboard, and use them completely independently of your main keyboard.
Expand Down Expand Up @@ -94,25 +99,27 @@ thm.Add("1", Func("MyFunc1"))
### AutoHotInterception Subscription Mode
A wrapper is included which extends the TapHoldManager class and replaces the hotkey bind code with Interception bind code.

**Instead of** including the TapHoldManager library, **instead** include the interception version:
**Instead of** including the TapHoldManager library, include the interception version:
```
; #include Lib\TapHoldManager.ahk
#include Lib\InterceptionTapHold.ahk
```

Instantiate `InterceptionTapHold` instead of `TapHoldManager`
`kb1 := new InterceptionTapHold(<VID>, <PID> [, <tapTime>, <block = true>])`
Instantiate `InterceptionTapHold` **instead of** `TapHoldManager`
`kb1 := new InterceptionTapHold(<VID>, <PID> [, <isMouse = 1>, <instance = 1>, <tapTime>, <block>])`

**Required Parameters**
`VID / PID` = The VendorID and ProductID of the device you wish to subscribe to.
To find the VID / PID of your device, you can use the Monitor demo app from the AHI project.

In this version, the VID and PID of the device need to be passed as the first two parameters.
To get VIDs / PIDs, you can call `devices := kb1.GetKeyboardList()`
Also, the `prefix` parameter is now the `block` parameter
**Optional Parameters**
`isMouse` = Set to true if the device is a Mouse, else leave on false.
`instance` = When using multiple identical devices, this identifies which instance to use.
If you only have one device, leave this at 1
`block` = whether or not to block the input. Defaults to true.

Note: Use one manager per keyboard.
```
kb1 := new InterceptionTapHold(0x413C, 0x2107)
kb2 := new InterceptionTapHold(0x1234, 0x2107)
```

## Optional Parameters
`tapTime` remains the same
`prefix` is replaced by `block` - `true` to block, `false` to not block

0 comments on commit 7161740

Please sign in to comment.