mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #2492 from ben-kaufman/system-tray-dark-mode-mac
Fix system tray visibility for dark mode Mac
This commit is contained in:
commit
67eed82a8a
@ -155,6 +155,21 @@ public class Utilities {
|
||||
return executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if <code>defaults read -g AppleInterfaceStyle</code> has an exit status of <code>0</code> (i.e. _not_ returning "key not found").
|
||||
*/
|
||||
public static boolean isMacMenuBarDarkMode() {
|
||||
try {
|
||||
// check for exit status only. Once there are more modes than "dark" and "default", we might need to analyze string contents..
|
||||
final Process process = Runtime.getRuntime().exec(new String[] {"defaults", "read", "-g", "AppleInterfaceStyle"});
|
||||
process.waitFor(100, TimeUnit.MILLISECONDS);
|
||||
return process.exitValue() == 0;
|
||||
} catch (IOException | InterruptedException | IllegalThreadStateException ex) {
|
||||
// IllegalThreadStateException thrown by proc.exitValue(), if process didn't terminate
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isUnix() {
|
||||
return isOSX() || isLinux() || getOSName().contains("freebsd");
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public class SystemTray {
|
||||
|
||||
private static final String ICON_HI_RES = "/images/system_tray_icon@2x.png";
|
||||
private static final String ICON_LO_RES = "/images/system_tray_icon.png";
|
||||
private static final String ICON_HI_RES_WHITE = "/images/system_tray_icon@2x_white.png";
|
||||
private static final String ICON_LO_RES_WHITE = "/images/system_tray_icon_white.png";
|
||||
private static final String ICON_WINDOWS_LO_RES = "/images/system_tray_icon_windows.png";
|
||||
private static final String ICON_WINDOWS_HI_RES = "/images/system_tray_icon_windows@2x.png";
|
||||
private static final String ICON_LINUX = "/images/system_tray_icon_linux.png";
|
||||
@ -97,7 +99,11 @@ public class SystemTray {
|
||||
|
||||
String path;
|
||||
if (Utilities.isOSX())
|
||||
path = ImageUtil.isRetina() ? ICON_HI_RES : ICON_LO_RES;
|
||||
if (Utilities.isMacMenuBarDarkMode())
|
||||
path = ImageUtil.isRetina() ? ICON_HI_RES_WHITE : ICON_LO_RES_WHITE;
|
||||
else
|
||||
path = ImageUtil.isRetina() ? ICON_HI_RES : ICON_LO_RES;
|
||||
|
||||
else if (Utilities.isWindows())
|
||||
path = ImageUtil.isRetina() ? ICON_WINDOWS_HI_RES : ICON_WINDOWS_LO_RES;
|
||||
else
|
||||
|
BIN
desktop/src/main/resources/images/system_tray_icon@2x_white.png
Normal file
BIN
desktop/src/main/resources/images/system_tray_icon@2x_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
desktop/src/main/resources/images/system_tray_icon_white.png
Normal file
BIN
desktop/src/main/resources/images/system_tray_icon_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user