closed Popup icon disrupts GUI use by grabbing keyboard/window focus

+1 vote
asked Jan 25, 2017 in Wanted features by vanrein (140 points)
closed Jan 25, 2017 by vanrein
The popups that display the PlantUML logo are disruptive because they grab window / keyboard focus.  Running a long sequence of individual [0] rendering commands is therefore constantly disrupted, and the user cannot continue other work with the rendering going on in the background.  I suppression flag would be pleasant to resolve that.

[0] The reason for not rendering all at once is that PlantUML cannot render multiple formats at the same time, as in -tpng -tsvg which would probably be optimal from a rendering time savings perspective.  So I ended up doing things like https://github.com/arpa2/identityhub-design/blob/9a8e88fb0d942539fa07e506a525e3bd23851d66/Makefile

IMHO, a commandline utility should never grab the GUI anyway... but that is just an opinion.  In general, PlantUML is much more pleasant to work with than any of the graphical tools I tried!  It's just this disruption of ongoing work that is, well, disrupting the pleasure of using it.
closed with the note: sufficiently answered

1 Answer

0 votes
answered Jan 25, 2017 by plantuml (295,000 points)
You can use something like

java -splash:no -jar plantuml.jar -version

to disable logo print.
(see http://plantuml.sourceforge.net/qa/?qa=3822/splash-screen-when-running )

Tell us if it's not working for you.

We should put a FAQ on this I guess, and add it in the -help print.
commented Jan 25, 2017 by vanrein (140 points)
Thanks.  This doesn't work on Mac OS X, Java keeps grabbing focus unless indeed for -version.  Your answer is clear though -- this is a Java issue, not necessarily one of PlantUML.
commented Jan 25, 2017 by plantuml (295,000 points)
If you unzip plantuml.jar file using a regular zip extractor, you can also edit the file META-INF/MANIFEST.MF and simply remove the line starting with SplashScreen-Image
Unfortunatly, since the splash screen is displayed before launching plantuml, we have very limited option here.
commented Jan 25, 2017 by vanrein (140 points)
Thanks for being so interactive!

Unfortunately, this isn't doing it either.  So be it.  It's a modest disadvantage for an otherwise highly useful tool, and anything is better than the drag of a GUI-based tool.

My reason for reporting was that I thought it might help improving the tool.

Thanks!
 -Rick
commented Feb 24, 2017 by eduncan911 (100 points)
I have to agree with the OP completely: this is EXTREMELY annoying and it has kept me and many others on my team from using PlantUML.  Today I got fed up and searched for some solutions (see below).

For tools that try to automate this, it's a major slow down and annoyance that grabs the input, shifts fullscreen, etc.

This IS a bug / must be addressed and not ignored.  

For homebrew, we can't modify the manifest file: it gets overwritten on the next upgrade.  For Atom and VSCode and other editors, we can't pass -splash:no on command line because of the way their options are setup for the plugins for plantuml.

There are multiple options here PlantUML can do to limit this extreme annoyance:

1) provide two plantuml.jar files: one with and without the MANIFEST entry.  

2) provide something like a "--without-splash" command-line switch for Homebrew that can either A) extract the zip, modify the MANIFEST file to remove the splash like, rezip the jav and continue installing it.  or B) download the alternative plantuml.jar noted in #1.

(this assumes that y'all are the maintainers of the Homebrew installation of PlantUML?  If not, let me know and I'll hunt them down to implement this hack.)

3) Just remove the splash image from manifest and be done with it.  we know what we are using and don't need a 2 second delay in running command line utils.
commented Feb 24, 2017 by plantuml (295,000 points)
The splash screen will be removed in next release.
In the meantime, you can use the last beta that does not have any splash screen
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
commented Feb 24, 2017 by eduncan911 (100 points)
Thank you for the quick reply!

I already just edited the Manifest file and removed it.

But (there's always a but, right?)...  It still focuses the main view/changes fullscreen in OSX when executing without the -version flag set.

On my macOS system, the problem with with setting "-version" is that plantuml does not generate the file.  This is what I get to stdout:

$ /usr/bin/java -jar /usr/local/share/plantuml.jar -version -charset utf8 -tsvg -graphvizdot /usr/local/bin/dot -output . test.pu

PlantUML version 8037 (Sun Mar 06 09:18:49 EST 2016)
(GPL source distribution)
Java(TM) SE Runtime Environment
Java HotSpot(TM) 64-Bit Server VM
1.8.0_121-b13
Mac OS X

The environment variable GRAPHVIZ_DOT has been set to /usr/local/bin/dot
Dot executable is /usr/local/bin/dot
Dot version: dot - graphviz version 2.40.1 (20161225.0304)
Installation seems OK. File generation OK

And no file is created!  

if I remove the -version flag, I get the file located in the same directory.  But... The Focus issue comes back!

Is there a bug with the -version flag being passed in that prevents it from running?

Maybe the -output flag isn't being honored, and is putting the test.svg somewhere else?
commented Feb 24, 2017 by plantuml (295,000 points)
I *think* the focus issue is now related to the fact that PlantUML has to access to some graphical ressource of your Mac.
(Basically because we are doing font size computation, so even with SVG generation)

And we do not access to graphical ressources with -version flag, so that's probably why the focus issue does not occur here.
(See Run.java file)

Maybe you can try to add -Djava.awt.headless=true in your command line to see if it changes something ?
(see http://plantuml.sourceforge.net/qa/?qa=3399/problem-with-x11-and-headless-exception )

Keep us informed : this one may be difficult to solve.
commented Feb 24, 2017 by eduncan911 (100 points)
IT WORKED!!!!!!!!!!!!  Man, I've been searching for exactly something like that off and on for over a year!!!!!!!!

$ /usr/bin/java -Djava.awt.headless=true -jar /usr/local/share/plantuml.jar -charset utf8 -tsvg -nbthread auto -graphvizdot /usr/local/bin/dot -output . test.pu

Generated the file "test.svg"!!!!!!!!

I also edited my PlantUML-Preview plugin for Atom, using "-Djava.awt.headless=true" as the additional Java option - and it fixed the focus issue as well!!!!!!!

PERFECT!

So yeah.. this belongs in the FAQs.  :)  

Thank you again!

(well, until Java deprecates that "-Djava.awt.headless=true" option or something... :) )
commented Feb 25, 2017 by plantuml (295,000 points)
We will add an entry in our FAQ about this java.awt.headless and focus grabbing. To be honest, the exact meaning and consequences of this setting is not very clear to us.

BTW, we've noticed that your are using GraphViz 2.40. Unfortunately there are some issue with this version, so if you can, you should downgrade to 2.38

Regards,
commented Feb 26, 2017 by eduncan911 (100 points)
edited Feb 26, 2017 by eduncan911
Thank you again for the fix!  In retrospective, removing the logo doesn't fix it - so it can be put back into the MANIFEST for those that use your jar in GUI apps.  As a matter of fact, I recommend putting it back into the MANIFEST as a branding of your logo and hard work.

The exact consequences are lost of focus, grabbing keyboard input, and changing Virtual Desktops of full screen apps for developers using IDEs such as Atom, VSCode, Sublime and many others.  It is a very jarring experience, especially on OSX (macOS).

On OSX specifically, you can "Fullscreen" the application which creates kind of a new "virtual desktop" that you can switch between Desktop and the FullScreen app.  I tend to run 5 or 6 apps as fullscreen, and "swipe" between them during development.  I took a quick snapshot this morning showing you my virtual desktops on macOS:

[Imgur](http://i.imgur.com/cH9cv6W.png)
(you can see me creating some diagrams in the 3rd virtual desktop)

The plugins that use plantuml tend to use it as a Preview page: to where "Saving" a test.puml diagram will "generate" a Preview of the diagram on the fly, allowing for fast iteration.  Here, have a look:

[Imgur](http://i.imgur.com/nBZOKlX.png)
(that's a fullscreen pic btw, no titlebar/menubar, etc)

The problem with Java grabbing input/focus when running plantuml is that it completely changes the screen to the Desktop.  Making me having to "swipe back, 2/3/4 virtual desktops away to get back to where I was!  

To say this is annoying is an understatement.  If you were using one app, and another app completely changes your desktop to a different screen, takes away from your keyboard input and forces you to stop what you are doing, and get back to the application you were working in, wouldn't that hinder your productivity?  :)

Hopefully that helps explain the issues with Java (iow, plantuml.jar) grabbing input focus.
commented Feb 27, 2017 by plantuml (295,000 points)
Thanks for the explanation : it very clear!

We won't reintroduce the logo by default, because we realize now that this may have some other unknown impacts on some platforms.

Honestly, when we have added the logo in the Manifest, we were focusing on the GUI only, and did not realize that this will also have a impact on scripts.
Displaying the logo alone is not very useful and we think now that it's too risky.

So after some brainstorming session, we decide to enhance this splashscreen feature.
We have added two new option flags in last beta:
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

-splash
This flag prints a splash screen with a progress bar: this could be useful when diagrams generation take times.
The splash also displays a message when a diagram contains an error.
In the future, we could put other messages in this splashscreen (suggestions welcome!)
(You can also set the splashscreen within the ANT task)

-progress
This flag prints a textual progress bar in the console

Since those options are not activated by default, people can choose depending on their needs.

Thanks again!
...