Makie app from command line

How can I launch a Makie.jl based app from the command line?

I tried:

julia --project -e "include(\"./src/KiteViewer.jl\");main()"

which shortly shows the Makie windows but then terminates. How can I
achieve that it stays open until I close the Makie window?

Full source: GitHub - ufechner7/KiteViewer: 3D viewer for airborn wind energy systems

If you need to drop into REPL, use -i in the command line. It prevents immediate close when the execution ends.

julia --project -ie "include(\"./src/KiteViewer.jl\");main()"

Is it really necessary to invoke the REPL for this? For GTK.jl, for instance, there is a good description for using that framework without using the REPL. A standalone script shouldn’t need to drop into a different context.

I haven’t used Makie.jl very much, so I don’t know whether the recipe provided by GTK can be modified usefully.

You can use similar mechanism but I don’t know if Makie exposes some function for exiting gui.

You can use:

using GLMakie
gl_screen = display(scatter(1:4));

Which will block as long as that window is open


Thanks for all the good replies!

I now use the following start script:

cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source ~/.bashrc

echo "Lauching KiteViewer..."
julia --optimize=1 --project -e "include(\"./src/KiteViewer.jl\");main(true)"

I need the second line to make sure the script also works when launched via a double click on a link to it that I have on the desktop.

Startup time is about 30s with Julia 1.6beta and optimization level one. Still some room for improvement, but good enough for now.

The main function looks like that:

function main(gl_wait=false)
    scene, layout = layoutscene(resolution = (840, 900), backgroundcolor = RGBf0(0.7, 0.8, 1))
    gl_screen = display(scene)

    if gl_wait
    return nothing

Just in case you missed it, you could compile an app for this with Apps · PackageCompiler, thus reducing time to first plot by a lot.

Yes, I could use package compiler, but for now my priority is to implement the full functionality of my program. And there is hope that also the latency without package compiler gets reduced much further: Reducing latency: acceptable strategies discussion · Issue #792 · JuliaPlots/Makie.jl · GitHub

I see no other way forward other than cloning Julius, Simon, and Tim. Imagine the possibilities!

1 Like