Skip to content

Instantly share code, notes, and snippets.

@sulincix
Last active February 26, 2026 17:59
Show Gist options
  • Select an option

  • Save sulincix/e735559a4603a7f509808f194ac94eb3 to your computer and use it in GitHub Desktop.

Select an option

Save sulincix/e735559a4603a7f509808f194ac94eb3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Create merged input. Merged all output sources.
# Insert this script in /etc/X11/xinit/xinitrc.d/
if [ "$1" == "-u" ]; then
# Unload the loopback and null sink modules
pactl unload-module module-loopback
pactl unload-module module-null-sink
else
# Exit if already loaded.
if pactl list sources short | grep "combined" &>/dev/null ; then
exit 0
fi
# Load a null sink with a specific name and description
pactl load-module module-null-sink sink=inputs sink_name=combined sink_properties=device.description="Merged Output"
# Load loopback modules for each source
for device in $(pactl list sources short | awk '/^[0-9]+/ {print $2}' | grep -v "combined"); do
echo "$device"
pactl load-module module-loopback source="$device" sink=combined
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment