<command>wpa_gui</command>
<arg>-p <replaceable>path to ctrl sockets</replaceable></arg>
<arg>-i <replaceable>ifname</replaceable></arg>
+ <arg>-t</arg>
</cmdsynopsis>
</refsynopsisdiv>
configured. By default, choose the first interface found with
a control socket in the socket path.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>-t</term>
+
+ <listitem><para>Start program in the system tray only (if the window
+ manager supports it). By default the main status window is
+ shown.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1>
scanres = NULL;
udr = NULL;
tray_icon = NULL;
+ startInTray = false;
ctrl_iface = NULL;
ctrl_conn = NULL;
monitor_conn = NULL;
msgNotifier = NULL;
ctrl_iface_dir = strdup("/var/run/wpa_supplicant");
- if (QSystemTrayIcon::isSystemTrayAvailable())
- createTrayIcon();
-
parse_argv();
+ if (QSystemTrayIcon::isSystemTrayAvailable())
+ createTrayIcon(startInTray);
+ else
+ show();
+
textStatus->setText("connecting to wpa_supplicant");
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(ping()));
updateStatus();
networkMayHaveChanged = true;
updateNetworks();
-
- if (tray_icon)
- tray_icon->show();
}
{
int c;
for (;;) {
- c = getopt(qApp->argc(), qApp->argv(), "i:p:");
+ c = getopt(qApp->argc(), qApp->argv(), "i:p:t");
if (c < 0)
break;
switch (c) {
free(ctrl_iface_dir);
ctrl_iface_dir = strdup(optarg);
break;
+ case 't':
+ startInTray = true;
+ break;
}
}
}
}
-void WpaGui::createTrayIcon()
+void WpaGui::createTrayIcon(bool trayOnly)
{
QApplication::setQuitOnLastWindowClosed(false);
tray_menu->addAction(quitAction);
tray_icon->setContextMenu(tray_menu);
+
+ tray_icon->show();
+
+ if (!trayOnly)
+ show();
}