Skip to content

Commit

Permalink
Force AWT tray mode on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg authored and Gregor Billing committed May 13, 2021
1 parent 3b47111 commit ce33254
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
-keep class com.sun.jna.** { *; }
-keep class dorkbox.jna.** { *; }
-keep class dorkbox.systemTray.** { *; }
-keep class sun.awt.windows.** { *; }
-keep class sun.lwawt.macosx.** { *; }
-keep class sun.awt.X11.** { *; }
-keep class sun.awt.SunToolkit { *; }

-keep,includedescriptorclasses class kotlinx.serialization.json.**$$serializer { *; }
-keep,includedescriptorclasses class org.worldcubeassociation.tnoodle.server.webscrambles.**$$serializer { *; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ data class OfflineJarUtils(val port: Int) {
// Find out which icon to use.
val iconFileName = if (isWrapper) ICON_WRAPPER else ICON_WORKER

val os = System.getProperty("os.name").toLowerCase()

if (os.contains("mac") || os.contains("darwin")) {
LOG.debug("Detected MacOS implementation for os.name value $os")
LOG.debug("Using workaround for BigSur SystemTray error!")

SystemTray.FORCE_TRAY_TYPE = SystemTray.TrayType.Awt
}

val trayAdapter = SystemTray.get()

if (trayAdapter == null) {
Expand Down

0 comments on commit ce33254

Please sign in to comment.