Plot window appears in background

I am already pretty happy with InspectDR. Can be tuned to be beautiful. One more question:

If I run the following script once all works fine:

using Plots; inspectdr()
InspectDR.defaults.xaxiscontrol_visible = false

x = 0:0.05:100
y = sin.(x)

p1 = plot(x, y, width=2, xtickfontsize=12, ytickfontsize=12, legendfontsize=12, legend=false)
pIDR = display(p1)           # Display with InspectDR and keep plot object
resize!(pIDR.wnd, 1200, 700) # Resize GTK window directly

But if I run it a second time with the command:


the window pops up in the background.

Is there anything I can do about it?

I use Ubuntu 18.04 (I believe you use the same). I have never seen that behaviour of windows popping up in the background.

That said, I have used Linux installations that popped up pretty much ALL new windows of an application in the background. I am unsure what setting causes Linux to do this (maybe it is a Gtk thing?).


Since InspectDR is Gtk-based, you can try forcing the new window to the foreground using:

Gtk.present(pIDR.wnd) #Move window to foreground.
1 Like

I tried your suggestion, but it doesn’t work. Is there a way to translate this call to Julia:

gtk_window_set_keep_above(GTK_WINDOW(window), TRUE) brings the window on top, but without focus.

By the way, I am using both Ubuntu 18.04 and 20.04.

And perhaps the problem is that it appears minimized?

From the description of this call in the gtk docu:

“Asks to keep window above, so that it stays on top. Note that you shouldn’t assume the window is definitely above afterward, because other entities (e.g. the user or [window manager][gtk-X11-arch]) could not keep it above, and not all window managers support keeping windows above.”

And the call itself should be a reasonable simple ccall like you find in gtk.jl/src/windows.jl

I personally would investigate this problem first myself. Seems to me like something is wrong with your environment – causing strange behaviours with Gtk.

That function does not appear to be ported over to the Gtk.jl package. Like @lobingera suggested, you would have to wrap the C-call it yourself if you want that functionality.

Though I’m pretty certain you should be looking into your Linux window manager (and/or Gtk installation). Looks like your problem resides there somewhere.

I can verify that the window appears on top as it should in Ubuntu 20.04 (lightdm&gnome) and Julia 1.7.2. I assume none of the other windows are set ‘always on top’?