fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Érico Nogueiracompletions: fix pacmd completions when using pipewire-pulse.3ac2242c6

master
1.3 KiB21 linesraw
1# Pulseaudio's pacmd
2# This covers the most useful commands
3set -l commands (pacmd help 2>/dev/null | string match -r '^ +[-\w]+' | string trim)
4complete -f -c pacmd
5complete -f -c pacmd -w pactl
6
7# These descriptions are a bit wordy and unnecessary
8# Sample: set-source-port Change the port of a source (args: index|name, port-name)
9# Or: list-source-outputs List source outputs
10complete -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')"
11
12# Since we wrapped pactl, we can also use functions defined there
13complete -f -c pacmd -n "__fish_seen_subcommand_from describe-module" -a '(__fish_pa_complete_type modules)'
14complete -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
15
16for t in client sink-input source-output
17    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
18end
19
20complete -f -c pactl -n "__fish_seen_subcommand_from suspend" -a '0 false off' -d Resume
21complete -f -c pactl -n "__fish_seen_subcommand_from suspend" -a '1 true on' -d Suspend