Closed georgewsinger closed 4 years ago
:heavy_check_mark: xpra successfully works in Simula. I ran this on my Ubuntu 19.04 setup and it worked:
sudo apt-get install xpra
xpra start :13 & # Within GNOME
# Launch Simula
DISPLAY=:2 xpra attach :13 # Within GNOME or Simula
DISPLAY=:13 firefox # Within GNOME or Simula
# To ever terminate xpra run:
xpra stop # Within GNOME or Simula
Here is a video of it in action:
https://www.youtube.com/watch?v=9pZp2GbcM1U
Automating xpra on Simula launch. The question now is how can we automate this so that user's don't have to go through all of this pain every time they launch Simula? Right now when Simula users run make run
they get:
run: godot
cd addons/godot-haskell-plugin && make run ; cd -
A naive solution would be to add
run: godot
xpra stop
xpra start :13 &
cd addons/godot-haskell-plugin && make run ; cd -
DISPLAY=:2 xpra attach :13
so that when Simula launches users will always have the option of launching apps on xpra's DISPLAY=:13
. The problem with this is that (i) Makefile commands aren't run in order but in parallel (so we'd have to jam these commands in a shell function); (ii) there's no guarantee that the call to DISPLAY=:2 xpra attach :13
will happen after the XWayland server has actually started. We might have to call these commands from within Haskell.
For reference: the manual way of using xpra with Simula (that works w/o issue). I'm here assuming that (i) your primary GNOME display is :1
and (ii) when Simula launches, it puts XWayland on :2
(this is always the case on my machine).
DISPLAY=:1 xpra start :13 & # Within GNOME
# Launch Simula
DISPLAY=:2 xpra attach :13 # Within GNOME or Simula
DISPLAY=:13 firefox # Within GNOME or Simula
# To retrieve apps from Simula in GNOME run:
DISPLAY=:1 xpra attach :13
# To ever terminate xpra run:
xpra stop
Attempting to launch xpra automatically on Simula launch. I tried adjusting ready
in SimulaServer.hs
as follows:
-- SimulaServer.hs
ready :: GodotSimulaServer -> [GodotVariant] -> IO ()
ready gss _ = do
-- ..
oldDisplay <- getEnv "DISPLAY"
createProcess (shell "xpra stop") -- Terminate any old xpra sessions
createProcess (shell "xpra start :13") { new_session = True }
G.start_xwayland wlrXWayland wlrCompositorGV wlrSeatGV -- Changes our DISPLAY to :2
newDisplay <- getEnv "DISPLAY" -- Should be :2
createProcess (shell "xpra attach :13") { env = Just [("DISPLAY", newDisplay)] }
-- ...
which yield weird console warnings/errors involving opencv, cups, pulseaudio, vmware, etc:
Entering daemon mode; any further errors will be reported to:
/run/user/1000/xpra/:13.log
2019-11-01 19:34:52,169 Xpra gtk2 client version 2.4.3-r21350M 64-bit
2019-11-01 19:34:52,170 running on Linux Ubuntu 19.04 disco
2019-11-01 19:34:52,170 window manager is 'wlroots wm'
2019-11-01 19:34:52,182 Warning: failed to import opencv:
2019-11-01 19:34:52,182 No module named cv2
2019-11-01 19:34:52,182 webcam forwarding is disabled
server requested disconnect:
server shutdown
Error: printing disabled:
No module named cups
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (668)
2019-11-01 19:34:52 - [xwayland/xwm.c:792] XCB_CREATE_NOTIFY (6291457)
SimulaViewSprite Constructor called
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (6291457)
2019-11-01 19:34:52 - [xwayland/xwm.c:688] unhandled X11 property 34 (WM_COMMAND) for window 6291457
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (6291457)
2019-11-01 19:34:52 - [xwayland/xwm.c:688] unhandled X11 property 36 (WM_CLIENT_MACHINE) for window 6291457
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (6291457)
2019-11-01 19:34:52 - [xwayland/xwm.c:368] XCB_ATOM_WM_CLASS: Xpra-Audio-query Xpra-Audio-query
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (6291457)
2019-11-01 19:34:52 - [xwayland/xwm.c:688] unhandled X11 property 302 (WM_LOCALE_NAME) for window 6291457
2019-11-01 19:34:52 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (6291457)
2019-11-01 19:34:52 - [xwayland/xwm.c:456] NET_WM_PID 16626
Warning: failed to query pulseaudio using 'pactl info'
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Warning: failed to query pulseaudio using 'pactl info'
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
2019-11-01 19:34:52 - [xwayland/xwm.c:806] XCB_DESTROY_NOTIFY (6291457)
2019-11-01 19:34:52,810 GStreamer version 1.15.90 for Python 2.7.16 64-bit
2019-11-01 19:34:52,823 Warning: failed to query pulseaudio using 'pactl info'
2019-11-01 19:34:52,823 Connection failure: Connection refused
2019-11-01 19:34:52,824 pa_context_connect() failed: Connection refused
2019-11-01 19:34:52 - [xwayland/xwm.c:792] XCB_CREATE_NOTIFY (6291457)
SimulaViewSprite Constructor called
xpra at :13 has exited.
2019-11-01 19:35:17,861 failed to instantiate the dbus notification handler:
2019-11-01 19:35:17,861 org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
2019-11-01 19:35:17,862 disable notifications to avoid this warning
2019-11-01 19:35:17,912 No OpenGL_accelerate module loaded: No module named OpenGL_accelerate
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (668)
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (668)
2019-11-01 19:35:18 - [xwayland/xwm.c:792] XCB_CREATE_NOTIFY (4194307)
SimulaViewSprite Constructor called
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (4194305)
2019-11-01 19:35:18 - [xwayland/xwm.c:418] XCB_ATOM_WM_NAME: xpra
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (4194305)
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (4194307)
2019-11-01 19:35:18 - [xwayland/xwm.c:616] MOTIF_WM_HINTS (5)
2019-11-01 19:35:18 - [xwayland/xwm.c:923] XCB_PROPERTY_NOTIFY (4194307)
2019-11-01 19:35:18 - [xwayland/xwm.c:688] unhandled X11 property 341 (WM_COLORMAP_WINDOWS) for window 4194307
2019-11-01 19:35:18 - [xwayland/xwm.c:806] XCB_DESTROY_NOTIFY (4194307)
2019-11-01 19:35:18,053 Error: gtkgl rendering failed its sanity checks:
2019-11-01 19:35:18,053 vendor 'VMware, Inc.' is blacklisted!
2019-11-01 19:35:18 - [xwayland/xwm.c:792] XCB_CREATE_NOTIFY (4194362)
SimulaViewSprite Constructor called
2019-11-01 19:35:18,061 OpenGL accelerated rendering is not available:
2019-11-01 19:35:18,061 vendor 'VMware, Inc.' is blacklisted!
2019-11-01 19:35:18 - [xwayland/xwm.c:792] XCB_CREATE_NOTIFY (4194366)
2019-11-01 19:35:18,081 Error: printing disabled:
2019-11-01 19:35:18,081 No module named cups
SimulaViewSprite Constructor called
xpra initialization error:
cannot find live server for display :13
as well as the following behavior:
xpra
works on launch seems to be indeterministic: sometimes xpra
works and sometimes it doesn't (so far it seems to work every other time).xpra
(e.g., DISPLAY=:13 firefox
), there is a 5+ second delay for the app to be received by Simula (compared to instantenous app launching when not using xpra
).xterm
to Simula (e.g., DISPLAY=:13 xterm
), xterm
is black instead of white, and launches with the following popup errors: (i) "Xpra OpenGL Acceleratoin Failure: vendor VMWare is blacklisted"; (ii) "DPI Issue". Main question now: why would xpra work when launched manually within Simula but not automatically from Haskell calls?
Problem: When Simula dies, it takes all of its apps down with it. It would be nice to find a way to (i) prevent Simula crashes from taking apps down with it and/or (ii) moving (or even mirroring) running apps from Simula to the user's host window manager.
xmove. xmove is a "computer program that allows the movement of X Window System applications between different displays and the persistence of X applications across X server restarts". The problem with xmove is that I can't find it in Ubuntu's package manager, and it doesn't look like it's been updated since 1997.
xpra. xpra offers similar functionality as xmove:
Using xpra.
Host machine.
Remote machine. The "remote" machine can be same as the host machine (and in Simula's case this should be true).
The problem is that we need to send apps to
DISPLAY=:2
for them to run in Simula's XWayland. Perhaps launching a terminal within Simulaand then, within that terminal, launching an app via
xpra
will do the trick?