# Redirect of mathematica graphics output to another computer screen

I need send the result of my calculation to the screen connected to HDMI output as a full-screen image. As I understand, I need change the DisplayFunction to usage of certain OutputStream. Do anybody help me with creation of proper DisplayFunction? Which parameters are needed?

Now I use DisplayFunction->CreateDialog and manually move the window to second screen, but it is evidently stupid way.. I need more or less precise alignment of an image at the HDMI-screen, which is normally reproducible each time..

Could anybody show me right way for creation of the true redirection of graphics output?

-

(This answer doesn't include how to make it fullscreen, I can't manage to get any window at all to fullscreen without going through my window manager)

With DisplayFunction -> (CreateDialog[#, WindowMargins -> {{1, Automatic}, {Automatic, 1}}]&) you can get it in the top left corner, however it will be on the main display. From WindowMargins:

Negative values represent edges that are off the main display monitor, but may be visible on additional monitors.

To get the right values for WindowMargins you can create a dialog, move it desired position then check the option:

dialog = CreateDialog["a dialog", WindowMargins -> {{1, Automatic}, {Automatic, 1}}]

Options[dialog, WindowMargins]
(* {WindowMargins -> {{..., Automatic}, {Automatic, ...}}} *)


But using CreateDialog each time you'll end up with tons of windows, perhaps updating the contents of one single dialog will be more manageable:

(* CreateDocument as it looks better and allows rotating of Graphics3D *)
CreateDocument[Dynamic[secondDisplay]];
showOnSecond[expr_] := (secondDisplay = expr;)

(* To put something on second display: *)
showOnSecond@Plot[x, {x, 0, 1}]

-
Try adding WindowSize -> Full –  The Toad Nov 8 '13 at 17:10
@rm-rf That makes it big, but layered below task panel and it still has the top close/expand button row. So more like maximized, perhaps that counts :) –  ssch Nov 8 '13 at 17:14
Hmm... Windows/Linux? On my mac it is fullscreen (but does not have its own workspace). –  The Toad Nov 8 '13 at 17:19
@rm-rf Linux, seems to be a bug in java 1.6 which is what v8.0.4 has –  ssch Nov 8 '13 at 17:20
@rm-rf Hah! WindowSize->Full works properly when I use SetOptions but not when I supply it as an argument to Create* –  ssch Nov 9 '13 at 18:16

You could use the function JWindow from the JVMTools Mathematica add-on package. It returns the JFrame object and the JPanel object, and you can further process these objects, as explained on the page JVMTools window functions (scroll down to the section "Further Processing of the Java Objects"). For example:

{frameref,panelref}=JWindow[Plot[Tan@x,{x,0,Pi}]];
tk=ToolkitgetDefaultToolkit[];
xSize=Round@tk@getScreenSize[]@getWidth[];
ySize=Round@tk@getScreenSize[]@getHeight[];
frameref@setSize[xSize,ySize];
`

creates a simple window with a Mathematica plot and then maximizes it to fullscreen.

Or you could also use the "comfort version" by using the Java fullscreen API, http://docs.oracle.com/javase/tutorial/extra/fullscreen/

And you can set the window coordinates any way you want, and if your second screen is an extension of your primary screen, you could simply launch it there by using appropriate coordinates that are off-screen for your primary display.

While we're at it, the JVMTools function JWindowSend allows you to dynamically update the contents of the window with new content generated by Mathematica (graphics, text, tables/Grids, formulae in TraditionalForm, etc.) This is useful for tasks that have Mathematica run as the data processor and graphics generator, and then use a periodically updated display on another screen, for example in financial trading applications or live weather updates.

This will always work on any hardware and o/s, because Java simply runs on any hardware and o/s, so you're avoiding the o/s-dependence discussed above in the comments. And JVMTools allows you to specify any JVM you want, the latest as of today is J7U45, and so you're also avoiding the bug in J6 mentioned above, and you liberate yourself from the fixed JVM that ships with standard Mathematica. Always use the latest Java for everything. In fact, J7U45 is the current security baseline.

Disclosure: JVMTools is a commercial add-on for M sold by Lauschke Consulting. I am the owner of Lauschke Consulting.

-
Thanks! I prefer to use the built-in features but if it will not help me, I'll use you way! –  Rom38 Nov 9 '13 at 18:08