Feature that you will be almost certainly want is that your box boots without any unnecessary interaction - when you press the power button, after some time TV playback has to pop up. Two things has to be met for this to work properly:
- your X login (display) manager must automatically authenticate user tv
- upon logging in, all applications must start immediately, global keyboard shortcuts must be remapped etc.
Merely for historical reasons and because I'm using it also on my laptop, I have choose kdm as login manager and will provide here only info on how to setup that tool. gdm or even xdm are also good, but exact configuration of that login managers you will have to find somewhere else.
Autologin
kdm is configured either through KDE's kcontrol application (look for System administration -> Login manager) or directly by editing file /etc/kde3/kdm/kdmrc. In the end, result is the same: kdmrc file should have these four lines in "Core" section for tv's graphical console:
AutoLoginEnable=true
AutoLoginUser=tv
NoPassEnable=true
NoPassUsers=tv
Automatic application startup
That solved autologin feature, but we still have to perform startup tasks once tv users logs in X session. For that task, we'll create file named .xsession and place it in tv's home folder. That script will be used to start our X applications and perform initialization. After it finishes, X session finishes too and we are back to kdm's login screen. But before we start writing that script, just check your /etc/X11/Xsession.options file does it include the line "allow-user-xsession".
.xsession is basically a simple shell script like any other, but since it serves as "container" for our whole X login session it can't execute and finish like regular script. Instead, last line of this script should start one program that acts as "holder" for X session, usually it is window manager itself - when that application finishes, .xsession script exits and our whole X session is closed, sending us back to login manager. What we'll do in this script is perform all required initialization like:
map global keyboard shortcuts via xmodmap
disable screen saver, DPMS and related features
set desktop background
start services that must be ran as user tv like onscreend for OSD messages, perhaps xmms2-launcher in the future etc.
of course, we'll initialize all HTPC components
finally, we'll switch to TV playback component (or any other in which you want your HTPC to boot)
Complete .xsession script can be found in download section and doesn't need any further explanation, except the way that the window manager is started. Since we depend heavily on wmctrl tool on boot (to activate all application's windows and bring them to fullscreen on their respective virtual desktops) we need window manager functionality before we start applications, so we can't start it in usual manner as holder application for entire .xsession script. Little hack is required to first start window manager, remember its PID and that hold .xsession execution via wait command in the last line that blocks execution until process with given PID exits.
Two graphical consoles
One little hack that proven to be extremely useful is enabling two different graphical virtual terminals - basically two separate X sessions that can run simultaneously. Default one will be used to autologin user tv and serve as usual HTPC interface and other will provide interactive login for another users with "regular" X sessions (full KDE or such) for maintenance or other tasks. For configuring these two, look for my kdmrc file in download section which defines default HTPC graphical terminal on VT8 using DISPLAY :1, and VT7 using DISPLAY :0 is left for interactive logins. You can switch between those two by pressing Ctrl+Alt+F7/F8 on your keyboard.





