KompSwitch: Ubuntu DVD Fix

I recently installed Ubuntu on another computer and this weekend ran into a little issue. As you may know, DVD playback is not automatically enabled in Ubuntu for legal purposes--you can enable it by following the 3 quick steps in the Ubuntu tutorial.

But once that was taken care of, whenever I started playing a DVD it skipped miserably, flashed and flickered, and overlapped other windows. So after a while of messing with it, I found out that the problem was with compositing features.

So, I wrote KompSwitch to allow one-click DVD playback in Ubuntu.

Possible Solutions

In order to end the flickering and flashing, you just have to turn off visual effects. Well, if you're like me and really like your display and don't want to settle for a flat (boring) environment--you're kind of stuck.

You can either

  • live without effects and use metacity,
  • edit your xorg.conf file to disable compositing and restart your computer every time you watch a DVD,
  • go into the terminal and manually turn compiz off and back on every time,
  • or install a program that puts an icon in your tray so you can select which manager to use at any time without restarting, awesome tool, but still too much work to go through a menu every time.

Necessity: The Mother of All Invention

So KompSwitch was born last night. It's just a small script to use to temporarily disable some of the main problems that cause the skipping, flashing, and flickering with Ubuntu DVD playback. Then, as soon as your movie is over, it will turn things right back to the way they were, without any interaction or effort on your part.

The Fix

  1. Open up Terminal (or any command line interface) Applications > Accessories > Terminal
  2. Download the installer

    wget http://www.aculade.com/articles/2008/Dec/kompswitch/kompswitch.install.php -O kompswitch.install

  3. Make the installer executable

    chmod u+x kompswitch.install

  4. Run the installation script

    ~/kompswitch.install --auto

    (if you want to choose the DVD player yourself, do not include the --auto part).
  5. Done! There is now an icon on your Desktop called KompSwitch Play DVD.

If you don't want an icon or prefer the command line, you can also run KompSwitch with

~/kompswitch [--player PLAYER]

Include the --player option if you want to explicitly set which DVD player to use, such as totem, vlc, etc.

Could it be any easier? Hope it helps you Ubuntu/Kubuntu/Xubuntu users.

Finishing Touches

You can give the installer a cool icon by right clicking the desktop icon, clicking the spring board icon, and selecting a suitable image.

If you like a clean desktop, you can always add the desktop launcher to your panel by dragging the desktop launcher onto it and deleting the desktop one.

If you don't like using the DVD player currently selected, you can rerun the installation to reconfigure

~/kompswitch --uninstall
cd ~
wget http://www.aculade.com/articles/2008/Dec/kompswitch/kompswitch.install.php -O kompswitch.install
chmod u+x kompswitch.install

You will then have the option to tell the script which DVD player to use.

If for any reason you should choose to remove kompswitch, a complete removal can be invoked by

~/kompswitch --uninstall

Possible Considerations

If you are having the same problem in Kubuntu or Xubuntu, you will have to change the MAIN_DE and TEMP_DE values to whichever applies to your flavor of Ubuntu.

If your DVD drive can not be found from /dev/dvd, you will have to change the DVD_DRIVE value to the location of your drive.

Both of these can easily be changed by editing the top few lines in the script.

pico ~/kompswitch

If you're having any problems, you can drop me an email.

Source Code

The source code is released as "free software" under the GNU General Public License. You are given the code source and are free to adapt it to your needs as allowed in the GNU General Public License.

KompSwitch Code (text)
KompSwitch Installer Code (text)
License (text)
Generic desktop launcher (text)

About Me

Hi, I'm Stephen Parker, and I am a web developer and application programmer in Jacksonville, Florida.

If you'd like to discuss your project or get a quote, contact me.

Featured Projects

floht Groups Schedule Bucket Every Heart Photography

Recent Posts

OMEGA Chapter Discount
OMEGA Chapter Redesign
Schedule Bucket
OCv2 Released
KompSwitch: Ubuntu DVD Fix


Everybody loves freebies! Here's a list of recent free images, scripts, programs, and other things you might find useful. Enjoy!

KompSwitch: Ubuntu DVD Fix (article)

I'm currently available for new projects