Steam Launcher + XBMCbuntu v13
Steam BPM will not work in the XBMC session as it appears Steam BPM (and wmctrl too, which the addon uses to detect whether Steam is in BPM) needs a windows manager to run properly, plus by default the addon kills xbmc which causes the session to restart - it needs to be run from a desktop session, either XBMCbuntu or Openbox, both of which are included in XBMCbuntu. You can try running Steam BPM in the XBMC session via SSH to see for yourself the problems it has with the following command:
Code:
DISPLAY=:0 steam -bigpicture
To configure XBMCbuntu to boot to a Openbox session, which includes a window manager, that autostarts XBMC either log in via SSH or exit xbmc and log into the XBMCbuntu desktop session, open a terminal and enter the following:
*Update the system and install wmctrl:
Code:
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install wmctrl
*Install Steam
Code:
wget http://media.steampowered.com/client/installer/steam.deb && sudo dpkg -i steam.deb
If you get errors regarding dependencies you need to run
sudo apt-get -f install
*Enable Openbox:
Code:
sudo mv /usr/share/xsessions/openbox.desktop.dis /usr/share/xsessions/openbox.desktop
Set Openbox as the default session:
Code:
sudo nano /etc/lightdm/lightdm.conf
and change the whole line beginning with
user-session= to
user-session=Openbox
ctrl + x to exit.
If this doesnt set the Openbox session to auto-boot, exit XBMC and at the login screen press 'F9' to open the windowmanager selection box and select Openbox there.
Set the Openbox background to black and XBMC to auto start:
Code:
mkdir -p $HOME/.config/openbox/ && echo "export DISPLAY=:0" >> $HOME/.config/openbox/autostart.sh && echo "xsetroot -solid black &" >> $HOME/.config/openbox/autostart.sh && echo "/usr/bin/xbmc &" >> $HOME/.config/openbox/autostart.sh && chmod +x $HOME/.config/openbox/autostart.sh
*To get audio out of both Steam BPM and games you need either
PulseAudio or a
~/.asoundrc file with dmix enabled. Both methods resample audio to mix together multiple streams, so they can reduce the quality of audio coming out of XBMC, but of course YMMV - the
PulseAudio wiki entry has a good pro's/con's list of both. For me PA was by far easiest to get working - surround sound/passthrough and bluetooth headset worked with zero config, plus it seems like Steam is designed to use PA. It is possible to start/stop PA as needed to get the best of both worlds. ALSA with dmix is tricker to setup and the config below will give you 2ch sound and probably no mic, but there are many more examples on the net. You need to edit the line with
pcm "hw:0,3" to suit your system, use
aplay -l to see available devices (in the example 0 is the card, 3 is the device).
-For ALSA:
and paste in the following:
Code:
# first set oss apps to use dmixer
pcm.dsp {
type plug
slave.pcm "dmixer"
}
pcm.dsp0 {
type plug
slave.pcm "dmixer"
}
# this makes native ALSA apps default to using dmix
pcm.!default {
type plug
slave.pcm "dmixer"
}
ctl.!default {
type hw
card 0
}
pcm.dmixer {
type dmix
ipc_key 101
slave {
pcm "hw:0,3"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
}
-For PulseAudio:
Installation of PulseAudio is blocked by default on XBMCbuntu:
Code:
sudo mv /etc/apt/preferences.d/libasound2-plugins.pref /etc/apt/preferences.d/libasound2-plugins.pref.bak && sudo mv /etc/apt/preferences.d/pulseaudio.pref /etc/apt/preferences.d/pulseaudio.pref.bak
Install PA (I also had to install
pulseaudio-module-bluetooth to get a bluetooth headset working):
Code:
sudo apt-get install pulseaudio libasound2-plugins
Disable autospawing of PA:
Code:
sudo nano /etc/pulse/client.conf
and add the following to the bottom of the file:
Code:
autospawn = no
daemon-binary = /bin/true
You need a basic ~/.asoundrc file pointing to the default ALSA device so it's automatically selected when PA isnt running. XBMCbuntu should auto generate one, but in case here is a example (You need to edit the card and device, use
aplay -l to see available devices):
Code:
pcm.!default {
type hw
card 0
device 7
}
ctl.!default {
type hw
card 0
device 7
}
In xbmc's settings select the default ALSA device (make sure PA isnt running).
Now you need to pre/post steam scripts to start/stop PA and after creating them configure the addon to launch pre/post scripts:
pre-steam.sh
Code:
#!/bin/bash
#change the KILL_XBMC_BEFORE_STARTING_PULSEAUDIO= to yes if you want to stop xbmc before starting pulseaudio
#killing xbmc before starting pulseaudio will ensure the steam bpm gui has sound but will reduce the seamlessness of the addon
KILL_XBMC_BEFORE_STARTING_PULSEAUDIO=no
if [[ $KILL_XBMC_BEFORE_STARTING_PULSEAUDIO = yes ]] ; then
kill -9 $(pidof xbmc.bin)
fi
pulseaudio --start
post-steam.sh
Code:
#!/bin/bash
#change the ALWAYS_KILL_PULSEAUDIO_BEFORE_STARTING_XBMC= to yes if you want to stop pulseaudio before starting xbmc
#killing pulseaudio before starting xbmc will ensure that xbmc always uses alsa, but steam may not like having pulseaudio stopped while steam is still running (via 'exit to desktop')
ALWAYS_KILL_PULSEAUDIO_BEFORE_STARTING_XBMC=no
if [[ $ALWAYS_KILL_PULSEAUDIO_BEFORE_STARTING_XBMC = yes ]] ; then
pulseaudio -k
fi
#change the KILL_PULSEAUDIO_ONLY_WHEN_COMPLETELY_EXITING_STEAM= to no if you dont want to stop pulseaudio only when completely exiting steam
#if yes xbmc will use pulseaudio when steam is running (via 'exit to desktop')
#change the SECONDS_TO_WAIT= to alter the time to wait after closing BPM to check if steam is still running, 2 seconds is good for my system although this could vary from system to system. This will cause xbmc to take 2 seconds longer to restart.
KILL_PULSEAUDIO_ONLY_WHEN_COMPLETELY_EXITING_STEAM=yes
SECONDS_TO_WAIT=2
if [[ $KILL_PULSEAUDIO_ONLY_WHEN_COMPLETELY_EXITING_STEAM = yes ]] ; then
sleep $SECONDS_TO_WAIT
if [[ ! $(pidof steam) ]] ; then
pulseaudio -k
fi
fi
Don't forget to make them executable.
Now PA will be running whenever steam is launched via the addon, so when you 'exit to desktop' from BPM xbmc will use PA and automatically use ALSA when PA isnt running. (As of writing I needed the beta steam client to consistently get BPM gui sounds)
*To return to the XBMCbuntu login screen right click on the desktop and select Log Out, or via SSH/terminal:
Reboot to check that it all works and make the changes take effect. After restarting
install the addon and for automatic updates install the repo too, links in first post. Now the addon will be available under "Programs", follow the prompts to finish setup. First time Steam runs you need a keyboard/mouse enter password to install extra packages for steam and to accept the EULA. Steam may or may not start in BPM on the first run, I dont remember...
*Optional: Updating graphics drivers (nvidia only) - Ubuntu 14.04 uses nvidia-304 by default, which I have found to be a lot slower than newer versions with games. To update to the latest in the trusty repos:
Code:
sudo apt-get install nvidia-331-updates
Newer drivers than the ones in Ubuntu's repo's can be found
in this PPA.
*
Optional: Ubuntu uses the xpad driver for 360 controllers, although there are others available -
xboxdrv and Valve's xpad driver. You can install valves driver from this
PPA, it fixes the flashing ring of light issue, plus others. This should hopefully be in the 3.15 kernel:
Code:
sudo apt-add-repository ppa:mdeslaur/steamos
Update and install driver:
Code:
sudo apt-get update && sudo apt-get install steamos-xpad-dkms
Also read through
this post to have wireless controllers work without restarting xbmc. And
this one to enable the driver to be automatically rebuilt with kernel updates.
*Optional: For a better Openbox right click menu that contains entries for Steam, Steam BPM, XBMC, Chromium and others:
Code:
sudo apt-get install menu
nano ~/.config/openbox/menu.xml
And paste in the following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://openbox.org/
file:///usr/share/openbox/menu.xsd">
<menu id="root-menu" label="Openbox 3">
<item label="Terminal">
<action name="Execute"><execute>x-terminal-emulator</execute></action>
</item>
<item label="Chromium">
<action name="Execute"><execute>chromium-browser</execute></action>
</item>
<item label="PCManFM">
<action name="Execute"><execute>dbus-launch pcmanfm</execute></action>
</item>
<item label="XBMC">
<action name="Execute"><execute>xbmc</execute></action>
</item>
<item label="Steam">
<action name="Execute"><execute>steam</execute></action>
</item>
<item label="Steam BPM">
<action name="Execute"><execute>~/.config/openbox/steam-bpm.sh</execute></action>
</item>
<!-- This requires the presence of the 'menu' package to work -->
<menu id="/Debian" />
<separator />
<item label="Reboot">
<action name="Execute">
<prompt>Are you sure you want to reboot?</prompt>
<execute>dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart</execute>
</action>
</item>
<item label="Shutdown">
<action name="Execute">
<prompt>Are you sure you want to shutdown?</prompt>
<execute>dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop</execute>
</action>
</item>
<item label="Suspend">
<action name="Execute">
<prompt>Are you sure you want to suspend?</prompt>
<execute>dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend</execute>
</action>
</item>
<item label="Log Out">
<action name="Execute">
<prompt>Are you sure you want to log-out?</prompt>
<execute>openbox --exit</execute>
</action>
</item>
</menu>
</openbox_menu>
Create a script to launch Steam BPM, it needs a different command if steam is already running:
Code:
nano ~/.config/openbox/steam-bpm.sh && chmod +x ~/.config/openbox/steam-bpm.sh
and paste in the following:
Code:
#!/bin/bash
if [[ $(pidof steam) ]] ; then
steam steam://open/bigpicture
else
steam -bigpicture
fi
*Optional: If the Openbox background changes colour after running steam you need to use the program
hsetroot to set the wallpaper:
Code:
sudo apt-get install hsetroot && echo "hsetroot -solid "#000000" &" >> ~/.config/openbox/autostart.sh
*Optional: Install the program
unclutter, it hides the mouse cursor after X seconds, useful for hiding the mouse in games/emulators.
Code:
sudo apt-get install unclutter && echo "unclutter -root &" >> ~/.config/openbox/autostart.sh
*Optional: If you get tearing in games/fmv you can install a compositing manager, such as
compton:
Code:
sudo apt-get install compton && echo "compton --backend glx --paint-on-overlay --glx-no-stencil --vsync opengl-swc & #--unredir-if-possible &" >> ~/.config/openbox/autostart.sh
*Optional: Install
bash-completion. Nothing to do with xbmc or steam, but it makes working in a terminal so much easier.
*Optional: If Steam complains about missing 32-bit libraries the first time you run it, the following command may help:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib