Hi all.
I have written a module to process some data. Depending on the computer where it is running I would like to use different files for the plotting. If we are using a normal computer with a screen I would like to use “vizGL.jl” that runs with GLMakie. In the case he computer is headless I want to call “vizCairo.jl”.
I tried this:
module DASVader
include("headless2.jl")
if has_graphical_display() == true
include("vizGL.jl")
@info "Working on graphical mode"
else
include("vizCairo.jl")
@info "Working on headless mode"
end
include("tandf.jl")
include("wmatrix.jl")
include("filemanagement.jl")
include("xandw.jl")
include("detectiontools.jl")
include("Findpeaks.jl")
include("myspectogram.jl")
include("myspectra.jl")
include("datasrc.jl")
include("interface.jl")
end
But it does not work :(.
headless2.jl is like this:
function env_has_display()
if Sys.islinux()
return !isempty(get(ENV, "DISPLAY", "")) || !isempty(get(ENV, "WAYLAND_DISPLAY", ""))
elseif Sys.iswindows() || Sys.isapple()
return true # Assume GUI unless proven otherwise
else
return false
end
end
function glmakie_screen_available()
try
@eval using GLMakie # Delay loading to avoid errors
s = GLMakie.Screen()
close(s)
return true
catch
return false
end
end
function has_graphical_display()
env_has_display() && glmakie_screen_available()
end
export has_graphical_display, glmakie_screen_available, env_has_display
Any idea?