I want to run both XBMC and Mthfrontend on my htpc’s. I record a lot of free to air, and XBMC’s PVR plugins are still just too far away from myth’s functionalty, however xbmc is better with some media/streaming applications. So I’d like to switch between the two when needed.
XBMC has a issue however where in fullscreen it blocks keystroked going to anything else, including the window manager, so some extra help is required to switch from a fullscreen xbmc back to mythtv.
Bring on chvt, a command line tool that will let you switch virtual terminals!
I decided it’s best for me to keep xbmc on a separate xserver, which can be separately managed. Then behind the scenes use chvt to switch between the two x servers.
Firstly, it will need an init script to start xbmc on startup. I use linux mint so it’s upstart all the way for startup scripts
# starts XBMC on startup by using xinit.
# by default runs as xbmc, to change edit below.
author "Andrew Leech, based on script by Matt Filetto"
start on ((filesystem
and runlevel [!06]
and started dbus
or runlevel PREVLEVEL=S)
stop on runlevel 
# tell upstart to respawn the process if abnormal exit
exec su -c "xinit /usr/bin/xbmc-standalone -- :1 -nocursor" $USER
Switching back and forth
I wrote myself a nice python daemon to switch between the two.
On debian/ubuntu (upstart) copy switch-destop-macro.conf to /etc/init
Edit it to ensure the path to the main script is right, then either reboot or start it:
sudo service switch-destop-macro start
It’ll run as a daemon watching for the defined keystrokes and then switching back and forth between xbmc and myth. The keystrokes already in the script correspond to convenient keys on my multiple remotes, one of which is \
It’ll log keystrokes (in X) to /var/log/upstart/switch-desktop-macro.log which is a massive security hole, so you should disable the logging once you’ve used it to figure out the keystrokes you want as your macro.
Then I had problems with dead cursors in the middle of my mythfrontend x session when I switched back to it. Best method I’ve found to fix it so far is to simply disable the corsor altogether, by adding the -nocursor arg to xserver config.
/etc/mdm/mdm.conf : added to bottom:
command=/usr/bin/X -audit 0 -nocursor
So, by default mythfrontend will control either the Master or PCM (alsa) audio mixer control. XBMC on the other hand ignores hardware mixers and changes the volume in software.
This means if you turn the volume down in myth, it limits the max volume in xbmc to the new level in myth. Not a good result.
Mythtv does have a built in software volume control however in my experience it really damages the quality of the audio.
Also, if one of the two applications holds open a normal alsa device, it means the other can’t get to it.
I should probably go the route of trying to get pulseaudio working for me, although I always end up finding it working against me. To date I’ve gone down a more convoluted path with alsa
Trick 1: use a dmix alsa device for both programs so they can share the audio
Trick 2: create an alsa softvol device for mythtv so you can leave the hardware mixer at full
Trick 3: map a new fake Master or PCM mixer to the softvol so mythtv will use it by default
The third one is the most hit and miss to set up as it required you to have a hardware alsa device that’s missing either Master or PCM, such that we can map softvol to it, as you can’t override an exiting volume slider and I couldn’t get myth to use anything other than a Master or PCM control. I also haven’t found any way to add a new fake control device to alsa to attach the slider too. Luckily so far my motherboards have generally had a separate hw device with only a couple of digital out volumes on them to use.
To check run alsamixer, hit F6 and go through each of the devices listed to see if one of them is missing Master and/or PCM
Here’s my ~/.asoundrc
This creates a dmix device which sits over card 0, my default analog out card as seen in alsamixer.
This dmix gets set to the default output, xbmc uses it seamlessly then.
I also make a softvol device which sits over the dmix, with it’s control called Master and attached to card 1, which was missing a Master control.
Mythfrontend is then configured manually to use the softvol device, a keyboard helps here:
- Go to Settings -> Audio
- In Audio output device type:
- I have all the dolby checkboxes off and Speaker configuration set to Stereo as that’s how I roll, if you’ve got
surround you’ll have to modify settings accordingly. I haven’t changed and of the Advanced Audio Settings behind the button half way down the screen.
- Go to Next
- Ensure “Use internal volume controls” is enabled
- Set “Mixer device” (change card number to match that in the softvol ctrl section):
- Set “Mixer control” (change to name set in softvol control):
That’s it, hopefully it’ll work for you. I tried Mixer control with arbitrarily named controls and it simply did not work at all, I had to stick to one of the two listed names. Probably should fix that in source and pull request it, however my current solution works for me even if it’s pretty hacky.