New GTK settings with a dropdown+editor pattern across four tabs: - Presets: select/add/delete prompt presets; edit name, keywords, hotkey, mode, per-preset model/temperature, and a clearly-bordered prompt textfield. - Engines: STT and LLM engine managers with green/red online-offline status dots, add/edit/delete, active selector, and an STT record-and-benchmark Test. - Input: input scheme + keys + quality-gate settings. - General: microphone picker with a live sounddevice level meter, output, language, notifications, launch-on-login toggle, and local-Whisper settings. Adds audio.py (mic enumeration via pactl + LevelMeter) and autostart.py (~/.config/autostart entry). Recorder + daemon honour the selected mic. Requirements gain sounddevice + tomli-w. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
"""Launch-on-login via a freedesktop autostart entry.
|
|
|
|
Writes ~/.config/autostart/blitztext.desktop so the tray starts with the GNOME
|
|
session. No root needed.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_AUTOSTART_DIR = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "autostart"
|
|
_ENTRY = _AUTOSTART_DIR / "blitztext.desktop"
|
|
|
|
|
|
def _exec_command() -> str:
|
|
"""Prefer an installed `blitztext` launcher; else run this venv's module."""
|
|
launcher = shutil.which("blitztext")
|
|
if launcher:
|
|
return f"{launcher} tray"
|
|
return f"{sys.executable} -m blitztext tray"
|
|
|
|
|
|
def is_enabled() -> bool:
|
|
return _ENTRY.exists()
|
|
|
|
|
|
def set_enabled(enabled: bool) -> None:
|
|
if not enabled:
|
|
_ENTRY.unlink(missing_ok=True)
|
|
return
|
|
_AUTOSTART_DIR.mkdir(parents=True, exist_ok=True)
|
|
_ENTRY.write_text(
|
|
"[Desktop Entry]\n"
|
|
"Type=Application\n"
|
|
"Name=Blitztext\n"
|
|
f"Exec={_exec_command()}\n"
|
|
"Icon=blitztext\n"
|
|
"Terminal=false\n"
|
|
"X-GNOME-Autostart-enabled=true\n",
|
|
encoding="utf-8",
|
|
)
|