seerge / g-helper

Lightweight Armoury Crate alternative for Asus laptops and ROG Ally. Control tool for ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, TUF, Strix, Scar and other models
https://seerge.github.io/g-helper/
GNU General Public License v3.0
6.97k stars 254 forks source link

GHelper does not clean up tray icons on restart #1114

Closed thepriyamkalra closed 1 year ago

thepriyamkalra commented 1 year ago

Describe the bug I do not know if windows is supposed to handle cleaning the tray when an app is restarted, but the tray icon is cleared perfectly fine when the app is closed (not restarted) so I wonder why it is any different on restart even when not using any utility like TASKKILL to force terminate it.

Whenever I restart G-Helper by clicking on the executable while its already running, or by simply using the custom action "ghelper" in keybindings, the tray icon is not removed, until I navigate over it and then it disappears.

I use a custom scheduled task that does certain configuration with ghelper and it restarts it thrice while making these changes, which leaves a couple icons in the tray everytime.

Clear scenario to Reproduce Steps to reproduce the behavior:

  1. Ensure G-Helper is already running
  2. Restart it by running the executable again or using a custom action (keybinding)

Expected behavior G-Helper should clean up the tray icon on termination, atleast when using the custom action to restart it.

App Logs Don't really think logs are needed here. But let me know and I will add them.

Screenshots or screencasts After restarting ghelper with a keybinding: image

Desktop:

Asus software None

seerge commented 1 year ago

@thepriyamkalra hello,

I assume you don't have 5 instances of the app running (somehow), as there is a mechanism in the app that avoids that ?

If so - then it looks like a windows bug (and i can't reproduce it) on my 2 windows laptops.

Why do you restart app so many times in a first place ? Launch it from M4/Rog key or from Ctrl+Shift+F12 or by clicking on tray icon? :)

thepriyamkalra commented 1 year ago

I assume you don't have 5 instances of the app running (somehow), as there is a mechanism in the app that avoids that ?

There is only one instance running since the app seems to kill any instance which is already running when it is started. I believe this is actually the cause of the "dead" tray icons (but I am not sure)

And I need to restart the app since I have a custom script that manipulates the ghelper config.json to change settings (since there is no ghelper cli / api afaik) and it needs to restart it to make ghelper apply the changes. I was planning on making a CLI fork of ghelper myself, but I have been a little busy lately.

G-Helper has quite a bit of useful functionality that is not provided by any other app, and an API would be very useful.

seerge commented 1 year ago

@thepriyamkalra new app indeed kills old one (to prevent dublicates). On exit app has a code that removes tray icon + windows cleans it by itself as well.

I'm afraid I can't really help in this case, as if app is killed (it's may not execute it's last commands) and it's up to windows. I haven't heard from anyone else about tray icons tho :) so it may be your specific case.

I can't add CLI, cause app is designed to run in background constantly, and CLI assumes that you run it and then stop.

What things are you doing with your script ?

thepriyamkalra commented 1 year ago

I can't add CLI, cause app is designed to run in background constantly, and CLI assumes that you run it and then stop.

It would be possible to make a daemon that constantly runs in the background (as ghelper already does) and "listens" for commands over some protocol like http (local webserver) But that would be quite a bit of work (I will do it eventually)

What things are you doing with your script ?

Since G-Helper does not expose an API, I have found no way to change cpu mode from ext keyboard (since it does not support ghelper key bindings as they all require FN combo) The script directly modifies the config.json on certain button press (from ext keyboard) and restarts ghelper to change the mode. I know this is a very specific use case but you asked for this lol

seerge commented 1 year ago

@thepriyamkalra

It would be possible to make a daemon that constantly runs in the background (as ghelper already does) and "listens" for commands over some protocol like http (local webserver) But that would be quite a bit of work (I will do it eventually)

That would turn app into half-armoury ;) And it's a lot of work indeed

Since G-Helper does not expose an API, I have found no way to change cpu mode from ext keyboard (since it does not support ghelper key bindings as they all require FN combo)

If under CPU mode you mean "main" performance modes of the app - it exists from the beginning Ctrl + Shift + F5, its literally in readme :)

thepriyamkalra commented 1 year ago

If under CPU mode you mean "main" performance modes of the app - it exists from the beginning Ctrl + Shift + F5, its literally in readme :)

Oh wow. I have read the readme several times but I still managed to forget this when I needed it. Well thats just great XD

thepriyamkalra commented 1 year ago

I guess this is non-issue then. Closing.

seerge commented 1 year ago

@thepriyamkalra and for things like this - it's easier to ask me to add an extra binding for some things, rather inventing a wheel with API / restarting apps / etc .. :)

thepriyamkalra commented 1 year ago

@thepriyamkalra and for things like this - it's easier to ask me to add an extra binding for some things, rather inventing a wheel with API / restarting apps / etc .. :)

Oh I will 100% make an API for this when I get the time, I just love this project too much to not do that. (fuck armory crate) but yeah for this specific thing I should have just asked, would have saved me quite alot of time.