You are not logged in.

#1 2016-12-06 00:14:26

Guisanti
Member
From: Málaga
Registered: 2016-11-25
Posts: 25

[SOLVED] How to manage pulseaudio on i3

Hello, I just have a short question. I'm currently using i3wm as my main window manager and at this moment there has been no problem but I haven't found how to manage (visual or by console) the audio outputs because I have a usb headset and I want to switch the output to it. However if I launch pulseaudio with the dmenu it doesnt work and I'm not able to find how to do it in console.
Thanks for reading

Last edited by Guisanti (2018-03-14 18:00:16)

Offline

#2 2016-12-06 00:36:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] How to manage pulseaudio on i3


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2016-12-06 05:21:32

HiImTye
Member
From: Halifax, NS, Canada
Registered: 2012-05-09
Posts: 1,072

Re: [SOLVED] How to manage pulseaudio on i3

for choosing outputs (HDMI, etc), pavucontrol is pretty handy.

for keyboard shortcuts, I wrote a helper script that lets me control the volume

#!/bin/bash
sinkName=$(pacmd info | grep 'Default sink' | awk '{print $4}')
sinkNumber=$(pacmd info | grep "sink:.*$sinkName" | awk '{print $2}')

getVolume() {
 volumeInput=$(pactl list sinks)
 currentVolume=$(echo "${volumeInput#*Sink #$sinkNumber}" | grep -E 'V.*-left' | grep -oE '[0-9]+%' | tail -n 1)
 notify-send "Volume: $currentVolume"
 echo Volume: "$currentVolume"
}

case "$1" in
 up) pactl set-sink-volume @DEFAULT_SINK@ +5%; getVolume;;
 down) pactl set-sink-volume @DEFAULT_SINK@ -5%; getVolume;;
 mute) muted=$(pactl list sinks | grep 'Mute: yes')
       if [ -z "$muted" ]; then
        pactl set-sink-mute @DEFAULT_SINK@ 1
        notify-send Volume: Muted
	echo Volume: Muted
       else
        pactl set-sink-mute @DEFAULT_SINK@ 0
        getVolume
       fi;;
 list) getVolume;;
esac

if [[ "$1" =~ [0-9]+ ]]; then
 pactl set-sink-volume @DEFAULT_SINK@ "$1%"; getVolume
fi

you can display your current volume on your bar

Last edited by HiImTye (2016-12-06 05:21:54)

Offline

#4 2016-12-06 05:58:28

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] How to manage pulseaudio on i3

Grep and awk is redundant:

pacmd info | awk '/Default sink/ {print $4}'

Similarly, the grep pipeline can be replaced by a single awk process:

pactl list sinks | awk '/Volume/ {print $5; exit}'

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2016-12-06 10:42:33

HiImTye
Member
From: Halifax, NS, Canada
Registered: 2012-05-09
Posts: 1,072

Re: [SOLVED] How to manage pulseaudio on i3

admittedly, I haven't used awk much, except for spitting out a column out of several, but that's likely obvious by the above wink

Offline

#6 2016-12-06 11:13:19

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 340
Website

Re: [SOLVED] How to manage pulseaudio on i3

For quick access to mixer from the i3 system tray have a look at pasystray

Offline

#7 2016-12-07 00:05:53

HiImTye
Member
From: Halifax, NS, Canada
Registered: 2012-05-09
Posts: 1,072

Re: [SOLVED] How to manage pulseaudio on i3

cirrus wrote:

For quick access to mixer from the i3 system tray have a look at pasystray

that's awesome, I didn't realize there was another option vs. the abandoned padevchooser which I used in Ubuntu when I ran OSS/Pulseaudio

Offline

#8 2016-12-12 22:28:52

Guisanti
Member
From: Málaga
Registered: 2016-11-25
Posts: 25

Re: [SOLVED] How to manage pulseaudio on i3

Oh thank you, what a noob question, didn't knew what front end was what I was looking for. Im not english. Thanks a lot

Offline

Board footer

Powered by FluxBB