Skip to content

command line support? #28

Closed
Closed

Description

@Renato-Rodrigues

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.

Activity

  1. luttje commented on Dec 29, 2022

    @luttje
    Collaborator

    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!

  2. added
    enhancement
    ux
    on Dec 29, 2022
  3. added this to the Launch stable (1.0.0) milestone on Dec 29, 2022
  4. Renato-Rodrigues commented on Dec 29, 2022

    @Renato-Rodrigues
    Author

    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.

  5. luttje commented on Dec 29, 2022

    @luttje
    Collaborator

    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:

    1. The user creates multiple separate profiles in Key2Joy, one for each arcade game they'd like to remap (nothing new here)
    2. The user minimizes Key2Joy without needing to enable the profile (Key2Joy will be waiting in the notification tray) (nothing new here)
    3. Your front-end (that starts a game) will execute key2joy.cmd.exe enable --profile "path-to-game-profile.k2j.json"
    4. 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
    5. key2joy.cmd.exe is a transient application which closes immediately after instructing Key2Joy
    6. 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.

  6. self-assigned this
    on Dec 29, 2022
  7. Renato-Rodrigues commented on Dec 29, 2022

    @Renato-Rodrigues
    Author

    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.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.

  8. luttje commented on Dec 29, 2022

    @luttje
    Collaborator

    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)!

  9. Renato-Rodrigues commented on Jan 4, 2023

    @Renato-Rodrigues
    Author

    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).

  10. Renato-Rodrigues commented on Jan 4, 2023

    @Renato-Rodrigues
    Author

    minor thing: I think the icon is missing from the exe files in the current build. Not a big deal anyway. :)

  11. luttje commented on Jan 5, 2023

    @luttje
    Collaborator

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementux

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions