segunda-feira, 6 de agosto de 2012

Deuglifying KDE on Ubuntu 12.04 Precise

Growing and maintaining a consistent Linux distribution like Ubuntu up to date is a very serious job. Making money from it to support further developments is another one. Canonical chose GNOME at first and pushed Unity afterwards. They made a beautiful and well integrated desktop that is a pleasure to use. We are certainly thankful.

What if you like KDE? Oh well, we can't all be happy. Or can we?

The integration of KDE on Ubuntu (in fact even Kubuntu) is not exactly the most polished thing in the world (let's not mention the default wallpaper... :-) . But that can be fixed and once done doesn't seem that difficult.

The fix is made of two steps, on top of the default Ubuntu 12.04 installation:

1) Choose your KDE based applications. Remove redundant GNOME based applications
apt-get install kde-plasma-desktop khelpcenter4 kdeartwork kdeartwork-style plasma-desktopthemes-artwork kde-artwork-active kde-wallpapers kdewallpapers plasma-widgets-addons kde-l10n-pt ksnapshot gtk2-engines-oxygen gtk3-engines-oxygen libreoffice-kde kontact okular smplayer gwenview ark
apt-get remove totem empathy evince brasero evolution rhythmbox shotwell konqueror file-roller nautilus eog
This will bring you a desktop with a set of applications that work well together and nicely fit a KDE desktop.

2) Prepare the contents of .kde and install them on /etc/skel

Note: it you don't know what /etc/skel is please read a correct explanation here.

This is a surgical step that will ensure you only have to customize users once. Proceed as follows: 2.1 )backup your default .kde
cp -R .kde dot_kde
2.2) Change whatever has to be changed in the GUI (menus, panels, desktop, etc) 2.3) Detect configuration file changes
diff -qr .kde dot_kde
2.4) Sanitize the content of your configuration files

This not an algorithmic step but something to learn from inspection, trial and error. In the cleanup process is important to remove any references to the specific user you are logged in with (ex: references to Recent Files), and unnecessary geometry related references (ex: absolute dimensions of a panel) that should be calculated on the first login.

2.5) Install the modified files from .kde/share/config and .kde/share/apps under /etc/skel/.kde ...

2.6) Create a new user and login. If it's not as you want it go back to step 2.2)


3) Other configuration files

Follow the same logic for all other application configuration files. For example, if you use SMPlayer as a media player you may want  to preconfigure it on

/etc/skel/.config/smplayer/smplayer.ini. 

You may also want to configure GTK so that GTK base applications look good under KDE

/etc/skel/.gtkrc-2.0
/etc/skel/.config/gtk-3.0/settings.ini
Here is an example of settings.ini

[Settings]
gtk-theme-name=oxygen-gtk
gtk-icon-theme-name=oxygen-old
gtk-font-name=Sans 10
gtk-cursor-theme-name=DMZ-White
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
Once done, this will make GTK based applications use a theme that somewhat matches the looks of KDE applications, unlike the default theme that doesn't look good at all under KDE.


4) Enjoy effortless KDE installations

If things went right you can now add/remove the packages and install the skel configuration files on a post-install script. The result could look like this.