-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlaunch.py
More file actions
48 lines (41 loc) · 1.35 KB
/
launch.py
File metadata and controls
48 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
LUMA Launcher - Opens LUMA in a new terminal window.
"""
import subprocess
import sys
import os
from pathlib import Path
def launch():
"""Launch LUMA in a new terminal window."""
luma_dir = Path(__file__).parent
main_py = luma_dir / "main.py"
if sys.platform == 'win32':
# Windows: Open new cmd window
subprocess.Popen(
f'start "LUMA" cmd /k "cd /d {luma_dir} && uv run python main.py"',
shell=True
)
elif sys.platform == 'darwin':
# macOS: Open new Terminal window
script = f'''
tell application "Terminal"
do script "cd '{luma_dir}' && uv run python main.py"
activate
end tell
'''
subprocess.Popen(['osascript', '-e', script])
else:
# Linux: Try common terminal emulators
terminals = [
['gnome-terminal', '--', 'bash', '-c', f'cd "{luma_dir}" && uv run python main.py; exec bash'],
['konsole', '-e', 'bash', '-c', f'cd "{luma_dir}" && uv run python main.py; exec bash'],
['xterm', '-e', f'cd "{luma_dir}" && uv run python main.py; bash'],
]
for term in terminals:
try:
subprocess.Popen(term)
break
except FileNotFoundError:
continue
if __name__ == "__main__":
launch()