You don't need a window manager or a full desktop enviroment (Gnome, KDE, Fluxbox, ...), you can just modify ~/.xinitrc for the user that is going to run boxee. This assumes that you don't want to do anything else with the X session since you won't have anything but the boxee gui to work with. There's no window manager so you can't manage windows, this means no moving windows, min/maximize, focusing, etc. But if you are going for an HTPC hopefully you have a dedicated user ('boxeeUser' in the following code) that automatically logs on and spawns an X session, so the lack of a usable desktop for said user isn't an issue.
This is my setup on Lucid, it should work fine unless the ubuntu team moved the tty settings.
Auto login:
Code:
cp /etc/init/tty1.conf /etc/init/tty1.conf_orig
edit /etc/init/tty1.conf: (you will need root privileges, use sudo)
Code:
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /bin/login -f boxeeUser </dev/tty1 > /dev/tty1 2>&1
NOTE: change -f boxeeUser to -f <user> depending on what user you're using to launch boxee. My user is named 'boxeeUser', that line does not launch anything, just logs in the user specified. (You really just need to change the exec line, this is my entire conf file)
So now the user is logged in automatically, respawning whenever the user is logged out or killed. Next we need to set the user to spawn a X session when logged in.
Auto-spawn X:
edit /home/boxeeUser/.bash_profile: (again, change boxeeUser to the correct username. Make this file if you need to. If there's already stuff in it add this to the bottom, or top if that doesn't work. If all else fails, backup the existing .bash_profile and make a new one with just this.)
Code:
case "`tty`" in
/dev/tty1) clear && startx &>/dev/null && logout;;
esac
Now whenever the user logs on using tty1 (since we used tty1 (tty1.conf) as the autologin terminal), it clears the screen, runs startx to start a X session, and waits until that session quits to logout (which just causes the user to be logged in again via respawning). This tty1 check allows you to login as the boxee user normally in other places, like SSH or other VTs.
Finally we need to configure X11 to launch just the boxee GUI by default for this user.
Set X11 to use boxee:
edit /home/boxeeUser/.xinitrc: (I mean it, change boxeeUser to your username. Again, make this file if it doesn't exist yet. If there is already stuff in this file, back it up and replace it with just the following code. Or comment out all the existing lines with #'s. I.E. '# startfluxbox')
Code:
#nvidia-settings --display :0 -l
#nvclock -F 100 -f
exec /opt/boxee/run-boxee-desktop
Note that I run nvidia-settings commands to setup my card correctly before boxee launches (commented out in the above for copy/pasters). You can put any command you want before boxee launchs, but make sure the process will exit else you will never see boxee appear since it's waiting for the earlier command to finish. If the command you want to launch doesn't exit (deamon or something) add a '&' after the line which will run the command in the background. E.G. '/usr/bin/gamepadDeamon &'. If you learned about '&' just now, go read up on bash shortcuts/tricks, there's a lot of very useful stuff there.
DO NOT PUT A '&' AFTER THE BOXEE COMMAND, X11 quits when it hits the end of the script, so you want it to wait for boxee.
And that's it. After a reboot tty1 should log in your boxee user automatically, .bash_profile will launch a X session, and .xinit will tell X11 to launch boxee. Once you quit boxee (or it crashes) the X session will close, which will log you out, then tty1 will respawn and log you in again starting the whole thing over. It's quite nice, if boxee is acting up you can relaunch it simply by quitting, and if it crashes it pops right back up. Sometimes boxee might close/crash hanging startx and leaving you at a terminal, or leaving you in a fully blank X session. If this happens switch to tty1 (ctrl-alt-f1), hit ctrl-c a few times until the prompt appears again, and run the 'exit' command. If all else fails kill the login session as root. You can find the PID using 'ps -A | grep login | grep tty1', then just 'sudo kill -9 <pid>'.
FYI: If you do want a desktop environment to use occasionally, say for debugging or games, you can always :
- Switch to another VT via ctrl-alt-f[2-6] (I use ctrl-alt-f2 but it doesn't matter, anything between f2 and f6). A Login prompt will appear.
- Login as a normal user
- Run startx -- :11 (This runs a new X session using virtual display :11. If it complains you can try to increment this number until you find a free virtual display to use. You need to define :11 since the first X session will take :10, the default, so your boxee user will almost always be using it)
This will spawn a new x session using whatever WM you've setup for the normal user, while keeping the auto-launched boxee session alive. You can switch between them using ctrl-alt-f8 and ctrl-alt-f9 (the function key number is determined by the linux distro, so it may be different. Just keep using different f keys, you'll find them)
Bookmarks