Add scripts
This commit is contained in:
Executable
+34
@@ -0,0 +1,34 @@
|
||||
SINK_INPUTS=$(pactl list short sink-inputs | awk '{print $1}')
|
||||
|
||||
if [[ -z "$SINK_INPUTS" ]]; then
|
||||
echo "No audio streams detected. Make sure the target app is playing audio!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
i=1
|
||||
declare -A ID_MAP
|
||||
|
||||
for ID in $SINK_INPUTS; do
|
||||
CLIENT_ID=$(pactl list short sink-inputs | awk -v id="$ID" '$1 == id {print $3}')
|
||||
CLIENT_NAME=$(pactl list short clients | awk -v cid="$CLIENT_ID" '$1 == cid {print $3}')
|
||||
|
||||
# Remove quotes around client names, if any
|
||||
CLIENT_NAME=${CLIENT_NAME//\"/}
|
||||
|
||||
echo "$i) $CLIENT_NAME (sink-input $ID)"
|
||||
ID_MAP[$i]=$ID
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
echo
|
||||
read -p "Select the number of the app to route to Discord: " CHOICE
|
||||
echo
|
||||
|
||||
TARGET_ID=${ID_MAP[$CHOICE]}
|
||||
|
||||
if [[ -z "$TARGET_ID" ]]; then
|
||||
echo "Invalid choice."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $TARGET_ID
|
||||
Reference in New Issue
Block a user