KDE2.0 Widget Themes

From the KDE Widget Theme Tutorial:


Some terms explained

At the very basic level KDE widget themes and styles are accomplished by allowing programmers to reimplement how widgets are painted as well as some user interaction parameters. When the developer makes a complete set of routines to draw all of the widgets this is called a "style". Examples of widget styles in KDE are Platinum, CDE, Windows, Motif, KStep, and Pillbox.

In KDE, one of these styles can read a configuration file to determine how widgets should be drawn. This configuration file is called a "theme", and is what most of this tutorial focuses on. Examples of widget themes in KDE include System and Marble.

Feature overview


Some Examples

As explained above, there are two basic type of widget styles supported by KDE: those that support themes and those that don't. One may ask why if themed plugins are so fast would someone want to use an unthemed style? Well, for one a lot of people simply don't like pixmaps and gradients all over their user interface ;-) Another reason is that while KDE widget themes are fast and low on memory they do of course use more resources than styles that don't use the extensive graphics. You don't get something for nothing, although I do try to keep the price as low as possible :) People even on low end systems should get decent performance. Finally, many people can't stand wasting any resources on something like pretty pictures, even is the cost is low. For these reasons I spend a lot of time designing unthemed as well as themed styles.

Let's first look at the unthemed widget styles. These screenshots use a combination of unthemed widget and KWin styles:

Widget style KWin style Screen shot
B2/K B2/K  
CDE B2/K  
KStep KStep  
Platinum System  
Pillbox System  
Win Standard  

 

KWin Styles - Streamlining The Window Manager

KWin supports a similar plugin mechanism as widgets to control how windows look. This means that KWin itself is just a very streamlined window manager, and then you can choose plugins that control how windows are rendered. In this manner you can choose exactly how KWin looks and how much overhead it contains. You can choose a plugin that is very small and does simple window rendering, a large plugin that does sophisticated rendering, or a themed plugin. And of course, since the theme and style engines are all plugins developers can write whole new engines that do things I can't even think of.

Currently KWin supports several dedicated style plugins and one themed one. The dedicated styles so far are: Standard (the old KDE style with some improvements), B2/K (A Beos-like style), KStep (A Next-like style), and System (a rounded Mac-like style). You can see screenshots of all of these in the above section.

Another thing to note is that since KWin is a KDE application it can also automatically integrate with widget themes. If you set a widget theme KWin can automatically use it's pixmaps with no additional configuration or coding required. The widget theme engine and KDE takes care of everything, from a development perspective you are drawing with the same brushes you used with unthemed styles. No additional code or effort needed. For example, the following shows the same KWin style, system, being used under different widget themes:


This is the "System" KWin style plugin with no widget theme.


This is the same plugin, but used with the System widget theme. No additional coding or configuration was needed to make it use the widget theme's background.


And finally this is the same plugin but with a different widget theme: Marble.

Also interesting to note is that since many of these styles are coded plugins they can do things themes cannot, such as automatically adjust the window decorations to the current color scheme. For example, below is the active window in the B2 style under two different color schemes:

 

KWM Theme Support

Recently I started on KWM compatible theme support as well. Like all the other styles except Standard, this is a plugin and dynamically loaded when selected. This is intended to allow users to use the hundreds of themes available for KDE 1.x with the new window manager. You can see a screenshot of it's progress below: