AntiMicroX / antimicrox

Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support.
GNU General Public License v3.0
2.25k stars 137 forks source link

Add commandline to close the program #994

Closed MaLDox77 closed 2 weeks ago

MaLDox77 commented 2 weeks ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe.

The problem is that there is no way to elegantly quit the program without interacting with the tray icon or the application window.

Describe the solution you'd like

To add a new commandline parameter that sends the quit instruction to the program so could be possible to close Antimicrox from a script.

Describe alternatives you've considered

No response

Additional context

No response

pktiuk commented 2 weeks ago

There is already a command called kill. You can use it for closing any app.

MaLDox77 commented 2 weeks ago

There is already a command called kill. You can use it for closing any app.

Kill is a system command, not a antimicrox command. It's a workaround and doesn't close the antimicrox icon in system tray. In addition, it causes an unexpected shutdown of the application instead of a controlled one. It doesn't seem like an appropriate recomendation.

pktiuk commented 2 weeks ago

@MaLDox77 kill command can send different types of signals. TERM is one of them and it is handled by AntiMicroX https://github.com/AntiMicroX/antimicrox/blob/5d5d8ba9667a70a229eb5dad9042923828ce434a/src/main.cpp#L76

it causes an unexpected shutdown

I guess you are talking about sigkill, which forcefully terminates process.

It doesn't seem like an appropriate recomendation.

Sending terminate command is an expected way of closing an app from outside (any app in linux). There is no solution which is more appropriate for this purpose. In case of any problems with handling this signal just open the bug.

pktiuk commented 2 weeks ago

and doesn't close the antimicrox icon in system tray

Does the icon in the system tray still exist after killing an app? If yes then it really may be a bug.

MaLDox77 commented 1 week ago

and doesn't close the antimicrox icon in system tray

Does the icon in the system tray still exist after killing an app? If yes then it really may be a bug.

Misunderstanding comes because I use Antimicrox in windows and you're talking about linux ¯_(ツ)_/¯

pktiuk commented 1 week ago

This is a big difference.
Not many users on windows want (and know how to) use terminal.

pktiuk commented 1 week ago

FYI
Windows also uses signals
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/signal?view=msvc-170