standalone flag
This commit is contained in:
@@ -78,6 +78,9 @@ After that, a bare `jprototerm` connects to the daemon and opens a window in the
|
|||||||
directory. If no daemon is running, `jprototerm` falls back to a standalone in-process window
|
directory. If no daemon is running, `jprototerm` falls back to a standalone in-process window
|
||||||
(today's behavior), so it always works.
|
(today's behavior), so it always works.
|
||||||
|
|
||||||
|
For development testing, use `jprototerm --standalone` to skip the daemon even when one is
|
||||||
|
running.
|
||||||
|
|
||||||
To start the daemon automatically with your graphical session, enable the bundled **user**
|
To start the daemon automatically with your graphical session, enable the bundled **user**
|
||||||
service (it's a user service, not a system one, because X11 needs a display — which only
|
service (it's a user service, not a system one, because X11 needs a display — which only
|
||||||
exists after you log in):
|
exists after you log in):
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ package com.gregor.jprototerm;
|
|||||||
* Entry point and mode dispatch. A bare invocation is a thin client: it hands the request to a
|
* Entry point and mode dispatch. A bare invocation is a thin client: it hands the request to a
|
||||||
* running {@link Daemon}, or, if none is reachable, opens a single standalone window in this process
|
* running {@link Daemon}, or, if none is reachable, opens a single standalone window in this process
|
||||||
* (today's behavior). {@code --daemon} runs the long-lived server that hosts every window in one
|
* (today's behavior). {@code --daemon} runs the long-lived server that hosts every window in one
|
||||||
* JVM, so client launches skip cold JVM/JavaFX/GL startup.
|
* JVM, so client launches skip cold JVM/JavaFX/GL startup. {@code --standalone} skips daemon client
|
||||||
|
* mode and always opens an in-process window, which is useful while testing development builds.
|
||||||
*/
|
*/
|
||||||
public final class Main {
|
public final class Main {
|
||||||
private Main() {
|
private Main() {
|
||||||
@@ -14,15 +15,19 @@ public final class Main {
|
|||||||
// Match the renderer order the app was tuned for; honor an explicit override if present.
|
// Match the renderer order the app was tuned for; honor an explicit override if present.
|
||||||
System.setProperty("prism.order", System.getProperty("prism.order", "es2,sw"));
|
System.setProperty("prism.order", System.getProperty("prism.order", "es2,sw"));
|
||||||
|
|
||||||
|
boolean standalone = false;
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
if (arg.equals("--daemon")) {
|
if (arg.equals("--daemon")) {
|
||||||
Daemon.run();
|
Daemon.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (arg.equals("--standalone")) {
|
||||||
|
standalone = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String workingDirectory = System.getProperty("user.dir");
|
String workingDirectory = System.getProperty("user.dir");
|
||||||
if (Daemon.tryClient(workingDirectory)) {
|
if (!standalone && Daemon.tryClient(workingDirectory)) {
|
||||||
return; // a running daemon opened the window
|
return; // a running daemon opened the window
|
||||||
}
|
}
|
||||||
// No daemon reachable: fall back to a standalone window; the JVM exits when it closes.
|
// No daemon reachable: fall back to a standalone window; the JVM exits when it closes.
|
||||||
|
|||||||
Reference in New Issue
Block a user