Sanad/shell_scripts/check_pulse_devices.sh

53 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
echo "=============================="
echo "🔊 PulseAudio Devices Checker"
echo "=============================="
echo
# تحقق أن PulseAudio شغال
if ! pactl info >/dev/null 2>&1; then
echo "❌ PulseAudio is NOT running"
echo " Use ALSA (hw:X,Y) instead"
exit 1
fi
echo "✅ PulseAudio is running"
echo
# -------------------------------
# List Sinks (Speakers)
# -------------------------------
echo "🔈 AVAILABLE SINKS (Speakers)"
echo "------------------------------"
pactl list short sinks | awk '{printf "• Name: %-70s | Index: %s\n", $2, $1}'
echo
# -------------------------------
# List Sources (Microphones)
# -------------------------------
echo "🎤 AVAILABLE SOURCES (Microphones)"
echo "----------------------------------"
pactl list short sources | awk '{printf "• Name: %-70s | Index: %s\n", $2, $1}'
echo
# -------------------------------
# Highlight PowerConf if exists
# -------------------------------
echo "🔍 PowerConf Devices Found"
echo "--------------------------"
FOUND=0
pactl list short sinks | grep -i powerconf && FOUND=1
pactl list short sources | grep -i powerconf && FOUND=1
if [ "$FOUND" -eq 0 ]; then
echo "⚠️ PowerConf NOT found in PulseAudio"
else
echo "✅ PowerConf detected above"
fi
echo
echo "=============================="