| Using Cowbell: The CSS on window borders experimental layout language | ||
|---|---|---|
| Prev | ||
There are many paths in the future of this project. Some or all of them may be taken. The readers are invited to advocate for any they favour, and to suggest others.
Almost every Cowbell CSS file contains a series of predictable rules, one for each button:
button.menu { width:200px; height:200px; background-image: url('menu.png'); }
button.close { width:200px; height:200px; background-image: url('close.png'); }
button.maximize { width:200px; height:200px; background-image: url('maximize.png'); }
button.minimize { width:200px; height:200px; background-image: url('minimize.png'); }
button.shade { width:200px; height:200px; background-image: url('shade.png'); }
button.stick { width:200px; height:200px; background-image: url('stick.png'); }
button.above { width:200px; height:200px; background-image: url('above.png'); }
It would make sense for Cowbell to check whether there were files named button-*.png in the theme directory, and for each one assume such a rule automatically. Rules in the theme would override such implicit rules.
Metacity themes are currently shipped in a zipfile or tarball, which must be unpacked before use. It may be more helpful if they can be used in the shipping format.
This may be accomplished by allowing Metacity to read files out of tarballs.
It is also possible that we can use data: URLs in order to keep all referents in the same file. Code for this is already written but is not shipping.
There is currently no way for buttons to change their appearance when pressed or prelighted. This could clearly be achieved using the :hover and :active pseudoclasses. This functionality is not present in the current version; it will be in a later version.
It would be helpful if a particular signal made Metacity dump its parse tree of the CSS of the current theme, and the calculated coordinates of all the elements. This would also be useful in writing automated tests.
There are plans for a simple interactive editor which will allow you to change the colours, alignment, and so on on the fly.
In a future release, it will be possible for themes to show no title. This will make themes such as Prelude possible under Cowbell.
This will be acheived as follows:
title { display: none; }
area.titlebar { height: 15px; }
The height of area.titlebar will default to some sensible value.
Similarly, it should be possible to remove buttons using display: none;. This would allow use of the common pattern where unfocused windows have no controls.
Metacity should parse the theme's metadata (see Section 4) and refuse to load a theme where it is missing or clearly erroneous.
At present, only literal colours can be used. We need to support colours based on the GTK theme as well.
It may make sense to allow themes to inherit settings from other themes. This would introduce dependency problems, however.
Internet Explorer has a custom CSS property called -ms-filter that allows various graphical effects to be added to elements. We should do something similar. In particular, we need:
-cowbell-color to alter the hue of an element. This would allow images to be altered to fit a theme's colour scheme, even if that colour scheme was based on GTK colours and so unknown when the theme was written. Something similar to this is present in the standard Metacity theme format.
-cowbell-blur to blur an element. This could be used to emphasise that a window is unfocused.
-cowbell-flip, or -cowbell-mirror, or -cowbell-rotate, so that images do not have to be supplied separately for each edge or corner.
The window manager is capable of adding other buttons than the standard seven, but this has never been done in the past because instructions for drawing them would need to be added to every theme.
Now that buttons are identified by their classes, it is possible that some file format defining new buttons could supply CSS supplemental to each theme, describing how to draw the new button. If the theme already described how to draw such a button, it would take priority.
Some possible uses for extra buttons:
"Take a screenshot of this window."
"Take a screencast of this window."
"Collaborate." (Share this window with someone else across the network.)
"Notifise." Some people would like to distinguish the action of closing a main window (and quitting the application) from the action of sending a window to the notification area, both of which are commonly done using the Close button.
In case extra buttons are in use, themes should ensure that unknown buttons degrade gracefully.
It has been suggested that an extra area could be added to fill in the space to the right of left-justified titles, to the right of left-justified titles, and either side of centred titles. The class of this area would be filler.
This would allow, for example, background decorations to tile a whole number of times yet not run under the title.
It should be possible either to give overriding CSS in GConf, or to specify an overriding stylesheet.
Cowbell-enabled Metacity only supports Cowbell themes, and standard Metacity only supports standard themes. When Cowbell is merged, it is intended that the final version will support both kinds.
It has always been the intention to design a method of styling window borders using CSS which can be adopted by multiple window managers. Mutter is an obvious candidate, but KWin and others could also be fertile targets for ports.