The upstream app is macOS-only (Swift/SwiftUI, CoreML/WhisperKit) and can't run on Linux or in a container. This adds a native host tool under linux/ that reproduces the workflow: focus any text field, press a hotkey, speak, and the optionally-rewritten text is typed into that field. - Engine: pynput global hotkeys → mic record → local faster-whisper → optional OpenAI-compatible rewrite → xdotool typing into the focused window - Frontends: system tray (AppIndicator, default), tkinter control panel, and headless modes - Config-driven workflows in ~/.config/blitztext/config.toml with per-workflow prompt/model/temperature overrides - Packaging: install.sh, requirements.txt, systemd user unit - Targets X11; local transcription runs CPU int8 on this arm64 host See linux/CHANGELOG.md and linux/README.md for details. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Lightweight desktop feedback via notify-send, with stdout fallback."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
|
|
_HAVE_NOTIFY = shutil.which("notify-send") is not None
|
|
_APP = "Blitztext"
|
|
# Reuse one notification bubble instead of stacking them.
|
|
_REPLACE_ID = "99317"
|
|
|
|
|
|
def notify(title: str, body: str = "", *, urgency: str = "normal", enabled: bool = True) -> None:
|
|
if enabled and _HAVE_NOTIFY:
|
|
try:
|
|
subprocess.run(
|
|
[
|
|
"notify-send",
|
|
"--app-name", _APP,
|
|
"--urgency", urgency,
|
|
"--hint", f"string:x-canonical-private-synchronous:{_REPLACE_ID}",
|
|
title,
|
|
body,
|
|
],
|
|
check=False,
|
|
)
|
|
return
|
|
except OSError:
|
|
pass
|
|
# Always echo to the console too — useful when running in a terminal.
|
|
line = f"[{_APP}] {title}" + (f" — {body}" if body else "")
|
|
print(line, file=sys.stderr, flush=True)
|