Skip to content

Commit

Permalink
Update info text + default to X11
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramelac committed Feb 25, 2024
1 parent fefce65 commit 7e41e6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions exegol/config/EnvInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions exegol/console/TUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()) +
Expand Down
7 changes: 4 additions & 3 deletions exegol/model/ContainerConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion exegol/utils/GuiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7e41e6e

Please sign in to comment.