Skip to content

Commit c35c0e3

Browse files
committed
fix electron disp on new Bonito
1 parent a0879e6 commit c35c0e3

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

NetworkDynamicsInspector/ext/NetworkDynamicsInspectorElectronExt.jl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function NDI.close_display(::NDI.ElectronDisp; strict)
2626
end
2727

2828
function get_electron_display()
29+
app = NDI.get_electron_app()
2930
window = NDI.get_electron_window()
3031
# BUG: Electron display cannot be reused
3132
# if isnothing(ELECTRON_DISP[]) || window != ELECTRON_DISP[].window
@@ -34,7 +35,10 @@ function get_electron_display()
3435
# else
3536
# ELECTRON_DISP[]
3637
# end
37-
return HTTPServer.ElectronDisplay(window, HTTPServer.BrowserDisplay(; open_browser=false))
38+
return HTTPServer.ElectronDisplay(
39+
HTTPServer.EWindow(app, window),
40+
HTTPServer.BrowserDisplay(; open_browser=false)
41+
)
3842
end
3943

4044
function NDI.get_electron_window()
@@ -58,14 +62,20 @@ haswindow() = hasapp() && !isempty(windows(ELECTRON_APP[]))
5862

5963
function NDI.get_electron_app()
6064
if !hasapp()
61-
ELECTRON_APP[] = Electron.Application(;
62-
additional_electron_args=[
63-
"--disable-logging",
64-
"--no-sandbox",
65-
"--user-data-dir=$(mktempdir())",
66-
"--disable-features=AccessibilityObjectModel",
67-
],
68-
)
65+
additional_electron_args = [
66+
"--disable-logging",
67+
"--no-sandbox",
68+
"--user-data-dir=$(mktempdir())",
69+
"--disable-features=AccessibilityObjectModel",
70+
"--enable-unsafe-swiftshader", # ← allow SwiftShader fallback
71+
]
72+
if haskey(ENV, "GITHUB_ACTIONS")
73+
append!(additional_electron_args, [
74+
"--use-gl=swiftshader", # ← explicitly request software GL
75+
"--disable-gpu", # ← disable GPU to avoid GPU errors
76+
])
77+
end
78+
ELECTRON_APP[] = Electron.Application(; additional_electron_args)
6979
end
7080
ELECTRON_APP[]
7181
end

0 commit comments

Comments
 (0)