Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
94852f5
Fix compilation (bad conflict resolution)
kareltucek Jan 29, 2026
1a60818
add macroArg command (ignored for now)
mhantsch Feb 1, 2026
8d743f5
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 2, 2026
a5226b6
Merge pull request #3 from mhantsch/macroArgs-declarations
mhantsch Feb 2, 2026
befb7dc
fix params
mhantsch Feb 3, 2026
79308c1
update command hash table
mhantsch Feb 3, 2026
b3dcf7d
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 3, 2026
67e5116
Merge pull request #4 from mhantsch/macroArgs-declarations
mhantsch Feb 3, 2026
7c89196
attempt at macroArg parser
mhantsch Feb 3, 2026
aeab45c
fix? debug?
mhantsch Feb 3, 2026
1a8800d
should have read compiler warnings that already told me where I was w…
mhantsch Feb 3, 2026
f003bf6
Merge pull request #5 from mhantsch/macroArgs-declarations
mhantsch Feb 3, 2026
4a944e1
improved error messages
mhantsch Feb 3, 2026
20d37d3
message beautification
mhantsch Feb 3, 2026
adcb032
Merge pull request #6 from mhantsch/macroArgs-declarations
mhantsch Feb 3, 2026
12cb31a
Merge pull request #7 from UltimateHackingKeyboard/master
mhantsch Feb 3, 2026
499395f
Merge branch 'UltimateHackingKeyboard:master' into macroArgs-declarat…
mhantsch Feb 3, 2026
563f0d1
Merge pull request #8 from mhantsch/macroArgs-declarations
mhantsch Feb 3, 2026
e2735e5
Fix gperf token vs argument expansion bug.
kareltucek Feb 3, 2026
457132f
Merge pull request #1475 from UltimateHackingKeyboard/fix/gperf-arg-e…
kareltucek Feb 3, 2026
ac3b92e
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 3, 2026
b008126
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 4, 2026
fd9cdfb
Merge branch 'UltimateHackingKeyboard:master' into macroArgs-declarat…
mhantsch Feb 4, 2026
00e1b39
Merge pull request #9 from mhantsch/macroArgs-declarations
mhantsch Feb 4, 2026
402af51
too memory intensive implementation of macro arguments storage, needs…
Feb 4, 2026
227f200
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 5, 2026
877f3b4
allow macroArg command only at start of macro
Feb 5, 2026
aa954e7
Merge pull request #11 from UltimateHackingKeyboard/master
mhantsch Feb 5, 2026
f5f3302
fix typo
Feb 5, 2026
e09686d
Merge branch 'macroArgs-declarations' of https://github.com/mhantsch/…
Feb 5, 2026
b81f9b3
actually return the return value
Feb 5, 2026
9239daa
figure why some parsing broke
mhantsch Feb 6, 2026
8da0330
fix the reachable unreachable case
mhantsch Feb 6, 2026
ab5c432
introducing MacroResult_None to fix 'if' commands that need to contin…
mhantsch Feb 6, 2026
d604381
macroArgs only allowed at beginning of macro, refactor of processCommand
mhantsch Feb 6, 2026
b2a3cd8
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 6, 2026
458afe1
removing unused code
Feb 6, 2026
b508166
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 6, 2026
2b98925
cleaner handling of returns from dispatching, especially for header c…
Feb 6, 2026
e51d414
syntax fix
Feb 6, 2026
5c9f7c2
Macro args declarations: better dispatching return logic
mhantsch Feb 6, 2026
d540053
moving arg storage, but I'm not happy yet
Feb 6, 2026
aa66476
refactor & fix ConsumeUntilDot
mhantsch Feb 7, 2026
f1d866b
fix typo
mhantsch Feb 7, 2026
04d5aad
fix typo
mhantsch Feb 7, 2026
a5f6ff6
Macro args declarations, refactor
mhantsch Feb 7, 2026
36ff834
simplify processMacroArgCommand; refrain from accessing *ctx->at dire…
mhantsch Feb 8, 2026
3c96cec
refactor white processing for macroArg, safer check for comment
mhantsch Feb 8, 2026
902f897
simplify processMacroArgCommand; refrain from accessing *ctx->at dire…
mhantsch Feb 8, 2026
78e3aff
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 9, 2026
1674590
trial commit for arg storage
mhantsch Feb 10, 2026
2921357
trial 2
mhantsch Feb 10, 2026
d086ac7
fixes 3
mhantsch Feb 10, 2026
b6dc03b
trial 4
mhantsch Feb 10, 2026
9b7e657
bool should actually be bool and not float
Feb 12, 2026
d12652a
first attempt at arg storage
mhantsch Feb 12, 2026
03beaf1
some comments after discussion with karel
mhantsch Feb 13, 2026
be4c443
rework of macro arguments code
Feb 23, 2026
db8937a
next attempt
mhantsch Feb 23, 2026
24276be
corrections
mhantsch Feb 23, 2026
cdaefec
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Feb 23, 2026
27220af
syntax fix
mhantsch Feb 23, 2026
fbb96d6
missing parenthesis
mhantsch Feb 23, 2026
9d8540f
Merge pull request #16 from mhantsch/macroArgs-declarations
mhantsch Feb 23, 2026
b4fa0f0
prevent $macroArg/.1 bug
mhantsch Feb 24, 2026
21f6144
add error message for missing '.' after $macroArg
mhantsch Feb 24, 2026
69f90bf
Merge pull request #17 from mhantsch/macroArgs-declarations
mhantsch Feb 24, 2026
139f987
better parsing & errors
mhantsch Feb 24, 2026
23f8094
some comments to guide next TODOs
mhantsch Feb 24, 2026
345fcce
Merge pull request #18 from mhantsch/macroArgs-declarations
mhantsch Feb 24, 2026
723104f
Merge branch 'UltimateHackingKeyboard:master' into macroArgs-declarat…
mhantsch Feb 24, 2026
f8340d9
better DryRun for macroArg command
Feb 24, 2026
206141b
first attempt at named arguments parsing
Feb 24, 2026
22a45f2
Merge branch 'master' into macroArgs-declarations
mhantsch Feb 24, 2026
8e250ec
fix compilation
Feb 24, 2026
566f6f2
Merge pull request #19 from mhantsch/macroArgs-declarations
mhantsch Feb 25, 2026
d085aef
spelling error in comment
Feb 25, 2026
bc1ecb6
fix some TODOs; compatibility-parsing of undeclared $macroArg.1
Feb 25, 2026
11d2d79
numerical value parsing per declared type
Feb 25, 2026
894ab23
syntax fix
Feb 25, 2026
73186d6
consume descriptive comment as string literal
Feb 25, 2026
2efc6db
parse macroArg description as string token
Feb 25, 2026
ff5f44d
some notes on where $macroArg.xxx should be parsed for keyid and scan…
Feb 25, 2026
b3f4e20
more TODO comments
Feb 25, 2026
cb8c578
cleanup
mhantsch Feb 26, 2026
4714f9f
TODO comment
mhantsch Feb 26, 2026
9e592f8
attempt to expand $macroArg:any as &macroArg.
Feb 26, 2026
fe5e7e8
arguments of type 'string' are now raw strings without quotes and wit…
Feb 26, 2026
b132cd1
typo
Feb 26, 2026
2fab9ec
beginning of new StrRead* parser
Feb 26, 2026
3cd8bf3
refactor StrRead_xxx first attempt
mhantsch Feb 28, 2026
b503404
check compilation
mhantsch Mar 1, 2026
a426843
fixes
mhantsch Mar 1, 2026
907cba6
StrRead* parser test in setLedTxt
mhantsch Mar 1, 2026
0083e2c
correct headers
mhantsch Mar 1, 2026
d0e3b22
fix to header
mhantsch Mar 1, 2026
46a3c92
static vs. extern
mhantsch Mar 1, 2026
21881e2
fix correct context
mhantsch Mar 1, 2026
2174ad3
function declarations
mhantsch Mar 1, 2026
0ecb295
try with verbatim reader
mhantsch Mar 1, 2026
5373a6b
try
mhantsch Mar 1, 2026
0a54c33
next try of verbatim reading
mhantsch Mar 1, 2026
494a6db
correctly advance ctx after a verbatim string
mhantsch Mar 1, 2026
38df467
correct advancing through multiple string literals, and also advance …
mhantsch Mar 1, 2026
804c011
literal setLcdTxt strings
mhantsch Mar 1, 2026
3a1502c
commands that have shortcut parameters (modded scancode) should now a…
mhantsch Mar 1, 2026
2647306
syntax fixes
mhantsch Mar 1, 2026
8a14912
function prototypes fixed
mhantsch Mar 1, 2026
958fd7f
workaround to remove quotes from regular string for modded scancodes
mhantsch Mar 1, 2026
63472fd
dequoting of modded scancode strings
mhantsch Mar 2, 2026
684318d
default to verbatim strings when consuming values
mhantsch Mar 2, 2026
912f820
test mit verbatim setLedTxt
Mar 2, 2026
4758e83
back to literal processing
Mar 2, 2026
523018f
try to limit buffer
Mar 2, 2026
9da811d
try to limit buffer more
Mar 2, 2026
374aa6a
back to normal setLcdTxt string length
Mar 2, 2026
150fea0
an attempt to fix uhk80 crashes
Mar 2, 2026
d5522f4
try without StrRead_consumeExpressionCharOfString
Mar 2, 2026
81a3538
back to StrRead_consume...
Mar 2, 2026
1d29624
simpler :any argument expansion
Mar 3, 2026
0839f1d
back to pushing the context
Mar 3, 2026
2d84902
safety checks for context overrun tightened in str_utils.c, reverted …
Mar 3, 2026
b68906a
fix refactoring typo in consumeWhite()
Mar 3, 2026
c9e4aca
ConsumeUntilDot() => ConsumeOneDot(), for more accurate parsing of $s…
mhantsch Mar 3, 2026
e0fca86
more of OneDot
mhantsch Mar 3, 2026
e5bce18
fix ConsumeOneDot header
mhantsch Mar 3, 2026
41e54bb
setLedTxt for string variable type
mhantsch Mar 3, 2026
f9de550
StringRefToSegment() to get access to the actual string
mhantsch Mar 3, 2026
de0978d
better errors when template expansion fails
mhantsch Mar 3, 2026
e1733b1
keyid and scancode types now also supported
mhantsch Mar 4, 2026
3712415
comment updated
mhantsch Mar 4, 2026
40081fb
small refactor in arg bounds checking, no semantic change
mhantsch Mar 4, 2026
38275b2
better error reporting when setLedTxt cannot parse a value given
mhantsch Mar 4, 2026
4b45249
error message wording
mhantsch Mar 4, 2026
721db2d
Merge pull request #20 from mhantsch/macroArgs-declarations
mhantsch Mar 4, 2026
c8ed56a
mostly comments refinements, and removal of code that was commented o…
Mar 4, 2026
818d0c1
Merge branch 'macroArgs-declarations' of https://github.com/mhantsch/…
Mar 4, 2026
999d0d4
Merge pull request #21 from mhantsch/macroArgs-declarations
mhantsch Mar 4, 2026
ff021ff
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Mar 5, 2026
c6100f6
Merge branch 'UltimateHackingKeyboard:master' into master
mhantsch Mar 5, 2026
5cb77ba
Merge branch 'UltimateHackingKeyboard:master' into macroArgs-declarat…
mhantsch Mar 5, 2026
226e0b6
Merge pull request #22 from mhantsch/macroArgs-declarations
mhantsch Mar 5, 2026
77023f3
update to reference manual with description and grammar for macroArg …
Mar 5, 2026
5dfd329
Merge branch 'macroArgs-declarations' of https://github.com/mhantsch/…
Mar 5, 2026
25083b5
Merge pull request #23 from mhantsch/macroArgs-declarations
mhantsch Mar 5, 2026
507594e
user manual update
Mar 6, 2026
1187f49
Merge pull request #24 from mhantsch/macroArgs-declarations
mhantsch Mar 6, 2026
2d0a003
refactor goto
Mar 6, 2026
29bdddf
Merge pull request #25 from mhantsch/macroArgs-declarations
mhantsch Mar 6, 2026
3171b3f
comment update for more clarity
Mar 6, 2026
b42fef3
added comment
Mar 6, 2026
3358bd4
reorder of boundary safety checks
Mar 6, 2026
7ddcbba
Merge pull request #26 from mhantsch/macroArgs-declarations
mhantsch Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions doc-dev/reference-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $onJoin
$onSplit
```

i.e., if you want to customize the acceleration driver for your trackball module on keymap QWR, create a macro named `$onKeymapChange QWR`, with content e.g.:
For example, if you want to customize the acceleration driver for your trackball module on keymap QWR, create a macro named `$onKeymapChange QWR` containing:

```
set module.trackball.baseSpeed 0.5
Expand Down Expand Up @@ -195,6 +195,8 @@ COMMAND = set bluetooth.enabled BOOL
COMMAND = set bluetooth.alwaysAdvertiseHid BOOL
COMMAND = set modifierLayerTriggers.{shift|alt|super|ctrl} {left|right|both}
COMMAND = &macroArg.<macro argument index (INT)>
COMMAND = macroArg <argument name (IDENTIFIER)> [: MACROARG_TYPE] <argument description (STRING)>
MACROARG_TYPE = { int | float | bool | string | keyid | scancode | any }
CONDITION = <condition>
CONDITION = if (EXPRESSION)
CONDITION = else
Expand Down Expand Up @@ -233,7 +235,7 @@ KEYMAPID = <short keymap abbreviation(IDENTIFIER)>|last|current
MACROID = last | <single char slot identifier(CHAR)> | <single number slot identifier(INT)>
OPERATOR = + | - | * | / | % | < | > | <= | >= | == | != | && | ||
VARIABLE_EXPANSION = $<variable name(IDENTIFIER)> | $<config value name>
VARIABLE_EXPANSION = $currentAddress | $currentTime | $thisKeyId | $queuedKeyId.<queue index (INT)> | $keyId.KEYID_ABBREV | $uhk.name | $macroArg.<macro argument index (INT)>
VARIABLE_EXPANSION = $currentAddress | $currentTime | $thisKeyId | $queuedKeyId.<queue index (INT)> | $keyId.KEYID_ABBREV | $uhk.name | $macroArg.<macro argument index (INT)> | $macroArg.<macro argument name (IDENTIFIER)>
EXPRESSION = <expression> | (EXPRESSION) | INT | BOOL | FLOAT | VARIABLE_EXPANSION | EXPRESSION OPERATOR EXPRESSION | !EXPRESSION | min(EXPRESSION [, EXPRESSION]+) | max(EXPRESSION [, EXPRESSION]+)
EXPRESSION = STRING == STRING | STRING != STRING
PARENTHESSED_EXPRESSION = (EXPRESSION)
Expand Down Expand Up @@ -609,6 +611,12 @@ Key actions can be parametrized with macro arguments. These arguments can be exp
- the argument bounds must correspond to token bounds in the fully expanded string
- the argument cannot span multiple lines

### Named Arguments

Macro arguments can also be named and typed by declaring them using the `macroArg` command at the beginning of the macro.

Such named arguments can also be accessed using `$macroArg.<name>`, and the value provided by Agent will be parsed according to the argument type.

### Configuration options

- `set stickyModifiers {never|smart|always}` globally turns on or off sticky modifiers. This affects only standard scancode actions. Macro actions (both gui and command ones) are always nonsticky, unless `sticky` flag is included in `tapKey|holdKey|pressKey` commands. Default value is `smart`, which is the official behaviour - i.e., `<alt/ctrl/gui> + <tab/arrows>` are sticky.
Expand Down
13 changes: 11 additions & 2 deletions doc-dev/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ ifDoubletap tapKey capsLock
- Provided value bounds are informational only - they denote values that seem to make sense. Sometimes default values are marked.
- If you are still not sure about some feature or syntax, do not hesitate to ask.

3) If `ERR` appears on the display, you can retrieve the description by using `printStatus` over a focused text editor. Or, using the above point, just search the [reference manual](reference-manual.md) for `ERR`.
3) If `ERR` appears on the display (UHK60), or a triangle warning icon `⚠️` is shown on the display (UHK80), you can retrieve the error description by using `printStatus` over a focused text editor. In addition, a yellow error pane will automatically appear in Agent, showing the error description. You can also search the [reference manual](reference-manual.md) for `ERR`.

4) If you encounter a bug, let me know. There are lots of features and quite few users around this codebase - if you do not report problems you find, chances are that no one else will (since most likely no one else has noticed).
4) If you encounter a bug, let us know (ideally, by reporting a GitHub issue). There are lots of features and quite few users around this codebase - if you do not report problems you find, chances are that no one else will (since most likely no one else has noticed).

## Known software limitations and oddities

Expand Down Expand Up @@ -114,6 +114,15 @@ replaceLayer mod QTY mod
replaceLayer mouse QTY mouse
```

Alternatively, you can also replace all of the keymap first, and the just load the base layer of your keymap again. For this approach, your macro would be:

```
replaceKeymap QTY
overlayKeymap current
```

This second method also allows you to only define some keys on the COL base layer that need to change from QTY. Any key mapped to "None" inherits its action from QTY, as `overlayKeymap` will not overload it.

## Examples

Every nonempty line is considered as one command. Empty line, or commented line too. Empty lines are skipped. Exception is an empty command action, which counts for one command. Even `{` and `}` are treated as commands, and have to be on separate lines.
Expand Down
1 change: 1 addition & 0 deletions right/src/macros/command_hash.gperf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ ifRegEq, CommandId_ifRegEq
ifNotRegEq, CommandId_ifNotRegEq
ifRegGt, CommandId_ifRegGt
ifRegLt, CommandId_ifRegLt
macroArg, CommandId_macroArg
mulReg, CommandId_mulReg
noOp, CommandId_noOp
notify, CommandId_notify
Expand Down
1 change: 1 addition & 0 deletions right/src/macros/command_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ typedef enum {
CommandId_ifRegLt, // deprecated

// 'm' commands
CommandId_macroArg,
CommandId_mulReg, // deprecated

// 'n' commands
Expand Down
Loading