Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
houmain committed Aug 24, 2024
1 parent bf70143 commit 589d3ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The keys are named after their scan codes and are not affected by the present ke
The names have been chosen to match on what the [web browsers](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) have agreed upon, so this [handy website](http://keycode.info/) can be used to get a key's name.
For convenience the letter and digits keys are also named `A` to `Z` and `0` to `9`. The logical keys `Shift`, `Control` and `Meta` are also defined (each matches the left and right modifier keys). There are also [virtual keys](#virtual-keys) for state switching, an [Any key](#any-key) and a [No key](#no-key).

The mouse buttons are named `ButtonLeft`, `ButtonRight`, `ButtonMiddle`, `ButtonBack` and `ButtonForward`, the wheel is named `WheelUp` and `WheelDown`.
The mouse buttons are named `ButtonLeft`, `ButtonRight`, `ButtonMiddle`, `ButtonBack` and `ButtonForward`, the wheel is named `WheelUp`, `WheelDown`, `WheelLeft` and `WheelRight`.

It is also possible to directly provide the scan code instead of the key name in decimal or hex notation (e.g. `159`, `0x9F`).

Expand Down Expand Up @@ -273,7 +273,11 @@ Output expressions can contain string literals with characters to type. The type

```bash
AltRight{A} >> '@'
Meta{A} K >> "Kind regards,\nDouglas Quaid"

# long lines can be split using '\'
Meta{A} K >> \
"Kind regards,\n" \
"Douglas Quaid"
```

They can also be used in input expressions to match when the character are typed. e.g.:
Expand All @@ -296,6 +300,12 @@ proceed = Tab Tab Enter
greet = "Hello"
```

In strings, regular expressions and terminal commands aliases can be inserted using `${Var}` or `$Var`. e.g.:

```bash
F1 >> "${greet} World"
```

An alias can also be parameterized to create a macro. The arguments are provided in square brackets and referenced by `$0`, `$1`... e.g.:
```bash
print = $(echo $0 $1 >> ~/keymapper.txt)
Expand Down
10 changes: 2 additions & 8 deletions src/server/unix/VirtualDeviceLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,8 @@ class VirtualDeviceImpl {
const auto vertical = (event.key == Key::WheelUp || event.key == Key::WheelDown);
const auto negative = (event.key == Key::WheelDown || event.key == Key::WheelLeft);
const auto value = (event.value ? event.value : 120) * (negative ? -1 : 1);
if (vertical) {
send_event(EV_REL, REL_WHEEL, value / 120);
send_event(EV_REL, REL_WHEEL_HI_RES, value);
}
else {
send_event(EV_REL, REL_HWHEEL, value / 120);
send_event(EV_REL, REL_HWHEEL_HI_RES, value);
}
send_event(EV_REL, (vertical ? REL_WHEEL : REL_HWHEEL), value / 120);
send_event(EV_REL, (vertical ? REL_WHEEL_HI_RES : REL_HWHEEL_HI_RES), value);
}
else {
if (!send_event(EV_KEY, *event.key, get_key_event_value(event)))
Expand Down

0 comments on commit 589d3ed

Please sign in to comment.