mirror of
https://github.com/Matir/skel.git
synced 2026-05-26 05:29:09 -07:00
Cleanup
This commit is contained in:
46
bin/linux/pactl_helper
Executable file
46
bin/linux/pactl_helper
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_active_sink {
|
||||
pactl list short sinks | grep RUNNING | awk '{print $2}'
|
||||
}
|
||||
|
||||
function get_active_source {
|
||||
pactl list short sources | grep RUNNING | awk '{print $2}'
|
||||
}
|
||||
|
||||
function get_default_sink {
|
||||
pactl info | grep '^Default Sink:' | awk '{print $NF}'
|
||||
}
|
||||
|
||||
function get_default_source {
|
||||
pactl info | grep '^Default Source:' | awk '{print $NF}'
|
||||
}
|
||||
|
||||
function micmute {
|
||||
MODE=${1:-toggle}
|
||||
pactl set-source-mute $(get_default_source) ${MODE}
|
||||
}
|
||||
|
||||
function mute {
|
||||
MODE=${1:-toggle}
|
||||
pactl set-sink-mute $(get_default_sink) ${MODE}
|
||||
}
|
||||
|
||||
function volume {
|
||||
VOL="${1}"
|
||||
if test -z "${VOL}" ; then
|
||||
echo "Need volume spec!"
|
||||
exit 1
|
||||
fi
|
||||
pactl set-sink-volume $(get_default_sink) "${VOL}"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
mute|micmute|volume)
|
||||
"$@"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user