Hi all,
I've come up with a simple way to switch between Kodi (XBMC) and Steam using lightdm. I know there's some Kodi plug-ins that launch Steam for you, but they didn't work well for me because Kodi would resume on the top-left corner in a small screen after quitting Steam. Apparently the plug-in didn't reconfigure the Xsession back to how Kodi likes it after quitting steam. I also had sound issues because I run Kodi without pulseaudio so that I can run passthrough audio from Kodi to my AVR... this would prevent Steam from running audio to my receiver since it'd be owned exclusively by Kodi. I didn't want to use pulseaudio under Kodi, so the best solution is to run Steam under its own session without Kodi in the background.
So, I'm using lightdm to help me switch between user accounts via linux scripts. To do this, I created a new user account (named "steam") that automatically boots into the steam app. This steam user session launches openbox on top of lightdm, and steam on top of openbox. I've read somewhere that steam runs more stable when on top of openbox (as opposed to running steam as a standalone app). I'm running Ubuntu 14.04, lightdm 1.10.3, and openbox 3.5.2.
Let me know how well this setup works for you! Post any issues you may have here and I'll do my best to help.
More details on my setup is below:
My setup has Kodi launch to Steam by having LightDM switch the user session to a dedicated "steam" user session with a desktop session named "Steam." I configured lightdm to launch openbox into this "steam" user session, and configured openbox to launch steam as its startup configuration. To make this transition into steam from Kodi, I set up a favourites entry in the Kodi ".kodi/userdata/favourites.xml" file:<favourite name="STEAM">System.ExecWait("/usr/local/bin/LightDMSwitchToSteam.sh")</favourite>
I created the LightDMSwitchToSteam.sh script to include:
Code:
#!/bin/bash
dm-tool switch-to-user steam Steam
until [[ $(pidof openbox) ]] ; do
sleep 1
done
pkill -KILL -u xbmc
Notice that this script waits for openbox to open fully before killing the xbmc user session (under which Kodi runs).
Also, in the Titan theme in Kodi, I created a top menu option "STEAM" that runs the LightDMSwitchToSteam.sh script. Selecting the STEAM menu option under Kodi switches to the lightdm session to the Steam user session without any issues for me. I also have the steam session configured to return to Kodi as soon as the steam app quits. To do this, I configured the "~/.config/openbox/autostart.sh" script in my "steam" user account to:
Code:
#!/bin/bash
pulseaudio --start
xsetroot -solid black &
/usr/games/steam &
/usr/local/bin/LightDMSwitchToKodi.sh &
The LightDMSwitchToKodi.sh script is as follows:
Code:
#!/bin/bash
until [[ $(pidof steam) ]] ; do
sleep 1
done
while [[ $(pidof steam) ]] ; do
sleep 1
done
dm-tool switch-to-user xbmc Kodi
until [[ $(pidof kodi.bin) ]] ; do
sleep 1
done
pkill -KILL -u steam
Notice that the first loop waits for steam to launch fully before running the rest of the script. Then, then the second loop waits for the steam app to quit before switching the user session back to xbmc (with the Kodi desktop session). This second loop essentially waits for the user to quit the steam app, after which it returns to Kodi and stops the steam user session.
Note that you should use chown to configure the LightDMSwitchToSteam.sh script to belong to your Kodi user session and group (in my case "xbmc"), and also use chown to configure the LightDMSwitchToKodi.sh script to belong to your Steam user session and group (in my case "steam"). Also, use chmod to make both of these scripts executable.
Some other configuration files:
/etc/lightdm/lightdm.conf:
Code:
[LightDM]minimum-vt=1
run-directory=/run/lightdm
[SeatDefaults]
session-wrapper=/etc/X11/Xsession
pam-service=lightdm-autologin
autologin-user=xbmc
autologin-user-timeout=0
/usr/share/xsessions/xbmc.desktop:
Code:
[Desktop Entry]Name=Kodi
Comment=This session will start Kodi Media Center
Exec=kodi-standalone
TryExec=kodi-standalone
Type=Application
/usr/share/xsessions/steam.desktop:
Code:
[Desktop Entry]Name=Steam
Comment=This session will start the Steam app under Openbox
Exec=/usr/bin/openbox-session
TryExec=/usr/bin/openbox-session
Type=Application
Side note: I was having trouble setting up my new steam session properly at first. When I would start the session (either via Kodi or as the initial session after booting up), I would get a black screen. I'd see that Xorg was running, but openbox wasn't. However, if I killed Xorg, I would get the lightdm greeter. After a lot of digging around, I noticed that the steam user session wasn't initializing correctly, likely due to some upstart issues. My friend and I stumbled upon the solution by installing and launching the i3 window manager under the "steam" user session (instead of launching openbox), then launching the steam app under i3. It seems that running i3 did something to configure the steam user session to launch window managers properly. After this, I returned the steam session's configuration to launch openbox instead of i3, and it successfully launched steam after logging in.
The following posts show some of the issues I was seeing before fixing the steam user session.
Bookmarks