You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thks for sharing this very useful app!
Did you add by any chance cmd support to the app?
It would be nice if we could open the app and be capable of changing/enabling different profiles from the command line, instead of needing to use the graphical interface and mouse for that.
There is currently no command-line support, but I do see ways that I could implement that. I may have some time to work on that in the coming week.
It would be great if you could help me a bit: can you describe your use case? In what example would a command-line instruction, benefit you over using the GUI?
Answering this wil give me some direction on how to implement this new feature.
I have a two players arcade machine that uses a keyboard encoder and run games using a frontend. However, some of those games have limited remapping capabilities, so I need to load different key2joy profiles for playing them.
Right now, depending of the game, I have to either (1) change the profile and load it by hand in the GUI; or (2) load a single but more complex profile that includes script code to only activate certain key mappings under specific window class names.
I am using the latter for now (2), but although your code is very efficient this adds some unnecessary overhead every time I press each key to check the current active window.
If switching and disabling active profiles is supported by command line, I could simply whenever I hit to play an specific game, run before silently the command to load the right profile for that game.
Ideally, I would love to be able to run a command like key2joy.exe --profile "path-to-game-profile.k2j.json" to load and enable an specific profile. Then I would only need to run this before I run my game.
Thanks for the detailed description, it's really helpful. That arcade machine sounds like a fun project!
I think I understand how to implement this for you now. I'm going to work on getting version 0.6.0 out within a week. After that the app will work somewhat as follows in your specific use-case:
The user creates multiple separate profiles in Key2Joy, one for each arcade game they'd like to remap (nothing new here)
The user minimizes Key2Joy without needing to enable the profile (Key2Joy will be waiting in the notification tray) (nothing new here)
Your front-end (that starts a game) will execute key2joy.cmd.exe enable --profile "path-to-game-profile.k2j.json"
Key2Joy will be instructed to disable any other profile currently running (if any), then enable the profile saved as path-to-game-profile.k2j.json
key2joy.cmd.exe is a transient application which closes immediately after instructing Key2Joy
Key2Joy will keep the profile active until instructed to disable it (by enabling another profile, or running: key2joy.cmd.exe disable)
Feel free to let me know if you think I've misunderstood and the described functionality is not helpful to your use-case.
Just to add something that just come to my mind, any way to send the enable and disable commands to key2joy would work. So, either adding support for the key2joy.cmd.exe or adding support for some api to communicate with key2joy directly, like sending a postMessage with specific instructions to enable and disable profiles, would work perfectly fine.
Thk you very much!
I gave a quick try and it worked fine so far.
I will do more detailed tests in the next few days and come back to you if I find something.
Just one thing that came to mind while testing so far:
Could you launch key2joy directly to the system tray instead of opening its window if we launch it through the Key2Joy.Cmd.exe command?
The window opening as it is now can affect the focused window, or cause a quick window flash, while launching games in my use case (arcade machine using a frontend to launch games).
Activity
luttje commentedon Dec 29, 2022
Hi there, thanks for your interest in this app!
There is currently no command-line support, but I do see ways that I could implement that. I may have some time to work on that in the coming week.
It would be great if you could help me a bit: can you describe your use case? In what example would a command-line instruction, benefit you over using the GUI?
Answering this wil give me some direction on how to implement this new feature.
Thanks!
Renato-Rodrigues commentedon Dec 29, 2022
Sure, and thank you for the fast reply.
I have a two players arcade machine that uses a keyboard encoder and run games using a frontend. However, some of those games have limited remapping capabilities, so I need to load different key2joy profiles for playing them.
Right now, depending of the game, I have to either (1) change the profile and load it by hand in the GUI; or (2) load a single but more complex profile that includes script code to only activate certain key mappings under specific window class names.
I am using the latter for now (2), but although your code is very efficient this adds some unnecessary overhead every time I press each key to check the current active window.
If switching and disabling active profiles is supported by command line, I could simply whenever I hit to play an specific game, run before silently the command to load the right profile for that game.
Ideally, I would love to be able to run a command like
key2joy.exe --profile "path-to-game-profile.k2j.json"to load and enable an specific profile. Then I would only need to run this before I run my game.luttje commentedon Dec 29, 2022
Thanks for the detailed description, it's really helpful. That arcade machine sounds like a fun project!
I think I understand how to implement this for you now. I'm going to work on getting version 0.6.0 out within a week. After that the app will work somewhat as follows in your specific use-case:
key2joy.cmd.exe enable --profile "path-to-game-profile.k2j.json"path-to-game-profile.k2j.jsonkey2joy.cmd.exeis a transient application which closes immediately after instructing Key2Joykey2joy.cmd.exe disable)Feel free to let me know if you think I've misunderstood and the described functionality is not helpful to your use-case.
Renato-Rodrigues commentedon Dec 29, 2022
That sounds perfect!
Just to add something that just come to my mind, any way to send the enable and disable commands to key2joy would work. So, either adding support for the
key2joy.cmd.exeor adding support for some api to communicate with key2joy directly, like sending a postMessage with specific instructions to enable and disable profiles, would work perfectly fine.luttje commentedon Dec 29, 2022
I've just pre-released a first draft of this feature @ https://github.com/luttje/Key2Joy/releases/tag/0.6.0-alpha1
If you find some time to help test it I would really appreciate it.
I'll probably work on this feature again next week. In the meanwhile feel free to create new issues and feature requests as you please.
I really hope it can already help you (and hope I didn't break to much)!
Renato-Rodrigues commentedon Jan 4, 2023
Thk you very much!
I gave a quick try and it worked fine so far.
I will do more detailed tests in the next few days and come back to you if I find something.
Just one thing that came to mind while testing so far:
Could you launch key2joy directly to the system tray instead of opening its window if we launch it through the
Key2Joy.Cmd.execommand?The window opening as it is now can affect the focused window, or cause a quick window flash, while launching games in my use case (arcade machine using a frontend to launch games).
Renato-Rodrigues commentedon Jan 4, 2023
minor thing: I think the icon is missing from the exe files in the current build. Not a big deal anyway. :)
luttje commentedon Jan 5, 2023
Thanks for letting me know!
I'll fix that up in a future update :)
I'm closing this issue. For any future bugs/problems feel free to create a new issue or comment on this PR: #29