[BUG]: AutoHotkey helper library requires optional arguments #137

Closed
opened 2026-01-05 14:48:30 +01:00 by adam · 2 comments
Owner

Originally created by @ItsPizzaTime1501 on GitHub (Sep 3, 2022).

Describe the bug
When using the ahk helper library generated by komorebic ahk-library you are required pass arguments that are meant to be optional

To Reproduce
A quick example of this is:

  1. Add a line like ActiveWindowBorderColour(0, 255, 255) or FocusFollowsMouse("disable") to your config that includes the helper lib
  2. Reload said config
  3. You will get an error from autohotkey saying too few arguments passed

Expected behavior
You should be able to only pass the RGB values as the window-kind argument is optional in the command komorebic active-window-border-colour 0 255 255

Screenshots and Videos
AutoHotkeyU64_sbGi1BFfP5
The command failing
cmd_Zy6YZ4dwXG
The same line working with the cli

Originally created by @ItsPizzaTime1501 on GitHub (Sep 3, 2022). **Describe the bug** When using the ahk helper library generated by `komorebic ahk-library` you are required pass arguments that are meant to be optional **To Reproduce** A quick example of this is: 1. Add a line like `ActiveWindowBorderColour(0, 255, 255)` or `FocusFollowsMouse("disable")` to your config that includes the helper lib 2. Reload said config 3. You will get an error from autohotkey saying too few arguments passed **Expected behavior** You should be able to only pass the RGB values as the window-kind argument is optional in the command `komorebic active-window-border-colour 0 255 255` **Screenshots and Videos** ![AutoHotkeyU64_sbGi1BFfP5](https://user-images.githubusercontent.com/49124932/188251116-e0aabbe3-574b-42bb-a420-a147779c9375.png) The command failing ![cmd_Zy6YZ4dwXG](https://user-images.githubusercontent.com/49124932/188251134-97349f51-d77d-4772-a3fb-162de3cc84c7.png) The same line working with the cli
adam added the enhancement label 2026-01-05 14:48:30 +01:00
adam closed this issue 2026-01-05 14:48:30 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Sep 4, 2022):

window-kind is actually a required argument, it's just that the CLI is able to provide a default value.

All of the AHK library is generated from the type annotations of the CLI, but it is possible to parse clap annotations and I think it could be possible to use this to provide a default argument to an AHK function if AHK supports default argument syntax for function definitions.

I'm not going to work on this issue myself, but I can provide guidance for anyone who would like to to try working on the derive-ahk proc macro which is a very self-contained part of the codebase.

@LGUG2Z commented on GitHub (Sep 4, 2022): [`window-kind`](https://github.com/LGUG2Z/komorebi/blob/master/komorebic/src/main.rs#L408) is actually a required argument, it's just that the CLI is able to provide a default value. All of the AHK library is generated from the type annotations of the CLI, but it is possible to [parse clap annotations](https://github.com/LGUG2Z/komorebi/blob/master/derive-ahk/src/lib.rs#L49) and I think it could be possible to use this to provide a default argument to an AHK function if AHK supports default argument syntax for function definitions. I'm not going to work on this issue myself, but I can provide guidance for anyone who would like to to try working on the `derive-ahk` proc macro which is a very self-contained part of the codebase.
Author
Owner

@LGUG2Z commented on GitHub (May 12, 2024):

There won't be any more development on the ahk library generator; users will be encouraged to write their own wrappers going forward.

@LGUG2Z commented on GitHub (May 12, 2024): There won't be any more development on the ahk library generator; users will be encouraged to write their own wrappers going forward.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#137