andrew-bibb / cmst

QT GUI for Connman
173 stars 37 forks source link

cmst not showing in systray when using stalonetray #269

Closed RayZ0rr closed 2 years ago

RayZ0rr commented 2 years ago

I am using stalonetray as system tray for my window manager. However, I don't always keep it open. I only open it when required with the following in my polybar:

#!/bin/bash

if pgrep -x "stalonetray" > /dev/null
then
    killall stalonetray
else
    stalonetray
fi

However, if I open cmst without stalonetray visible it shows dialog on not spawning systray instance. Other applications like flameshot, virt-manager and steam doesn't have this issue. They create systray instance nonetheless.

andrew-bibb commented 2 years ago

Sorry for the delay, been buried trying to push a new release out.

The behavior you are describing is intentional. If a systemtray does not exist at program startup CMST will throw up that popup. The wait time to search for the tray can be specified in the "Preferences" which can be helpful if you start the stalonetray when you start CMST and you need to give it some more time. If you only want to run CMST without being able to minimize it to the system tray you can completely disable the tray icon in "Preferences". Both of these are also available as command line switches.

RayZ0rr commented 2 years ago

Can the wait time be specified such that, cmst doesn't throw pop-up and waits for systray till it's available all the time? As you can see above, my systray script toggles stalonetray by killing and creating it again.

andrew-bibb commented 2 years ago

I just checked the documentation for QSystemTrayIcon and it says that if no tray is available that it will automatically start if the systemtray becomes available later. I don't know if this is a recent feature of if I totally screwed it up years ago when I first wrote the wait-time code. I'm pretty sure it is new because I wrote the wait-time code when people were reporting problems starting the program before the systemtray was available and it was added to give time for the systemtray to come up.

I think this will be a simple fix of moving or completely removing the dialog. In addition to the wait-time I also have timers (I think there are 3 of them) built in to try and install the icon before the dialog is thrown up. I can probably eliminate all those as well. Anyway I'm trying for a release in the next week or maybe two at the outside and if this is as easy as I think it will be I'll have it incorporated in that release.

RayZ0rr commented 2 years ago

This is awesome work. Thank you. One more question, are you using iwd or wpa_supplicant?

andrew-bibb commented 2 years ago

I tried iwd a while back and it seemed a bit buggy to me. One of the biggest issues I personally had with it was that the service could not be started by Connman when needed. One needed to start it manually with a script or by a systemd unit. In the grand scheme of things not really all that big of a deal, but it just irritated me. There were a couple of other issues I observed using it but can't remember exactly what they were now that we're a couple of years down the road. I went back to using wpa-supplicant. It has been a few years now so probably should try iwd again to see how it has progressed.