Enough with not checking we actually have a Wayland compositor around at
all: start requiring the WAYLAND_DISPLAY socket actually exists as an
absolute path or relatively under XDG_RUNTIME_DIR.
Additionally if WAYLAND_DISPLAY isn't an absolute path to the socket
(most setups) ensure XDG_RUNTIME_DIR is set and error with a typically
appropriate message.
- session = copy.copy(tools.config.session_defaults);
+ session = copy.copy(tools.config.session_defaults)
+
+ # TODO: also support WAYLAND_SOCKET?
wayland_display = session["wayland_display"]
if wayland_display == "None" or not wayland_display:
logging.warning('WAYLAND_DISPLAY is not set, defaulting to "wayland-0"')
wayland_display = session["wayland_display"]
if wayland_display == "None" or not wayland_display:
logging.warning('WAYLAND_DISPLAY is not set, defaulting to "wayland-0"')
+ wayland_display = session["wayland_display"] = "wayland-0"
+
+ if os.path.isabs(wayland_display):
+ wayland_socket_path = wayland_display
+ else:
+ xdg_runtime_dir = session["xdg_runtime_dir"]
+ if xdg_runtime_dir == "None" or not xdg_runtime_dir:
+ logging.error(f"XDG_RUNTIME_DIR is not set; please don't start a Waydroid session with 'sudo'!")
+ sys.exit(1)
+ wayland_socket_path = os.path.join(xdg_runtime_dir, wayland_display)
+ if not os.path.exists(wayland_socket_path):
+ logging.error(f"Wayland socket '{wayland_socket_path}' doesn't exist; are you running a Wayland compositor?")
+ sys.exit(1)
+
waydroid_data = session["waydroid_data"]
if not os.path.isdir(waydroid_data):
os.makedirs(waydroid_data)
waydroid_data = session["waydroid_data"]
if not os.path.isdir(waydroid_data):
os.makedirs(waydroid_data)
dpi = tools.helpers.props.host_get(args, "ro.sf.lcd_density")
if dpi == "":
dpi = os.getenv("GRID_UNIT_PX")
dpi = tools.helpers.props.host_get(args, "ro.sf.lcd_density")
if dpi == "":
dpi = os.getenv("GRID_UNIT_PX")