Key-press based activation of wpa_gui and the hard-coded system tray icon
Jouni Malinen
j
Tue Jun 16 08:19:35 PDT 2015
On Tue, Jun 16, 2015 at 11:01:29AM +0200, Ond?ej Grover wrote:
> The problem is that the each time I start wpa_gui via the keyboard shortcut
> a new wpa_gui process is started and a new tray icon is created and when
> the window is closed, I get another icon in the system tray. As the process
> does not check for an already running wpa_gui process (I haven't found
> anything like that in wpa_supplicant/wpa_gui-qt4/wpagui.cpp), many
> redundant wpa_gui processes keep running.
>
> So the end goal I want to achieve is to start wpa_gui via a keyboard
> shortcut without having many redundant processes running.
I would have wanted the behavior to be such that if wpa_gui is started
with the same parameters as an already running instance, that already
running instance is brought into foreground instead of starting a new
process. The last time I looked at this was years ago and at that point
in time, some of the Qt features that would have made this easy were not
part of the free version, if I remember correctly. I'd hope that that
has changed since then, though.
> I see several ways to achieve this:
>
> 1. add an option to wpa_gui that would prevent system tray icon creation. I
> could easily create a patch for that, the only important change would be
> in wpa_supplicant/wpa_gui-qt4/wpagui.cpp
> - if (QSystemTrayIcon::isSystemTrayAvailable())
> + if (useSystemTray && QSystemTrayIcon::isSystemTrayAvailable())
> and useSystemTray (true by default) could be set to false via e.g. a `-T`
> option.
Regardless of other possible alternatives, this sound like a fine
addition that may have other uses as well.
> 2. assign keyboard bindings for opening some of the windows like the main
> window or scan results
> Afterwards wpa_gui could be started with -t to keep it in the system tray
> and just open the windows when needed
> However, that would require a much larger change in the code. The benefit
> would be that other windows than just the main one would be quickly
> accessible.
I'm not sure whether this would be the easiest and most obvious solution
for users in general, i.e., I'd rather get the
bring-main-window-to-foreground behavior on new wpa_gui launch if
wpa_gui was already running. That said, there may be corner cases where
there is desire to start multiple wpa_gui processes with different
wpa_supplicant control interface parameters, so this behavior would
either need to be clever enough to compare that parameter and only apply
use-existing-process if the same parameters were used or alternatively,
there would need to be an option to force starting a new process
regardless of what else may already be running.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list