Add an option to not use systray
This commit is contained in:
@@ -59,6 +59,7 @@ public class GuiSwing extends JFrame implements Gui {
|
||||
private Working activityWorking;
|
||||
private Settings activitySettings;
|
||||
private TrayIcon trayIcon;
|
||||
private boolean useSysTray;
|
||||
|
||||
private int framesRendered;
|
||||
|
||||
@@ -67,9 +68,9 @@ public class GuiSwing extends JFrame implements Gui {
|
||||
|
||||
private ThreadClient threadClient;
|
||||
|
||||
public GuiSwing() {
|
||||
public GuiSwing(boolean useSysTray_) {
|
||||
framesRendered = 0;
|
||||
|
||||
useSysTray = useSysTray_;
|
||||
waitingForAuthentication = true;
|
||||
}
|
||||
|
||||
@@ -82,6 +83,7 @@ public class GuiSwing extends JFrame implements Gui {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
if (useSysTray) {
|
||||
try {
|
||||
sysTray = SystemTray.getSystemTray();
|
||||
if (SystemTray.isSupported()) {
|
||||
@@ -97,6 +99,8 @@ public class GuiSwing extends JFrame implements Gui {
|
||||
catch (UnsupportedOperationException e) {
|
||||
sysTray = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
URL iconUrl = getClass().getResource("/icon.png");
|
||||
if (iconUrl != null) {
|
||||
|
||||
@@ -88,6 +88,9 @@ public class Worker {
|
||||
@Option(name = "--version", usage = "Display application version", required = false, handler = VersionParameterHandler.class)
|
||||
private VersionParameterHandler versionHandler;
|
||||
|
||||
@Option(name = "--no-systray", usage = "Don't use systray", required = false)
|
||||
private boolean no_systray = false;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Worker().doMain(args);
|
||||
}
|
||||
@@ -279,7 +282,7 @@ public class Worker {
|
||||
System.out.println("You should set a DISPLAY or use a text ui (with -ui " + GuiTextOneLine.type + " or -ui " + GuiText.type + ").");
|
||||
System.exit(3);
|
||||
}
|
||||
gui = new GuiSwing();
|
||||
gui = new GuiSwing(no_systray == false);
|
||||
break;
|
||||
}
|
||||
Client cli = new Client(gui, config, server);
|
||||
|
||||
Reference in New Issue
Block a user