[Linux] A bunch of linux audio functions/improvements

This commit is contained in:
2017-04-06 22:12:31 -07:00
parent 875186faed
commit ef49abdc72
5 changed files with 79 additions and 5 deletions

View File

@@ -1,7 +1,9 @@
is_osx && return
command_exists 'open' || command_exists 'xdg-open' && alias open='xdg-open'
pasink () {
pacmd list-sinks | grep '* index' | get_cols ' -1'
pacmd list-sinks | grep '\* index' | get_cols ' -1'
}
pasink() {
@@ -10,7 +12,22 @@ pasink() {
pavolume () {
pacmd list-sinks |
awk '/^\s+name: /{indefault = $2 == "<'$(pasink)'>"}
awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"}
/^\s+volume: / && indefault {print $5; exit}'
}
paismuted () {
pactl list sinks | grep "$(pasink)" -A 10 | grep Mute | grep -q yes
}
pashowvolume () {
if paismuted; then
volnoti-show -m
else
volnoti-show "$(pavolume)"
fi
}
pashowinputbypid () {
get_sink_input_info.hs | jq 'select(.application_process_id == "'"$1"'")'
}