MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.34k stars 292 forks source link

When a window is first created, should it appear in front of all other windows? #3768

Open kbarros opened 3 months ago

kbarros commented 3 months ago

New Makie users can sometimes be confused that their plotting commands go to a window that is hidden behind their Julia terminal or IDE. To resolve this confusion, should newly created windows appear in the front?

Of course, the terminal should not lose focus for each new plotting event. Therefore, if a Makie window already exists, it's depth (relative to other windows) should not be changed on replotting events. That's OK, because users can move an existing Makie window to a part of the screen where it will not be hidden by other windows. For this to work most effectively, the size of windows should be persistent through plotting events: https://github.com/MakieOrg/Makie.jl/issues/3767.

jkrumbiegel commented 3 months ago

I think there's a screen option called focus on show or so, that should lead to the behavior you want when enabled. That's different than the floating window that always stays on top.

kbarros commented 3 months ago

Thanks. I tried it:

GLMakie.activate!(; focus_on_show=true)

scatter((1:10).^2) # jumps to front, as requested

# << user moves window to the side >>

scatter((1:10).^2) # jumps to front again, and Julia terminal loses focus

Should the "focus" in the second scatter be disabled? My thinking is that there is an existing window that is being reused, and already has a depth.

With that behavior fixed, would it make sense for focus_on_show=true to become the default? My thinking is to help new Makie users get a signal that a new window has actually been created.

jkrumbiegel commented 3 months ago

Hm yeah it probably shouldn't jump if it reused a window. I wonder why it does actually. And it does seem to be a better default to have it come forward.