PDA

View Full Version : Extending window decorator themes in gnome


Kevin
March 28th, 2007, 06:14 AM
Ok, so we have gtk-window-decorator currently on compiz. Currently this does two things:
1. Provides a default theme that takes advantage of a composited environment. (Rounded corners, transparency, nice fonts, etc)
2. A wrapper that displays metacity themes on compiz. It has the ability to provide some features such as transparency, but that's about it.

Then we have emerald for beryl, now available for compiz. This provides a decorator that has the ability to display nice composited borders. The problem with beryl's emerald, is that in its quest to be DE independent, it needs its own theme-manager, its not integrated into DE specific tools, etc.

Now, there has been talk on th emailing list about using libdecoration to implement an svg decorator. But this could also have the same problems as emerald, needing its own theme managers, not integrated into gnome, etc. So I had an idea on which direction to take in implementing a new decorator that can be easily integrated into gnome, while still taking advantage of new features available in a composited environment.

The idea is actually quite simple.

First we would extend the current g-w-d to support themes that are svg based.

Themes for the extended g-w-d would be placed in the same method that metacity themes currently are. Themes right now are placed in /usr/share/themes or ~.themes. Within that, there is a folder for each theme, containing a gtkrc file, and a folder containing the metacity theme. There is also the index.theme file, which contains translations of the theme name, as well as the name of the gtk and metacity themes in the following two lines:

GtkTheme=Clearlooks
MetacityTheme=Clearlooks

I would propose adding a line to this file, like so

gwdTheme=NameofTheme

And then having a folder in the theme folder containing the files for the gwd theme. Since the metacity theme is in Metacity-1, I would think something like gwd-1, allowing for new versions of the decorator. This folder would contain the svg files, as well as somthing like an xml file detailing settings specific to the theme, such as button placement.

Next, the current gnome theme applet, would be extended to have a tab in the advanced options, similar to the current Metacity tab, to allow selecting the gwd theme independent of the overall theme. This tab would be written as a patch to the gnome themes applet, so that it could be submitted to gnome, and either integrated into gnome, or applied at the discretion of distros until its default.

If the index.theme file did not contain a gwdTheme line, the decorator would simply use the current method of using the metacity theme.

So as a quick example of this, I'll give an example. The current default gwd theme is clearly a composited version of the Suse gilouche metacity theme. So there would be a folder in /usr/share/themes called Gilouche, containing the gtk-2.0, metacity-1, and gwd-1 folders, as well as an index.theme file containing the lines:

GtkTheme=Gilouche
MetacityTheme=Gilouche
gwdTheme=Gilouche

This would make compiz use the composited version of the gilouche metacity theme if compiz is running, and the non-composited version if metacity was running.

This is the direction I think would make sense to enable composited window borders, and a similar approach could be taken with kde-window-decorator, conforming to whatever system is in kde. Any comments?

Amaranth
March 28th, 2007, 08:01 AM
One problem: We'll never get that change accepted in GNOME. :/

Kevin
March 28th, 2007, 09:44 AM
Yeah, but at least since the only part that requires a change to gnome is the patch to gnome-theme-manager, it can be implemented as a patch for distros to use, or to include in 3rd party compiz repos...

The rest is only changes to themes. If it becomes used by many distros, then I could see gnome accepting it if it is a clean patch, and if it is not visible unless compiz is installed.

RYX
March 28th, 2007, 01:56 PM
I think David' TODO-list for the decorator contains everything we need. Once we have a plugin-interface for the decorator, we can do whatever we want with it. We need an svg-plugin, not a fourth or fifth decorator which duplicates 90% of the code to implement a single new feature.

If you look at the source of gwd you will see that it is not difficult to implement a plugin-interface - David laid a good base for that. The "engine"-thing which emerald is using is only a lazy workaround for a real plugin-interface (and totally lacks extensibility).

Please - one emerald is really enough .... :D

:)

FunkyM
March 28th, 2007, 06:58 PM
Good idea. It is nice to see someone not attempting to reinvent the wheel.

Your idea would basically enable to supply a metacity theme, a SVG theme or even a different theme system, in one package.

The only issue is that all this is for GNOME and there the question rises how this will work with decorator plugins.

While I agree on the directories, it might be interesting to see what KWin does or if it would be beneficial to support KWin themes and only have one single decorator (so one plugin does KWin stuff, the other does GNOME stuff).

So basicly you could have:
~/.themes/VistaAlwaysVista/index.theme
General Theme Information
~/.themes/VistaAlwaysVista/metacity-1/
Still supports suppling old metacity themes.
~/.themes/VistaAlwaysVista/cwd-legacy-1/
Example of where a decorator plugin called "legacy" would store it's theme settings.
~/.themes/VistaAlwaysVista/cwd-svg-1/
Example of where a decorator plugin called "svg" would store it's theme settings.
~/.themes/VistaAlwaysVista/cwd-emerald-1/
Store an emerald theme here.

The respective subfolders are plugin-specific and it is even possible to supply one theme for each individual plugin (so my VistaAlwaysVista theme might come in metacity, svg and legacy versions alongside a compisted GTK-2.0 drawing engine).

The decorator plugins would define their path and the metacity plugin would use "metacity-1" for backwards compatibility.

However, I think once you introduce plugins to the decoration system, you will have to have plugin-specific configuration tools, since any API normalization would decrease the functionality of the whole plugin idea.

It is already happening that Compiz is tighter glued into GNOME and KDE. I think upstream patches are always a good idea, even if they are only available with condifitional autofoo.

@RYX: I think his ideas do not conflict with the planned plugin decorator. Actually they really add some value as there will be a question on how to store themes for a plugin based decorator aswell. This idea could work for exactly that scenario.

Kevin
March 28th, 2007, 07:14 PM
Well I never said anything about engines :) Although I suppose there could be support for them, I think simply an svg engine would be enough.

And yes, this is tied to gnome, but then that's why its an extension to gtk-window-decorator :) I definitely think its a good idea for kde-window-decorator to have something quite similar, but it would be better if that was tied into kde themes, however they are currently implemented in kde.

RYX
March 28th, 2007, 11:34 PM
Yes, you're right - I think I too quickly read the post and didn't get the full sense behind it :)

It is indeed a good idea and would integrate well with the common and traditional way gtk handles its themes.

:)