From 36b00935c7e7068d2debd712452cdc751daf4900 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Sat, 6 Jun 2026 14:50:56 +0200 Subject: [PATCH] autostart: launch the currently-running copy (source vs installed) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _exec_command now detects whether Blitztext is running from a source checkout (not /opt or site-packages) and, if so, writes an autostart entry that launches that exact source with PYTHONPATH — so the "Launch on login" toggle no longer reverts to a stale installed .deb when developing from source. Co-Authored-By: Claude Opus 4.8 --- linux/blitztext/autostart.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/linux/blitztext/autostart.py b/linux/blitztext/autostart.py index b4de76d..82999c0 100644 --- a/linux/blitztext/autostart.py +++ b/linux/blitztext/autostart.py @@ -16,7 +16,18 @@ _ENTRY = _AUTOSTART_DIR / "blitztext.desktop" def _exec_command() -> str: - """Prefer an installed `blitztext` launcher; else run this venv's module.""" + """Launch the *currently running* copy on login. + + If we're running from a source checkout (not the installed /opt copy or a + site-packages install), launch that exact source with PYTHONPATH so edits + stay live. Otherwise prefer the installed `blitztext` launcher. + """ + import blitztext + + pkg_parent = str(Path(blitztext.__file__).resolve().parent.parent) + from_source = not pkg_parent.startswith("/opt/") and "site-packages" not in pkg_parent + if from_source: + return f"env PYTHONPATH={pkg_parent} {sys.executable} -m blitztext tray" launcher = shutil.which("blitztext") if launcher: return f"{launcher} tray"