feat: replace free-text target fields with device/app dropdowns
- sink_volume and source_volume knobs now show a dropdown of active PulseAudio/PipeWire output/input devices (monitors excluded), with the system-default device marked in the label - app_volume knob shows a dropdown of running apps (was already a dropdown, previously had a textarea for group_volume) - group_volume knob shows a <select multiple> listbox so several apps can be selected at once with ctrl/shift-click - Add GET /api/sinks and GET /api/sources backend endpoints - Add fetchSinks() / fetchSources() in api.ts with AudioDevice type - Load sinks and sources in App.tsx alongside running apps on refresh - All 23 frontend tests pass
This commit is contained in:
7 files changed
+356
-172
No files matched your search
+13
-2
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import type { Config, ToastItem } from './types';
|
||||
import type { Config, AudioDevice, ToastItem } from './types';
|
||||
import * as api from './api';
|
||||
import { ToastContainer } from './components/Toast';
|
||||
import { Connection } from './components/Connection';
|
||||
@@ -21,6 +21,8 @@ export default function App() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [runningApps, setRunningApps] = useState<string[]>([]);
|
||||
const [sinks, setSinks] = useState<AudioDevice[]>([]);
|
||||
const [sources, setSources] = useState<AudioDevice[]>([]);
|
||||
const [appsLoading, setAppsLoading] = useState(false);
|
||||
|
||||
const addToast = useCallback((message: string, type: ToastItem['type'] = 'success') => {
|
||||
@@ -44,7 +46,14 @@ export default function App() {
|
||||
const loadApps = useCallback(async () => {
|
||||
setAppsLoading(true);
|
||||
try {
|
||||
setRunningApps(await api.fetchRunningApps());
|
||||
const [apps, sinkList, sourceList] = await Promise.all([
|
||||
api.fetchRunningApps(),
|
||||
api.fetchSinks(),
|
||||
api.fetchSources(),
|
||||
]);
|
||||
setRunningApps(apps);
|
||||
setSinks(sinkList);
|
||||
setSources(sourceList);
|
||||
} finally {
|
||||
setAppsLoading(false);
|
||||
}
|
||||
@@ -158,6 +167,8 @@ export default function App() {
|
||||
index={Number(i)}
|
||||
knob={config.knobs[i] ?? { action: 'sink_volume', target: 'default' }}
|
||||
runningApps={runningApps}
|
||||
sinks={sinks}
|
||||
sources={sources}
|
||||
onChange={(knob) =>
|
||||
patchConfig('knobs', { ...config.knobs, [i]: knob })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user