From 5adab1a9369357be37b8bcf38dd7bc1c1c91ed6e Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Fri, 17 Feb 2017 08:24:15 -0600 Subject: [PATCH] Correct pactl command --- Xinitrc.wiki | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Xinitrc.wiki b/Xinitrc.wiki index 9d5aa87..68d26e7 100644 --- a/Xinitrc.wiki +++ b/Xinitrc.wiki @@ -93,10 +93,10 @@ This allows you to replace any instance of the full `xinput(1)` command with `ma I want the default PulseAudio sink to change to HDMI when HDMI is plugged in, and back to analog when disconnected. -Changing the default sink in pulse is as easy as running `pacmd set-default-sink ` where `` is the id of the desired sink. Unfortunately, this is another situation where the id might change unexpectedly. We also don't have an easy interface to determine the id number from a name like we did with `xinput(1)`, so we're forced to parse the output of `pacmd list short` like so: +Changing the default sink in pulse is as easy as running `pacmd set-default-sink ` where `` is the id of the desired sink. Unfortunately, this is another situation where the id might change unexpectedly. We also don't have an easy interface to determine the id number from a name like we did with `xinput(1)`, so we're forced to parse the output of `pactl list sinks short` like so: {{{class="prettyprint" -pacmd set-default-sink $(pacmd list short | grep "hdmi" | grep -o "^\S\+") +pacmd set-default-sink $(pactl list sinks short | grep "hdmi" | grep -o "^\S\+") }}} This command lists all sinks in short form, then greps for a line containing "hdmi", uses grep to only print the first character (the sink id), then sets the default sink with `pacmd(1)`. Since this will also need to be run any time the display configuration changes, a function is, again, appropriate: @@ -105,11 +105,11 @@ This command lists all sinks in short form, then greps for a line containing "hd setpasink() { # setpasink # Find a unique string in the output of `pacmd list short` to use for - pacmd set-default-sink $(pacmd list short | grep "$1" | grep -o "^\S\+") + pacmd set-default-sink $(pactl list sinks short | grep "$1" | grep -o "^\S\+") } }}} -This allows you to change the default PulseAudio sink with `setpasink ` where `` is any arbitrary string that is unique to the line that corresponds to the desired sink in the output of `pacmd list short`. +This allows you to change the default PulseAudio sink with `setpasink ` where `` is any arbitrary string that is unique to the line that corresponds to the desired sink in the output of `pactl list sinks short`. ----