Force headless mode if "--tui" is passed
authorNiki Roo <roo.niki@gmail.com>
Fri, 25 Mar 2016 14:08:35 +0000 (15:08 +0100)
committerNiki Roo <roo.niki@gmail.com>
Fri, 25 Mar 2016 14:08:35 +0000 (15:08 +0100)
(so we can generate image even if we have a DISPLAY env var and no X11)

src/be/nikiroo/jvcard/launcher/Main.java

index 5fea28d7530748890d88a0eb32e50809487e779e..178dff106d11394fa0b08bf7fb754134caf5a52f 100644 (file)
@@ -167,6 +167,12 @@ public class Main {
                                files.addAll(open(arg));
                        }
                }
+               
+               // Force headless mode if we run in forced-text mode
+               if (textMode != null && textMode) {
+                       // same as -Djava.awt.headless=true
+                       System.setProperty("java.awt.headless", "true");
+               }
 
                if (unicode) {
                        utf8();