I wrote a little helper script to quickly set the audio volumes on my Pocket to reasonable defaults because the volume control GUI thingy (forgot the name) is not really usable in a situation where I must e.g. quickly turn off speakers.
This will turn off the speaker, turn on the headphone0 jack at a medium volume and set the overall output volume to medium too.
#!/usr/bin/env sh
# DAC, feeds both headphone jack and speaker
amixer -c rk3588tlv320aic set 'DAC',0 75%
# Speaker OFF
amixer -c rk3588tlv320aic set 'Speaker',0 mute
amixer -c rk3588tlv320aic set 'Speaker Analog',0 0%
amixer -c rk3588tlv320aic set 'Speaker Driver',0 0% mute
# Headphones ON
amixer -c rk3588tlv320aic set 'HP Analog',0 75%
amixer -c rk3588tlv320aic set 'HP Driver',0 0% unmute
amixer -c rk3588tlv320aic set 'HP Left',0 unmute
amixer -c rk3588tlv320aic set 'HP Right',0 unmute
# PipeWire main volume
amixer set 'Master',0 75% unmute
These work for the RK3588 CPU module. For others the card name and channel names will probably be different.
I expanded on this idea and wrote a little utility that lets me pick from several audio presets from the terminal, which is much faster than using the GUI audio controls, especially for the critical case of “oh shit, my speaker is still on and I’m sitting in a lecture and now everyone is looking at me, aaaaahhhh”
I have this in my $PATH as just "a". Feel free to use and modify however you like
Thank you! I brought up your script today in IRC and minute showed me that this can be seen as a “sway issue” because Gnome apparently has buttons to switch between headphones and speakers:
And then I thought that as a sway user I guess what I wanted was your script but as buttons in waybar. It turns out gnome has “custom buttons and dropdowns” as well:
I tried to get custom buttons to work in waybar via the “custom” widget a while ago (I wanted a Lock button to trigger swaylock) but couldn’t quite figure it out.
Having that option to run custom commands from a widget button or customizable popup menu would be awesome.