mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
15 lines
590 B
Python
15 lines
590 B
Python
import logging
|
|
import subprocess
|
|
|
|
logger = logging.getLogger()
|
|
|
|
|
|
def launch_url(url):
|
|
if subprocess.run(['which', 'xdg-open'], capture_output=True).returncode == 0:
|
|
subprocess.run(['xdg-open', url]) # linux
|
|
elif subprocess.run(['which', 'open'], capture_output=True).returncode == 0:
|
|
subprocess.run(['open', url]) # macos
|
|
elif subprocess.run(['which', 'start'], capture_output=True).returncode == 0:
|
|
subprocess.run(['start', url]) # windows - need to validate this works
|
|
else:
|
|
logger.error(f"No valid launchers found to launch url: {url}") |