From 7e41e6ea0f275a0e7efb8fec75525c8c31b130e5 Mon Sep 17 00:00:00 2001 From: Dramelac Date: Sun, 25 Feb 2024 17:39:25 +0100 Subject: [PATCH] Update info text + default to X11 --- exegol/config/EnvInfo.py | 5 +++-- exegol/console/TUI.py | 4 ++-- exegol/model/ContainerConfig.py | 7 ++++--- exegol/utils/GuiUtils.py | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/exegol/config/EnvInfo.py b/exegol/config/EnvInfo.py index 7d2c5db7..774ca098 100644 --- a/exegol/config/EnvInfo.py +++ b/exegol/config/EnvInfo.py @@ -118,14 +118,15 @@ def getHostOs(cls) -> HostOs: def getDisplayServer(cls) -> DisplayServer: """Returns the display server Can be 'X11' or 'Wayland'""" - session_type = os.getenv("XDG_SESSION_TYPE", "") + session_type = os.getenv("XDG_SESSION_TYPE", "x11") if session_type == "wayland": return cls.DisplayServer.WAYLAND elif session_type == "x11": return cls.DisplayServer.X11 else: # Should return an error - return session_type + logger.warning(f"Unknown session type {session_type}. Using X11 as fallback.") + return cls.DisplayServer.X11 @classmethod def getWindowsRelease(cls) -> str: diff --git a/exegol/console/TUI.py b/exegol/console/TUI.py index e977571f..893d4cbe 100644 --- a/exegol/console/TUI.py +++ b/exegol/console/TUI.py @@ -451,10 +451,10 @@ def __buildContainerRecapTable(container: ExegolContainerTemplate): recap.add_row("[bold blue]Comment[/bold blue]", comment) if passwd: recap.add_row(f"[bold blue]Credentials[/bold blue]", f"[deep_sky_blue3]{container.config.getUsername()}[/deep_sky_blue3] : [deep_sky_blue3]{passwd}[/deep_sky_blue3]") - recap.add_row("[bold blue]Desktop[/bold blue]", container.config.getDesktopConfig()) + recap.add_row("[bold blue]Remote Desktop[/bold blue]", container.config.getDesktopConfig()) if creation_date: recap.add_row("[bold blue]Creation date[/bold blue]", creation_date) - recap.add_row("[bold blue]GUI[/bold blue]", boolFormatter(container.config.isGUIEnable()) + container.config.getTextGuiSockets()) + recap.add_row("[bold blue]Console GUI[/bold blue]", boolFormatter(container.config.isGUIEnable()) + container.config.getTextGuiSockets()) recap.add_row("[bold blue]Network[/bold blue]", container.config.getTextNetworkMode()) recap.add_row("[bold blue]Timezone[/bold blue]", boolFormatter(container.config.isTimezoneShared())) recap.add_row("[bold blue]Exegol resources[/bold blue]", boolFormatter(container.config.isExegolResourcesEnable()) + diff --git a/exegol/model/ContainerConfig.py b/exegol/model/ContainerConfig.py index d1e3cab4..1987f989 100644 --- a/exegol/model/ContainerConfig.py +++ b/exegol/model/ContainerConfig.py @@ -372,8 +372,9 @@ def enableGUI(self): x11_enable = False wayland_enable = False try: - host_path = GuiUtils.getX11SocketPath() + host_path: Optional[Union[Path, str]] = GuiUtils.getX11SocketPath() if host_path is not None: + assert type(host_path) is str self.addVolume(host_path, GuiUtils.default_x11_path, must_exist=True) self.addEnv("DISPLAY", GuiUtils.getDisplayEnv()) self.__gui_engine.append("X11") @@ -1312,9 +1313,9 @@ def getTextFeatures(self, verbose: bool = False) -> str: if verbose or self.__privileged: result += f"{getColor(not self.__privileged)[0]}Privileged: {'On :fire:' if self.__privileged else '[green]Off :heavy_check_mark:[/green]'}{getColor(not self.__privileged)[1]}{os.linesep}" if verbose or self.isDesktopEnabled(): - result += f"{getColor(self.isDesktopEnabled())[0]}Desktop: {self.getDesktopConfig()}{getColor(self.isDesktopEnabled())[1]}{os.linesep}" + result += f"{getColor(self.isDesktopEnabled())[0]}Remote Desktop: {self.getDesktopConfig()}{getColor(self.isDesktopEnabled())[1]}{os.linesep}" if verbose or not self.__enable_gui: - result += f"{getColor(self.__enable_gui)[0]}GUI: {boolFormatter(self.__enable_gui)}{getColor(self.__enable_gui)[1]}{os.linesep}" + result += f"{getColor(self.__enable_gui)[0]}Console GUI: {boolFormatter(self.__enable_gui)}{getColor(self.__enable_gui)[1]}{os.linesep}" if verbose or not self.__network_host: result += f"[green]Network mode: [/green]{self.getTextNetworkMode()}{os.linesep}" if self.__vpn_path is not None: diff --git a/exegol/utils/GuiUtils.py b/exegol/utils/GuiUtils.py index 37856fcb..f6f8d194 100644 --- a/exegol/utils/GuiUtils.py +++ b/exegol/utils/GuiUtils.py @@ -68,7 +68,7 @@ def getWaylandSocketPath(cls) -> Optional[Path]: wayland_socket = os.getenv("WAYLAND_DISPLAY") if wayland_dir is None or wayland_socket is None: return None - return Path(wayland_dir + os.sep + wayland_socket) + return Path(wayland_dir, wayland_socket) @classmethod def getDisplayEnv(cls) -> str: