feat: show running PulseAudio apps in a dropdown for easier knob targeting
- Add GET /api/apps endpoint that queries pulsectl for active sink inputs and returns deduplicated app names (application.name + process.binary) - Add fetchRunningApps() API helper (returns [] on any failure, non-fatal) - Fetch running apps on page load; expose a Refresh button in the Knobs section header to re-query without a full page reload - KnobCard app_volume: wire target input to an HTML5 <datalist> so the browser shows a native autocomplete dropdown of running apps - KnobCard group_volume: add a select + Add button beneath the textarea so users can pick a running app and append it without typing - CSS: style the app-picker row and the compact refresh button in h2
This commit is contained in:
5 files changed
+147
-13
No files matched your search
@@ -114,6 +114,30 @@ async def save_config(request: Request) -> dict[str, bool]:
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
# ── Running apps API ──────────────────────────────────────────────────────────
|
||||
|
||||
@app.get("/api/apps")
|
||||
def list_running_apps() -> list[str]:
|
||||
"""Return unique app names from currently active PulseAudio/PipeWire sink inputs.
|
||||
|
||||
Returns both ``application.name`` and ``application.process.binary`` values
|
||||
(deduplicated) because the daemon's matching logic accepts either. Falls
|
||||
back to an empty list if pulsectl is unavailable or no server is reachable.
|
||||
"""
|
||||
try:
|
||||
import pulsectl # optional — only present when [ui] extra is installed
|
||||
with pulsectl.Pulse("turnup-ui-apps") as pulse:
|
||||
seen: set[str] = set()
|
||||
for si in pulse.sink_input_list():
|
||||
for field in ("application.name", "application.process.binary"):
|
||||
val = (si.proplist.get(field) or "").strip()
|
||||
if val:
|
||||
seen.add(val)
|
||||
return sorted(seen, key=str.lower)
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
|
||||
# ── Presets API ────────────────────────────────────────────────────────────────
|
||||
|
||||
def _preset_path(name: str) -> Path:
|
||||
|
||||
Reference in new issue
Block a user