Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify open #4642

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/backends/web.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,19 @@ embeddable_html(plt::AbstractPlot) = html_head(plt) * html_body(plt)
function open_browser_window(filename::AbstractString)
@static if Sys.isapple()
return run(`open $(filename)`)
end
@static if Sys.islinux() || Sys.isbsd() # Sys.isbsd() addition is as yet untested, but based on suggestion in https://github.com/JuliaPlots/Plots.jl/issues/681
elseif Sys.islinux() || Sys.isbsd() # Sys.isbsd() addition is as yet untested, but based on suggestion in https://github.com/JuliaPlots/Plots.jl/issues/681
return run(`xdg-open $(filename)`)
end
@static if Sys.iswindows()
elseif Sys.iswindows()
return run(`$(ENV["COMSPEC"]) /c start "" "$(filename)"`)
else
@warn "Unknown OS... cannot open browser window."
end
@warn "Unknown OS... cannot open browser window."
end

function write_temp_html(plt::AbstractPlot)
html = standalone_html(plt; title = plt.attr[:window_title])
filename = string(tempname(), ".html")
output = open(filename, "w")
write(output, html)
close(output)
write(filename, html)
BeastyBlacksmith marked this conversation as resolved.
Show resolved Hide resolved
filename
end

Expand Down