2016-01-14 22:31:17 +00:00
# Pulseaudio's pacmd
# This covers the most useful commands
2021-05-14 19:02:40 +00:00
set -l commands ( pacmd help 2 > /dev/null | string match -r '^ +[-\w]+' | string trim)
2020-03-07 06:56:26 +00:00
complete -f -c pacmd
2016-01-14 22:31:17 +00:00
complete -f -c pacmd -w pactl
# These descriptions are a bit wordy and unnecessary
# Sample: set-source-port Change the port of a source (args: index|name, port-name)
# Or: list-source-outputs List source outputs
2021-05-14 19:02:40 +00:00
complete -f -c pacmd -n " not __fish_seen_subcommand_from $commands " -a "(pacmd help 2>/dev/null | string match ' *' | string trim | string replace -r '\s+' '\t')"
2016-01-14 22:31:17 +00:00
# Since we wrapped pactl, we can also use functions defined there
complete -f -c pacmd -n "__fish_seen_subcommand_from describe-module" -a '(__fish_pa_complete_type modules)'
complete -f -c pacmd -n "__fish_seen_subcommand_from kill-client" -a '(__fish_pa_complete_type clients | string match -r "^[0-9].*")' # match because this only takes an index
for t in client sink-input source -output
2019-05-05 10:53:09 +00:00
complete -f -c pacmd -n " __fish_seen_subcommand_from kill- $t " -a '(__fish_pa_complete_type ' $t 's | string match -r "^[0-9].*")' # match because this only takes an index
2016-01-14 22:31:17 +00:00
end
2020-03-09 18:36:12 +00:00
complete -f -c pactl -n "__fish_seen_subcommand_from suspend" -a '0 false off' -d Resume
complete -f -c pactl -n "__fish_seen_subcommand_from suspend" -a '1 true on' -d Suspend