2015-02-08, 03:10
Steam Launcher + KODIbuntu v14
Steam BPM will not work in the Kodi session as it appears Steam BPM (and wmctrl too, which the addon uses to detect whether Steam is in BPM) needs a window manager to run properly, plus by default the addon kills Kodi which causes the session, therefore Kodi, to restart - it needs to be run from a desktop session, either Lubuntu or Openbox, both of which are included in KODIbuntu. You can try running Steam BPM in the Kodi session via SSH to see for yourself the problems it has with the following command:
To configure KODIbuntu to boot to a light weight Openbox session, which includes a window manager, that auto starts Kodi either log in via SSH or exit Kodi and log into the Lubuntu desktop session, open a terminal and enter the following:
*Update the system and install wmctrl:
*Install Steam
If you get errors regarding dependencies you need to run sudo apt-get -f install
*Enable Openbox:
Set Openbox as the default session:
If this doesnt set the Openbox session to auto-boot, exit Kodi and at the login screen press 'F9' to open the windowmanager selection box and select Openbox there.
Set the Openbox background to black and Kodi to auto start:
*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 Kodi, but of course YMMV - the PulseAudio wiki entry has a good pro's/con's list of both. For me PA was by far the 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 trickier to setup and the config below will give you 2ch sound and probably no mic, but there are many more examples on the net.
-For ALSA:
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).
and paste in the following:
-For PulseAudio:
Installation of PulseAudio is blocked by default on KODIbuntu:
Install PA (I also had to install pulseaudio-module-bluetooth to get a bluetooth headset working):
Disable autospawing of PA:
and add the following to the bottom of the file:
You need a basic ~/.asoundrc file pointing to the default ALSA device so it's automatically selected when PA isn't running. KODIbuntu should auto generate one (if the wrong device is selected in the ~/.asoundrc file delete it, select the correct output device in Kodi and restart your system - a new asoundrc file should be auto generated), but in case here is a example (You need to edit the card and device, use aplay -l to see available devices):
In Kodi'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
post-steam.sh
Mark both of them as executable:
*Optional sound config: Set the ALSA system volume:
*Optional sound config: Enable to option 'Suspend Kodi audio when running Steam' in the Steam Launcher addon - this may help with sound issues.
*To return to the KODIbuntu 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. Run the following command to check that openbox and wmctrl are setup properly - If it gives no output everything is ok:
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... But I recommend exiting Kodi and starting Steam desktop mode the first time you run it.
*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:
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:
Update and install driver:
Sometimes the steamos driver fails to load and the xpad one is used - I reload the driver on boot to prevent this from happening:
Add the following before the 'exit 0':
UPDATE: A xpad driver with various additional fixes exists, see here (untested by me).
*Optional: For a better Openbox right click menu that contains entries for Steam, Steam BPM, Kodi, Chromium and others:
And paste in the following:
Create a script to launch Steam BPM, it needs a different command if steam is already running:
and paste in the following:
*Optional: If the Openbox background changes colour after running steam you need to use the program hsetroot to set the wallpaper:
*Optional: Install the program unclutter, it hides the mouse cursor after X seconds, useful for hiding the mouse in games/emulators.
*Optional: If you get tearing in games/fmv you can install a compositing manager, such as compton:
*Optional: Install bash-completion. Nothing to do with Kodi 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
Steam BPM will not work in the Kodi session as it appears Steam BPM (and wmctrl too, which the addon uses to detect whether Steam is in BPM) needs a window manager to run properly, plus by default the addon kills Kodi which causes the session, therefore Kodi, to restart - it needs to be run from a desktop session, either Lubuntu or Openbox, both of which are included in KODIbuntu. You can try running Steam BPM in the Kodi session via SSH to see for yourself the problems it has with the following command:
Code:
DISPLAY=:0 steam -bigpicture
To configure KODIbuntu to boot to a light weight Openbox session, which includes a window manager, that auto starts Kodi either log in via SSH or exit Kodi and log into the Lubuntu 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
*Enable Openbox:
Code:
sudo cp /usr/share/xsessions/hidden/openbox.desktop /usr/share/xsessions/
Set Openbox as the default session:
Code:
sudo dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User1000 org.freedesktop.Accounts.User.SetXSession string:openbox
Set the Openbox background to black and Kodi 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/kodi &" >> $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 Kodi, but of course YMMV - the PulseAudio wiki entry has a good pro's/con's list of both. For me PA was by far the 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 trickier to setup and the config below will give you 2ch sound and probably no mic, but there are many more examples on the net.
-For ALSA:
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).
Code:
nano ~/.asoundrc
Code:
pcm.dsp {
type plug
slave.pcm "dmixer"
}
pcm.dsp0 {
type plug
slave.pcm "dmixer"
}
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 KODIbuntu:
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
Code:
sudo apt-get install pulseaudio libasound2-plugins
Code:
sudo nano /etc/pulse/client.conf
Code:
autospawn = no
daemon-binary = /bin/true
Code:
pcm.!default {
type hw
card 0
device 7
}
ctl.!default {
type hw
card 0
device 7
}
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_KODI_BEFORE_STARTING_PULSEAUDIO= to yes if you want to stop Kodi before starting pulseaudio
#killing Kodi before starting pulseaudio will ensure the steam bpm gui has sound but will reduce the seamlessness of the addon
KILL_KODI_BEFORE_STARTING_PULSEAUDIO=no
if [[ $KILL_KODI_BEFORE_STARTING_PULSEAUDIO = yes ]] ; then
kill -9 $(pidof kodi.bin)
fi
pulseaudio --start
Code:
#!/bin/bash
#change the ALWAYS_KILL_PULSEAUDIO_BEFORE_STARTING_KODI= to yes if you want to stop pulseaudio before starting Kodi
#killing pulseaudio before starting Kodi will ensure that Kodi 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_KODI=no
if [[ $ALWAYS_KILL_PULSEAUDIO_BEFORE_STARTING_KODI = 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 Kodi 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 Kodi 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
Code:
chmod +x pre-steam.sh post-steam.sh
*Optional sound config: Set the ALSA system volume:
Code:
alsamixer && sudo alsactl store
*Optional sound config: Enable to option 'Suspend Kodi audio when running Steam' in the Steam Launcher addon - this may help with sound issues.
*To return to the KODIbuntu login screen right click on the desktop and select Log Out, or via SSH/terminal:
Code:
openbox --exit
*Reboot to check that it all works and make the changes take effect. Run the following command to check that openbox and wmctrl are setup properly - If it gives no output everything is ok:
Code:
DISPLAY=:0 wmctrl -l > /dev/null 2>&1 || echo "***wmctrl unable to run***" ; pidof openbox > /dev/null 2>&1 || echo "***openbox not running***"
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... But I recommend exiting Kodi and starting Steam desktop mode the first time you run it.
*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
*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:
Code:
sudo apt-add-repository ppa:mdeslaur/steamos
Code:
sudo apt-get update && sudo apt-get install steamos-xpad-dkms
Code:
sudo nano /etc/rc.local && sudo chmod +x /etc/rc.local
Code:
(until [ "`lsmod | grep xpad`" ] ; do sleep 1 ; done ; rmmod xpad && modprobe xpad)&
*Optional: For a better Openbox right click menu that contains entries for Steam, Steam BPM, Kodi, Chromium and others:
Code:
sudo apt-get install menu
nano ~/.config/openbox/menu.xml
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="Kodi">
<action name="Execute"><execute>kodi</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>
Code:
nano ~/.config/openbox/steam-bpm.sh && chmod +x ~/.config/openbox/steam-bpm.sh
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 Kodi 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