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 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!
...