You are not logged in.

#1 2017-07-23 23:28:08

kuzyn
Member
Registered: 2017-07-23
Posts: 6

[SOLVED] Issue with i3, pulseaudio and .xinitrc

Hi

Sometime it's the simplest things that you can't figure out isn't it:

I want to automatically start pulseaudio when my i3 user session start (to handle a bluetooth speaker and volume keys control via pactl) but I can't figure it out. Rather, I need to manually launch the daemon with "pulseaudio &" once logged in

I have tried to invoke this command in ~/.xinitrc (also ln -s ~/.xsession) without success. I also have tried to invoke it in a script called by ~/.config/i3/config and that doesn't do anything

My dotfiles are soft symlinks, I assume that doesn't makes a difference?

Here is my ~/.xinitrc

# keyboard layout
setxkbmap us

# pulseaudio
exec pulseaudio & 
exec start-pulseaudio-x11

And here is my ~/.config/i3/config after the i3 defaults

###
### kuzyn stuff
###

# bootscript
exec --no-startup-id /home/kuzyn/.dot/bin/i3_boot.sh

# keyboard layout
bindsym $mod+space exec /home/kuzyn/.dot/bin/toggle_keybinding.sh 

# wallaper
exec_always feh --bg-scale /home/kuzyn/Documents/wallpaper.jpg

# Close windows
bindsym $mod+Shift+Return kill

# Lock
bindsym $mod+Shift+x exec i3lock
bindsym XF86ScreenSaver exec i3lock

# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # mute sound

# Screen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

# Touchpad controls
bindsym XF86TouchpadToggle exec /home/kuzyn/.dot/bin/toggle_touchpad.sh # toggle touchpad

# Media player controls
bindsym XF86AudioPlay exec cmus-remote --pause
bindsym XF86AudioPause exec cmus-remote --pause
bindsym XF86AudioNext exec cmus-remote --next
bindsym XF86AudioPrev exec cmus-remote --prev
bindsym XF86AudioStop exec cmus-remote --stop

And finally here is my /home/kuzyn/.dot/bin/i3_boot.sh

#!/bin/bash

# keyboard layout
setxkbmap us

# bell
xset -b

# display
xrandr --output VGA1 --mode 1920x1080
xrandr --output LVDS1 --off

Thanks!!

Last edited by kuzyn (2017-08-12 10:52:30)

Offline

#2 2017-07-23 23:31:25

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

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

https://wiki.archlinux.org/index.php/PulseAudio#Running

Also, read the xinitrc page: two exec invocations are pointless.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-07-23 23:49:55

kuzyn
Member
Registered: 2017-07-23
Posts: 6

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

From the wiki:

PulseAudio on Arch has pulseaudio.socket enabled by default for the systemd/User instance. This means that PulseAudio will automatically start when needed.

That is precisely my problem: I launch cmus and pulseaudio doesn't spawn; I launch chrome and pulseaudio doesn't spawn; etc

My /etc/pulse/client.conf all commented out so it should spawn, no?

Offline

#4 2017-07-24 00:03:43

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

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

You probably have a broken session. How do you start X? What is the output of `loginctl show-session $XDG_SESSION_ID`?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2017-07-24 00:14:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

You clearly are not starting X with anything that reads ~/.xinitrc as i3 would never start - so any commands in ~/.xinitrc are irrelevant.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2017-07-24 00:16:13

kuzyn
Member
Registered: 2017-07-23
Posts: 6

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

I assume that X is started by gdm, which I still use for the user login prompt

Output is

Id=c3
User=1000
Name=kuzyn
Timestamp=Sun 2017-07-23 19:48:08 EDT
TimestampMonotonic=23562424
VTNr=2
Seat=seat0
TTY=/dev/tty2
Remote=no
Service=gdm-password
Scope=session-c3.scope
Leader=785
Audit=0
Type=x11
Class=user
Active=yes
State=active
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0
LockedHint=no

Offline

#7 2017-07-24 00:20:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

kuzyn wrote:

I assume that X is started by gdm

It'd have been good to mention that in the first post: xinitrc is definitely irrelevant.  (It'd be even better to not assume).

You'll need to set it up to autostart with GDM.  Unforutnately it looks like gdm may be currently broken.  It sounds like there are alternative ways of autostarting things with gdm with .desktop files in an autostart folder, but that's new to me.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2017-07-24 00:30:25

kuzyn
Member
Registered: 2017-07-23
Posts: 6

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

Interesting. Will investigate

Side quest: why can't I seem to be able to start it from my /.config/i3/config file?

Offline

#9 2017-07-24 00:44:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

kuzyn wrote:

Side quest: why can't I seem to be able to start it from my /.config/i3/config file?

How exactly are you trying to do this?  There's nothing about starting pulseaudio in the config file you posted.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2017-07-24 00:50:37

kuzyn
Member
Registered: 2017-07-23
Posts: 6

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

By adding it to my i3_boot script aforementioned:

#!/bin/bash

# keyboard layout
setxkbmap us

# bell
xset -b

# audio
pulseaudio &

# display
xrandr --output VGA1 --mode 1920x1080
xrandr --output LVDS1 --off

Although I'm now observing something strange after rebooting: while none of the XF86 keys seem to work (which made me assume pulseaudio was not starting), if I try to launch it in the terminal is says that is spawned already BUT the controls start working afterward

[1] 1985
kuzyn@sweatbox% E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.

[1]  + exit 1     pulseaudio

(again with the assumptions, I know)

Last edited by kuzyn (2017-07-24 00:51:49)

Offline

#11 2017-08-12 10:51:33

kuzyn
Member
Registered: 2017-07-23
Posts: 6

Re: [SOLVED] Issue with i3, pulseaudio and .xinitrc

Hi, I sort of abandoned this issue: I had to change computer so I used that as an excuse to go with Slim & i3. Marking this as solved

Offline

Board footer

Powered by FluxBB