Skip to content

Commit 0fb2d24

Browse files
committed
Updated README and CHANGELOG
1 parent 1342ab9 commit 0fb2d24

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

CHANGELOG.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,44 @@
33
All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

6-
## [Version 4.6.1] - 2024-08-14
6+
## [Version 4.7.0] - 2024-08-17
77

88
### Added
9-
- Implemented `grab-device` directive support on Windows.
9+
10+
- Allow to define top-level macros:
11+
```bash
12+
macro = $0 >> $1
13+
macro[A, B]
14+
```
15+
16+
- Added builtin macros `repeat[EXPR, N]`, `length[STR]`, `add/sub/mul/div/mod/min/max[A, B]`.
17+
1018
- Apply further argument list to result of macro. e.g.:
1119

12-
```python
20+
```bash
1321
case1 = $0
1422
case2 = $0 $0
1523
switch = case$0
1624
A >> switch[2][B] # switch generates case2, which is called with second argument list
1725
```
1826

27+
- Implemented `@grab-device` directive support on Windows.
28+
1929
### Fixed
20-
- `allow-unmapped-commands` also ignore mappings of undefined commands. e.g.:
30+
- `@allow-unmapped-commands` also ignore mappings of undefined commands. e.g.:
2131

2232
```python
2333
@allow-unmapped-commands
2434
command >> A
2535
```
2636

37+
- Added KDE6 support to keymapper KWin script.
38+
2739
## [Version 4.6.0] - 2024-08-07
2840

2941
### Added
3042
- Allow string literals in input expressions. e.g. `'Abc' >> B`.
31-
- Added `allow-unmapped-commands` and `enforce-lowercase-commands` directives.
43+
- Added `@allow-unmapped-commands` and `@enforce-lowercase-commands` directives.
3244

3345
### Changed
3446
- Keep key held when pressed immediately after `!Any`.
@@ -635,7 +647,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
635647

636648
## [Version 1.1.5] - 2020-05-09
637649

638-
[version 4.6.1]: https://github.com/houmain/keymapper/compare/4.6.0...4.6.1
650+
[version 4.7.0]: https://github.com/houmain/keymapper/compare/4.6.0...4.7.0
639651
[version 4.6.0]: https://github.com/houmain/keymapper/compare/4.5.2...4.6.0
640652
[version 4.5.2]: https://github.com/houmain/keymapper/compare/4.5.1...4.5.2
641653
[version 4.5.1]: https://github.com/houmain/keymapper/compare/4.5.0...4.5.1

README.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,32 @@ They can also be used in input expressions to match when the character are typed
284284

285285
:warning: The keyboard layout is evaluated when the configuration is loaded, switching is not yet supported.
286286

287-
### Key aliases
287+
### Key aliases / Macros
288288

289289
For convenience aliases for keys and even sequences can be defined. e.g.:
290290

291291
```bash
292292
Win = Meta
293293
Boss = Virtual1
294-
Alt = AltLeft | AltRight
294+
Alt = AltLeft | AltRight # defines a logical key
295295
proceed = Tab Tab Enter
296296
greet = "Hello"
297297
```
298298

299-
Aliases can also be parameterized. The arguments are provided in square brackets and referenced by `$0`, `$1`... e.g.:
300-
```
299+
An alias can also be parameterized to create a macro. The arguments are provided in square brackets and referenced by `$0`, `$1`... e.g.:
300+
```bash
301301
print = $(echo $0 $1 >> ~/keymapper.txt)
302302
F1 >> print["pressed the key", F1]
303303
```
304304

305+
There are a few builtin macros `repeat[EXPR, N]`, `length[STR]`, `add/sub/mul/div/mod/min/max[A, B]` which allow to define some more advanced macros. e.g:
306+
307+
```bash
308+
# when last character of string is typed, undo using backspace and output new string
309+
substitute = ? "$0" >> repeat[Backspace, sub[length["$0"], 1]] "$1"
310+
substitute["Cat", "Dog"]
311+
```
312+
305313
### Application launching
306314
307315
`$()` can be used in output expressions to embed commands, which should be executed when it is triggered. e.g.:

0 commit comments

Comments
 (0)