Add option to disable system tray icon

This commit is contained in:
testing-ongithub
2021-12-18 18:08:44 -06:00
committed by Adam
parent 0db23d4d7a
commit fab6e46786
2 changed files with 25 additions and 9 deletions

View File

@@ -185,11 +185,24 @@ public interface RuneLiteConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "trayIcon",
name = "Enable tray icon",
description = "Enables icon in system tray",
warning = "Disabling this may limit your ability to receive tray notifications.\nPlease restart your client after changing this setting.",
position = 20,
section = notificationSettings
)
default boolean enableTrayIcon()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "notificationTray", keyName = "notificationTray",
name = "Enable tray notifications", name = "Enable tray notifications",
description = "Enables tray notifications", description = "Enables tray notifications",
position = 20, position = 21,
section = notificationSettings section = notificationSettings
) )
default boolean enableTrayNotifications() default boolean enableTrayNotifications()
@@ -201,7 +214,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationRequestFocus", keyName = "notificationRequestFocus",
name = "Request focus", name = "Request focus",
description = "Configures the window focus request type on notification", description = "Configures the window focus request type on notification",
position = 21, position = 22,
section = notificationSettings section = notificationSettings
) )
default RequestFocusType notificationRequestFocus() default RequestFocusType notificationRequestFocus()
@@ -213,7 +226,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationSound", keyName = "notificationSound",
name = "Notification sound", name = "Notification sound",
description = "Enables the playing of a beep sound when notifications are displayed", description = "Enables the playing of a beep sound when notifications are displayed",
position = 22, position = 23,
section = notificationSettings section = notificationSettings
) )
default Notifier.NativeCustomOff notificationSound() default Notifier.NativeCustomOff notificationSound()
@@ -225,7 +238,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationTimeout", keyName = "notificationTimeout",
name = "Notification timeout", name = "Notification timeout",
description = "How long notification will be shown in milliseconds. A value of 0 will make it use the system configuration. (Linux only)", description = "How long notification will be shown in milliseconds. A value of 0 will make it use the system configuration. (Linux only)",
position = 23, position = 24,
section = notificationSettings section = notificationSettings
) )
@Units(Units.MILLISECONDS) @Units(Units.MILLISECONDS)
@@ -238,7 +251,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationGameMessage", keyName = "notificationGameMessage",
name = "Game message notifications", name = "Game message notifications",
description = "Adds a notification message to the chatbox", description = "Adds a notification message to the chatbox",
position = 24, position = 25,
section = notificationSettings section = notificationSettings
) )
default boolean enableGameMessageNotification() default boolean enableGameMessageNotification()
@@ -250,7 +263,7 @@ public interface RuneLiteConfig extends Config
keyName = "flashNotification", keyName = "flashNotification",
name = "Flash", name = "Flash",
description = "Flashes the game frame as a notification", description = "Flashes the game frame as a notification",
position = 25, position = 26,
section = notificationSettings section = notificationSettings
) )
default FlashNotification flashNotification() default FlashNotification flashNotification()
@@ -262,7 +275,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationFocused", keyName = "notificationFocused",
name = "Send notifications when focused", name = "Send notifications when focused",
description = "Toggles all notifications for when the client is focused", description = "Toggles all notifications for when the client is focused",
position = 26, position = 27,
section = notificationSettings section = notificationSettings
) )
default boolean sendNotificationsWhenFocused() default boolean sendNotificationsWhenFocused()
@@ -275,7 +288,7 @@ public interface RuneLiteConfig extends Config
keyName = "notificationFlashColor", keyName = "notificationFlashColor",
name = "Notification Flash", name = "Notification Flash",
description = "Sets the color of the notification flashes.", description = "Sets the color of the notification flashes.",
position = 27, position = 28,
section = notificationSettings section = notificationSettings
) )
default Color notificationFlashColor() default Color notificationFlashColor()

View File

@@ -521,7 +521,10 @@ public class ClientUI
frame.revalidateMinimumSize(); frame.revalidateMinimumSize();
// Create tray icon (needs to be created after frame is packed) // Create tray icon (needs to be created after frame is packed)
trayIcon = SwingUtil.createTrayIcon(ICON, title, frame); if (config.enableTrayIcon())
{
trayIcon = SwingUtil.createTrayIcon(ICON, title, frame);
}
// Move frame around (needs to be done after frame is packed) // Move frame around (needs to be done after frame is packed)
if (config.rememberScreenBounds() && !safeMode) if (config.rememberScreenBounds() && !safeMode)