Skip to content

Commit add4ed8

Browse files
committed
Hide splash screen asap if not using gui
Fixes arduino#1970 On macOS, when running, Arduino.app/Contents/MacOS/Arduino --upload sketch.ino a splash screen is visible the entire time the upload is running. This PR hides that splash screen as soon as it’s known for sure that the GUI should not be displayed. This makes for a slightly better user experience: there’s still a splash screen, but it only appears briefly at launch time. The [SplashScreen docs][] explain: > The splash screen can be displayed at application startup, before the > Java Virtual Machine (JVM) starts. ... is closed automatically as soon as > the first window is displayed by Swing/AWT (may be also closed manually > using the Java API, see below) [SplashScreen docs]: https://docs.oracle.com/javase/7/docs/api/java/awt/SplashScreen.html
1 parent a144887 commit add4ed8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: app/src/processing/app/Base.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ public Base(String[] args) throws Exception {
208208

209209
BaseNoGui.initPortableFolder();
210210
// This configure the logs root folder
211-
System.out.println("Set log4j store directory " + BaseNoGui.getSettingsFolder().getAbsolutePath());
212211
System.setProperty("log4j.dir", BaseNoGui.getSettingsFolder().getAbsolutePath());
213212

214213
// Look for a possible "--preferences-file" parameter and load preferences
@@ -218,6 +217,17 @@ public Base(String[] args) throws Exception {
218217
parser.parseArgumentsPhase1();
219218
commandLine = !parser.isGuiMode();
220219

220+
if (!parser.isGuiMode()) {
221+
try {
222+
// This can return null or raise an exception
223+
SplashScreen s = SplashScreen.getSplashScreen();
224+
if (s != null) {
225+
s.close();
226+
}
227+
} catch (UnsupportedOperationException e) {
228+
}
229+
}
230+
221231
BaseNoGui.checkInstallationFolder();
222232

223233
// If no path is set, get the default sketchbook folder for this platform

0 commit comments

Comments
 (0)