Added SystemTray.ENABLE_ROOT_CHECK

This commit is contained in:
nathan 2017-09-17 23:52:32 +02:00
parent bed426607e
commit cf62fd7ed5
2 changed files with 18 additions and 3 deletions

View File

@ -149,6 +149,12 @@ SystemTray.ENABLE_SHUTDOWN_HOOK (type boolean, default value 'true')
SystemTray.AUTO_FIX_INCONSISTENCIES (type boolean, default value 'true')
- Allows the SystemTray logic to resolve various OS inconsistencies for the SystemTray in different combinations
SystemTray.ENABLE_ROOT_CHECK (type boolean, default value 'true')
- Allows the SystemTray logic to ignore if root is detected. Usually when running as root it won't work (because of
how DBUS operates), but in rare situations, it might work.
This is an advanced feature, and it is recommended to leave as true
SystemTray.SWING_UI (type SwingUIFactory, default value 'null')
@ -265,7 +271,7 @@ Maven Info
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>SystemTray</artifactId>
<version>3.6</version>
<version>3.7</version>
</dependency>
</dependencies>
````

View File

@ -129,6 +129,15 @@ class SystemTray {
*/
public static boolean AUTO_FIX_INCONSISTENCIES = true;
@Property
/**
* Allows the SystemTray logic to ignore if root is detected. Usually when running as root it won't work (because of how DBUS
* operates), but in rare situations, it might work.
* <p>
* This is an advanced feature, and it is recommended to leave as true
*/
public static boolean ENABLE_ROOT_CHECK = true;
@Property
/**
* Allows a custom look and feel for the Swing UI, if defined. See the test example for specific use.
@ -742,7 +751,7 @@ class SystemTray {
}
}
if (isTrayType(trayType, TrayType.AppIndicator) && OSUtil.Linux.isRoot()) {
if (SystemTray.ENABLE_ROOT_CHECK && isTrayType(trayType, TrayType.AppIndicator) && OSUtil.Linux.isRoot()) {
// if are we running as ROOT, there can be issues (definitely on Ubuntu 16.04, maybe others)!
if (AUTO_FIX_INCONSISTENCIES) {
trayType = selectTypeQuietly(TrayType.Swing);
@ -990,7 +999,7 @@ class SystemTray {
*/
public static
String getVersion() {
return "3.6";
return "3.7";
}
/**