feat: custom node display names (aliases)

Right-click any node → Rename to set a custom label. The alias is shown
in the node header and Properties dialog instead of the raw PipeWire name.
Leave the input blank (or press Reset) to revert to the PW name.

Aliases are stored in aliases: Record<string,string> inside the patchbay
state (keyed by PW node name, which is stable for hardware devices) and
persisted automatically with the rest of the patchbay config. Old save
files without an aliases key are handled gracefully via the ?? {} fallback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joren
2026-03-30 20:08:16 +02:00
parent a40e7b24e5
commit cb87cd34ba
3 changed files with 58 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ export const patchbay = writable<PatchbayState>({
pinned_connections: [],
hide_rules: [],
merge_rules: [],
aliases: {},
});
// Port/node lookups
@@ -82,7 +83,7 @@ export async function initGraph() {
if (res.ok) {
const data = await res.json();
if (data && data.profiles) {
patchbay.set(data as PatchbayState);
patchbay.set({ ...data, aliases: data.aliases ?? {} } as PatchbayState);
}
}
} catch {}
@@ -357,6 +358,20 @@ export function deleteProfile(name: string) {
savePatchbayState();
}
// Node aliases (custom display names, keyed by PW node name)
export function setAlias(pwName: string, alias: string) {
patchbay.update(pb => {
const aliases = { ...pb.aliases };
if (alias.trim()) {
aliases[pwName] = alias.trim();
} else {
delete aliases[pwName]; // empty string = remove alias
}
return { ...pb, aliases };
});
savePatchbayState();
}
// Volume control
export async function setNodeVolume(nodeId: number, volume: number) {
try {