Closed mmikeww closed 9 months ago
This pull request just implements the functionality on the AHK side. That gives the freedom to merge the code and allow users to manually add this if they so choose by simply following the instructions above, without needing to wait for the tedious, unenviable work of coding the UI.
I've created a potential mockup of what the UI could look like. Obviously change how you see fit:
When a new profile is created with custom context, the javascript builder could do something like:
profilenameFunc()
{
}
3. toggle on the setting "Use open source AHK to run the pie menus"
4. run notepad to open up PieMenu.ahk and send ctrl+end to scroll to bottom
This one may need some different UI treatment, just because once you're using any custom code, you have to switch over to using the AHK version and not the compiled version.
There are some piddly issues with how the settings UI tracks profiles, this may need a little more love but the foundation is there. I should be able to add the corresponding UI functionality and put up a new build this weekend.
Thank you so much adding this!
This one may need some different UI treatment, just because once you're using any custom code, you have to switch over to using the AHK version and not the compiled version.
Is it not sufficient to use the toggle for "Use open source AHK to run the pie menus"? That won't work?
Why
Many users have requested the ability to have pie menus fire only when certain window titles (not window exes) are active, or many other different requirements. This pull requests allows the user to write a custom AHK function for whatever requirement they have. If the function returns true, then the context sensitivity is applied.
Implementation
The
appProfiles[index].ahkHandles
setting inside the AHPSettings.json file contains the context that will be applied to that profile. Currently, if that value isahk_group regApps
then that means the Default Profile is triggered and the menu will show whenever none of the other profile applications match. If that value isappname.exe
then the menu will only be shown when that executable is active.We add a new option for the
appProfiles[index].ahkHandles
setting, and that is any string that ends inFunc
such as "myFunc". If that is found, then AutoHotPie will search for that function name, and use that function to determine the context sensitivity for that profile.Since the function needs to be written in AHK and defined by the user, it requires the user to either
If two custom contexts both could match, the profile created first will take precedence. That is, the one higher up in the profile dropdown list
Examples
For any user who wants to test the examples below, here are the necessary steps currently (if/when this PR code gets merged, these steps will change and probably best to check the main README):
C:\Users\USERNAME\AppData\Roaming\AutoHotPie\AHPSettings.json
ahkHandles
section and change the app.exe to "MyContextFunc". Here's what the before and after should look like:AutoHotPie\src\
Only show menu if a specific window title is active (Issue #95)
Only show menu if the pixel at screen coordinate is a certain color (Issue #140)
Only show menu if mouse is within a certain screen area (Issue #53)
Only show menu if certain apps are NOT active (Issue #85)
Since the possibilities are endless, if users have other requirements, they can simply go to the AutoHotkey forums, and request help in building a function to meet their specific requirements.