Skip to content

Commit

Permalink
[FIX] Handle gui client for wsl
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannSab committed Sep 3, 2024
1 parent 85cb9e1 commit c0617ed
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/seahorse/utils/gui_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ def open_file(url):
os.startfile(url)
except AttributeError:
try:
if platform.system() == "Linux":
subprocess.check_call(["xdg-open", url])
elif platform.system() == "Darwin":
system = platform.system()
if system == "Linux":
# Handle WSL specifically
if "microsoft" in platform.uname().release.lower():
subprocess.check_call(["wslview", url])
else:
subprocess.check_call(["xdg-open", url])
elif system == "Darwin":
subprocess.check_call(["open", url])
else:
msg = "Unexpected platform"
raise Exception(msg)
except Exception:
logger.debug("Could not open URL")
except Exception as e:
logger.debug(f"Could not open URL: {e}")

async def listen(self,**_) -> Coroutine[Any, Any, None]:
if self.path:
Expand Down

0 comments on commit c0617ed

Please sign in to comment.