mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[FEAT]: Use Autohotkey v2 by default #171
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sitiom on GitHub (Dec 22, 2022).
Is your feature request related to a problem? Please describe.
Since Autohotkey v2 has reached stable, it might be a good time to migrate completely to v2.
Describe the solution you'd like
Make komorebi use AutoHotkey v2 by default. To do that:
ahk-ascto v2ahk-libraryandahk-asccommands to generate v1 syntax instead.$Env:KOMOREBI_AHK_V1_EXEand$Env:KOMOREBI_AHK_V2_EXEto a single$Env:KOMOREBI_AHK_EXE(either v1 or v2)..ahk2and just have a singlekomorebi.ahkfile (either v1 or v2). Autohotkey v2 has a launcher script where it can detect the version of the running script and run the appropriate interpreter for it.The behavior can be configured in the settings:
It would be good for komorebi to make use of it.
Describe alternatives you've considered
None.
Additional context
Related to #10
@LGUG2Z commented on GitHub (Jan 2, 2023):
There are some significant changes in AHK2 syntax which require commands to
RunandRunWaitto be surrounded by single (or maybe double?) quotes. Unfortunately I have been unable to find a way to do string interpolation in AHK2 (eg.command ${arg} --flag ${flag_arg}). Without this, I can't see a way to generate (or even have) an AHK v2 library forkomorebic.For now new users should continue to install AHK v1.1 from the Scoop
versionsbucket if they want to play around with the sample configurations in this repo.I will be traveling for most of this month (without a Windows laptop) so I won't be able to do much coding, but if someone can figure out how to handle string interpolation (in any position, not just prepending or appending) in AHK v2, please share the details in this issue.
@sitiom commented on GitHub (Jan 3, 2023):
From the docs:
@LGUG2Z commented on GitHub (Jan 19, 2023):
I've been able to use the
formatAHK fn with variadic args collected into an array to update the code here:https://github.com/LGUG2Z/komorebi/blob/master/derive-ahk/src/lib.rs#L151
However, this doesn't work consistently, and it completely falls apart when generating trying to generate library functions for commands that require flags:
https://github.com/LGUG2Z/komorebi/blob/master/derive-ahk/src/lib.rs#L132
I have considered just dropping the library altogether and providing a single wrapper command like this:
This works well enough, however when running with an ahk2 interpreter, the focus commands produce access denied errors in
komorebiwhich I am unable to reproduce with either ahk1.1 or just by running the commands in the terminal:Is anyone else using ahk2 experiencing this issue when trying to change window focus?
@sitiom commented on GitHub (Apr 11, 2023):
Here's a minimum repro script:
And it seems to work fine.
You also might want to consider using normal string concatenation instead. See
1b9a5ab3de/config/komorebi/komorebic.lib.ahk@LGUG2Z Can you reopen this issue? I'd really like to have AHKv2 support for library helpers.
@LGUG2Z commented on GitHub (Apr 11, 2023):
Reopening this after some discussion on Discord
The steps moving forward:
Thederive-ahkcrate will be deprecated, both because of the difficulty in updating thesyndependency and because I'm not able to wrangle the raw Rust tokens into the syntax required for v2In the future newkomorebiccommands should have wrappers manually added to this filekomorebic ahk-asccommand will be updated to emit a file in the AHKv2 from the input YAML(s)@sitiom commented on GitHub (Apr 17, 2023):
Might as well bring back
komorebi.sample.ahkfor AHKv2@NormTurtle commented on GitHub (Apr 17, 2023):
so are we losing whkd ? again ???
@LGUG2Z commented on GitHub (Apr 17, 2023):
Don't worry, this is not the case. This PR is just to add the same level of support for AHKv2 that users previously had with AHKv1.
@LGUG2Z commented on GitHub (May 2, 2023):
This is in the master branch now and will be part of the upcoming 0.1.16 release. I'm planning on making an AHK quickstart video to go along with it as well. 🚀
@NormTurtle commented on GitHub (May 3, 2023):
so what about win + keys?!
@sitiom commented on GitHub (May 3, 2023):
You can use the Win key as a keybinding in AHK
@llinfeng commented on GitHub (Jul 5, 2024):
Hi folks, I'm new to
komorebiand have been using my decade-old AHK v1 script to manage the window-layout until now. I'd prefer to stay with AHK v1 for the time being.What would be a good pointer for AHK v1 configuration? I tried to search around and only found this commit (
acc119a) through this search, with keyboard "ahk1".Will the ahk filies files associated with commit acc119a work for
komorebiin its current state? There are a good number of them, including komorebi.generated.ahk, komorebi.sample.ahk, and komorebic.lib.ahk. In particular, will these old AHK v1 config still work for the currentkomorebiexecutable, which I installed using the following lines as suggested in the readme:Thx!
@LGUG2Z commented on GitHub (Jul 5, 2024):
I would recommend using this as your starting point now: https://lgug2z.github.io/komorebi/common-workflows/autohotkey.html
Just rewrite this function to be compatible with AHKv1:
Then you call it with the same arguments that you'd call the regular komorebic commands as listed here: https://lgug2z.github.io/komorebi/cli/quickstart.html
If you set the
KOMOREBI_AHK_EXEvariable to the path to your AHKv1 executable you should be good to go.@llinfeng commented on GitHub (Jul 7, 2024):
Update: for AHK 1, keeping the following function somewhere before calling
Komorebic("CLI-arguments")suffices:@sitiom commented on GitHub (Jul 8, 2024):
Perhaps it would be a better investment to switch to AHK v2 😅; it would only take a day to port all your scripts at best. You can check out https://github.com/mmikeww/AHK-v2-script-converter to help you out with it.
@llinfeng commented on GitHub (Jul 8, 2024):
@sitiom Thank you for the pointer to the converter repo. It looks promising. I agree that I should switch to AHK v2 at some point.
@DovieW commented on GitHub (Oct 10, 2024):
@llinfeng Did you end up making the ahk1 config? I have ahk1 installed on my work PC and would be a pain to get ahk2 installed.
Would you be able to post it here if so? If it's not too much trouble
@llinfeng commented on GitHub (Oct 10, 2024):
@DovieW, I think the following will do the trick for AHK v1.