Bug 100714 - pactl get-default-sink
Summary: pactl get-default-sink
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: tools (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-18 16:31 UTC by Eric Toombs
Modified: 2018-07-30 10:28 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Eric Toombs 2017-04-18 16:31:54 UTC
The current way to set volume looks like this:

% pacmd info |grep Default
Default sample spec: s16le 2ch 44100Hz
Default channel map: front-left,front-right
Default sink name: alsa_output.pci-0000_00_14.5.analog-stereo
Default source name: alsa_input.pci-0000_00_14.5.analog-stereo

*** copy default sink name ***

% pactl set-sink-volume alsa_output.pci-0000_00_14.5.analog-stereo 80%

It works, but surely there is room for improvement. Maybe something like

% pactl set-sink-volume default 80%

Or maybe even

% pactl set-sink-volume 80%
Comment 1 Eric Toombs 2017-04-18 16:39:25 UTC
Another possibility:
% pactl set-volume "$(pactl get-default-sink)"
Comment 2 Eric Toombs 2017-04-18 16:44:44 UTC
I've since found @DEFAULT_SINK@. So looks like my first idea was already implemented. pactl get-default-sink would still be useful, though, for situations like

% pacat -d "$(pactl get-default-sink).monitor" ...
Comment 3 Tanu Kaskinen 2017-04-18 18:40:13 UTC
(In reply to Eric Toombs from comment #2)
> I've since found @DEFAULT_SINK@. So looks like my first idea was already
> implemented. pactl get-default-sink would still be useful, though, for
> situations like
> 
> % pacat -d "$(pactl get-default-sink).monitor" ...

That particular example doesn't need any new features, because you can use @DEFAULT_MONITOR@.

More generally, though, I think it would be nice if pactl would have more fine-grained querying capabilities for situations where you need just one bit of information in a script (also, the current info/list commands are not guaranteed to not change their output format, so parsing pactl output in scripts is a bit fragile).
Comment 4 GitLab Migration User 2018-07-30 10:28:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/445.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.