diff --git a/lightcrafts/src/main/java/com/lightcrafts/app/Application.java b/lightcrafts/src/main/java/com/lightcrafts/app/Application.java index 3cf8e185..58c0af8e 100644 --- a/lightcrafts/src/main/java/com/lightcrafts/app/Application.java +++ b/lightcrafts/src/main/java/com/lightcrafts/app/Application.java @@ -174,8 +174,19 @@ public static void openFrom(File file, OtherApplication otherApp) { public static void reOpen(ComboFrame frame) { if (frame == null) { + // macOS dock-icon reopen: focus most-recently-active frame instead of spawning a duplicate. + ComboFrame existing = getActiveFrame(); + if (existing != null) { + if (existing.getState() == Frame.ICONIFIED) { + existing.setState(Frame.NORMAL); + } + existing.setVisible(true); + existing.toFront(); + existing.requestFocus(); + return; + } openEmpty(); - return; + return; } Document doc = frame.getDocument(); File file = doc.getFile(); diff --git a/lightcrafts/src/main/java/com/lightcrafts/ui/LightZoneSkin.java b/lightcrafts/src/main/java/com/lightcrafts/ui/LightZoneSkin.java index ab2744fd..39b3ac49 100644 --- a/lightcrafts/src/main/java/com/lightcrafts/ui/LightZoneSkin.java +++ b/lightcrafts/src/main/java/com/lightcrafts/ui/LightZoneSkin.java @@ -69,9 +69,9 @@ private static Color relight(Color color, float amount) { } public static class LightZoneFontSet { - // cf. https://www.formdev.com/flatlaf/typography/#available - public static final FontUIResource TitleFont = new FontUIResource(UIManager.getFont("small.font")); - public static final FontUIResource SmallFont = new FontUIResource(UIManager.getFont("small.font")); + // FlatLaf "small.font" key is not present in every theme variant; hardcode to avoid NPE. + public static final FontUIResource TitleFont = new FontUIResource(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); + public static final FontUIResource SmallFont = new FontUIResource(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); } public static Border getImageBorder() { diff --git a/macosx/build.gradle.kts b/macosx/build.gradle.kts index 61d518d4..446b875d 100644 --- a/macosx/build.gradle.kts +++ b/macosx/build.gradle.kts @@ -12,6 +12,10 @@ dependencies { } application { mainClass.set("com.lightcrafts.platform.macosx.MacOSXLauncher") + applicationDefaultJvmArgs = applicationDefaultJvmArgs + listOf( + "-Xdock:name=LightZone", + "-Dapple.awt.application.name=LightZone", + ) } tasks { build { @@ -86,6 +90,7 @@ runtime { "-Djava.library.path=\$APPDIR", "-Dfile.encoding=utf-8", "-Xdock:name=LightZone", + "-Dapple.awt.application.name=LightZone", ) } }