tool-tray 0.3.8__py3-none-any.whl → 0.3.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tool_tray/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.8"
1
+ __version__ = "0.3.11"
2
2
 
3
3
 
4
4
  def main() -> None:
tool_tray/autostart.py CHANGED
@@ -3,33 +3,25 @@ import sys
3
3
  from pathlib import Path
4
4
 
5
5
 
6
- def _get_tooltray_path() -> str:
7
- """Get the path to tooltray executable."""
8
- try:
9
- result = subprocess.run(
10
- ["uv", "tool", "list", "--show-paths"],
11
- capture_output=True,
12
- text=True,
13
- check=True,
14
- )
15
- for line in result.stdout.splitlines():
16
- if line.startswith("- tooltray ") or line.startswith("- tool-tray "):
17
- start = line.find("(")
18
- end = line.find(")")
19
- if start != -1 and end != -1:
20
- return line[start + 1 : end]
21
- except subprocess.CalledProcessError:
22
- pass
23
- return "tooltray"
6
+ def _get_tooltray_path() -> str | None:
7
+ """Get the path to tooltray executable. Returns None if not found."""
8
+ import shutil
9
+
10
+ return shutil.which("tooltray")
24
11
 
25
12
 
26
13
  def _linux_autostart_enable() -> bool:
27
14
  """Add tooltray to Linux autostart."""
28
15
  from tool_tray.logging import log_error, log_info
29
16
 
17
+ exe = _get_tooltray_path()
18
+ if not exe:
19
+ log_error("Cannot enable autostart: tooltray not found in PATH")
20
+ print("Error: tooltray not found in PATH")
21
+ return False
22
+
30
23
  desktop_file = Path.home() / ".config/autostart/tooltray.desktop"
31
24
  desktop_file.parent.mkdir(parents=True, exist_ok=True)
32
- exe = _get_tooltray_path()
33
25
  try:
34
26
  desktop_file.write_text(f"""[Desktop Entry]
35
27
  Type=Application
@@ -69,19 +61,29 @@ def _macos_autostart_enable() -> bool:
69
61
 
70
62
  from tool_tray.logging import log_error, log_info
71
63
 
72
- plist = Path.home() / "Library/LaunchAgents/com.tooltray.plist"
73
- plist.parent.mkdir(parents=True, exist_ok=True)
74
-
75
- # Use sys.executable to run with same Python interpreter
76
- python_exe = sys.executable
77
-
78
- # Find uv binary path for PATH env (needed for get_installed_version)
64
+ # Find both binaries - fail fast if either missing
79
65
  uv_bin = shutil.which("uv")
66
+ tooltray_bin = shutil.which("tooltray")
67
+
80
68
  if not uv_bin:
81
69
  log_error("Cannot enable autostart: uv not found in PATH")
82
70
  print("Error: uv not found in PATH. Install uv first.")
83
71
  return False
84
- uv_dir = str(Path(uv_bin).parent)
72
+
73
+ if not tooltray_bin:
74
+ log_error("Cannot enable autostart: tooltray not found in PATH")
75
+ print("Error: tooltray not found in PATH")
76
+ return False
77
+
78
+ # Collect unique directories for PATH
79
+ path_dirs = {str(Path(uv_bin).parent), str(Path(tooltray_bin).parent)}
80
+ path_env = ":".join(sorted(path_dirs)) + ":/usr/bin:/bin"
81
+
82
+ plist = Path.home() / "Library/LaunchAgents/com.tooltray.plist"
83
+ plist.parent.mkdir(parents=True, exist_ok=True)
84
+
85
+ # Use sys.executable to run with same Python interpreter
86
+ python_exe = sys.executable
85
87
 
86
88
  log_dir = Path.home() / "Library/Logs/tooltray"
87
89
  log_dir.mkdir(parents=True, exist_ok=True)
@@ -105,7 +107,7 @@ def _macos_autostart_enable() -> bool:
105
107
  <key>EnvironmentVariables</key>
106
108
  <dict>
107
109
  <key>PATH</key>
108
- <string>{uv_dir}:/usr/bin:/bin</string>
110
+ <string>{path_env}</string>
109
111
  </dict>
110
112
  <key>StandardOutPath</key>
111
113
  <string>{log_dir}/stdout.log</string>
@@ -149,6 +151,11 @@ def _windows_autostart_enable() -> bool:
149
151
  return False
150
152
 
151
153
  exe = _get_tooltray_path()
154
+ if not exe:
155
+ log_error("Cannot enable autostart: tooltray not found in PATH")
156
+ print("Error: tooltray not found in PATH")
157
+ return False
158
+
152
159
  try:
153
160
  key = winreg.OpenKey(
154
161
  winreg.HKEY_CURRENT_USER,
tool_tray/tray.py CHANGED
@@ -371,13 +371,17 @@ def on_startup(icon: Any) -> None:
371
371
 
372
372
 
373
373
  def spawn_setup() -> None:
374
- """Spawn setup dialog as subprocess."""
375
- import sys
374
+ """Spawn setup dialog as subprocess via uv for proper Tcl/Tk paths."""
375
+ import shutil
376
376
 
377
- from tool_tray.logging import log_info
377
+ from tool_tray.logging import log_error, log_info
378
+
379
+ uv_bin = shutil.which("uv")
380
+ if not uv_bin:
381
+ log_error("Cannot spawn setup: uv not found in PATH")
382
+ return
378
383
 
379
- # Use sys.executable to run with same Python interpreter
380
- cmd = [sys.executable, "-m", "tool_tray", "setup"]
384
+ cmd = [uv_bin, "run", "tooltray", "setup"]
381
385
  log_info(f"Spawning setup subprocess: {cmd}")
382
386
  subprocess.Popen(cmd)
383
387
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tool-tray
3
- Version: 0.3.8
3
+ Version: 0.3.11
4
4
  Summary: System tray tool manager for private GitHub tools via uv
5
5
  Author: Fredrik Averpil
6
6
  Author-email: Fredrik Averpil <fredrik.averpil@gmail.com>
@@ -1,15 +1,15 @@
1
- tool_tray/__init__.py,sha256=XLe-TtIKjOmZRxc0AE6p-B57-quCUuB9oPNZBGDwcZI,10337
1
+ tool_tray/__init__.py,sha256=hP6OXemmKIStpYMsEKuQl9ms7DxnQKu98I3tmEwLCEY,10338
2
2
  tool_tray/__main__.py,sha256=kPhKj3ISnfdEj_xNeV02OyVne5R22PDUJXBrFdCdw6c,66
3
- tool_tray/autostart.py,sha256=ukgQoqvuMOtn9_toaLwMkDbDbU9aOXaIglScGFseO7Q,7684
3
+ tool_tray/autostart.py,sha256=h1JcycsP8H97gMkD7GbBNVxdGrU_ZeFJDCGY50-i8qY,7862
4
4
  tool_tray/config.py,sha256=sPD2BL4s9ONcOK0Gac-efkiFgHJvbHxD2-LK2nl5-uw,3154
5
5
  tool_tray/desktop.py,sha256=87uBbZgE3pgZhjKfV1pKRrk83nuMKtBrR87enH_3eq0,3236
6
6
  tool_tray/logging.py,sha256=cXO4mxZsQ2sSdCC1HyMbszBOzDH17GFzVnh_bpsk6-c,1939
7
7
  tool_tray/manifest.py,sha256=lr13lcoaNsOi4E2_PCiomPN4-cQ05_bdNVuPyrONJeM,1915
8
8
  tool_tray/setup_dialog.py,sha256=1IOifQdrpGWuVd27P0XcMXBriCv9QkK_gMvnWfTKs5c,2301
9
9
  tool_tray/state.py,sha256=GEbXheWQeuw_IZGXBgccTxzP3jb_OEu-fh_o_4MrKQc,3079
10
- tool_tray/tray.py,sha256=RbXWfNbLpVqIhrVRDRr2RXimwsZ6f-CwpzxZnN7qpOM,11910
10
+ tool_tray/tray.py,sha256=vy8wWaAtdAtJ44V-z6xYDtSbu49iZ4SQppzaRBQEBcQ,12015
11
11
  tool_tray/updater.py,sha256=4yA1nvV2UKKY4POk_lPegpeXUhXsWVCXRHr5V-2DAjs,4354
12
- tool_tray-0.3.8.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
13
- tool_tray-0.3.8.dist-info/entry_points.txt,sha256=8tdG3k77qXzGiU9GunLH2EkNwmiBg8dy2MnvMy5NaCA,45
14
- tool_tray-0.3.8.dist-info/METADATA,sha256=HpRnjUmUahSzHZZV5yPZRu-nJZwNqXxgr9g4kET6P8A,4382
15
- tool_tray-0.3.8.dist-info/RECORD,,
12
+ tool_tray-0.3.11.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
13
+ tool_tray-0.3.11.dist-info/entry_points.txt,sha256=8tdG3k77qXzGiU9GunLH2EkNwmiBg8dy2MnvMy5NaCA,45
14
+ tool_tray-0.3.11.dist-info/METADATA,sha256=WzgF2cTKyza82m4SXvc-AmuqMyT-w-QwEqDztJXjsw0,4383
15
+ tool_tray-0.3.11.dist-info/RECORD,,