Re: Question about CSS and documentation



Il giorno dom, 22/05/2011 alle 14.45 +0800, Shu Hung (Koala) ha scritto:
> Hello,
> 
> I'm new to gnome-shell and I love it. Thanks for your work.
> 
> I'm trying to tweak the UI a bit for my taste. For example, I'm trying
> to make my window title bar transparent. I'm a web developer and I'm
> familiar with CSS. I know gnome-shell has a javascript binding and can
> be control through CSS. That made me think that it would be easy.
> Apparently, its not.
> 
> 
> About CSS
> 
> Gnome-shell is not HTML after all. I couldn't trace the plain HTML
> code and find the correct element to style on. I'm not familiar with
> the C language, that stops me from studying the source code of
> gnome-shell to understand it completely. I'm sure many web developer
> would be as confuse as I do. If I don't know what elements are in the
> UI, I couldn't style them. That stops web developers from making more
> styles for Gnome Shell.

HTML elements in the Shell become Clutter Actors. Just read shell code
(it is mostly Javascript, so it should be easy for you) and look for
objects in the St and Shell namespaces.

> The main issue is: I found no documentation on CSS or UI elements. I
> don't know what is the right element for me to change. Nor do I know
> if there is any.

Yes, currently there is no documentation. You should look in the default
theme and try to guess from that. You can also use the inspector from
the looking glass (alt-f2 "lg", then click on the color picker icon on
the top left), which will show the GType name (used like the element
name in CSS), style class and pseudo-class of each Shell widget.

> 
> User-independent style / local style
> 
> Another problem is about user-independent style. In short: is it
> possible to style different users differently?
> 
> If I change /usr/share/gnome-shell/theme/gnome-shell.css, the changes
> go global. For extension, I can put the extension
> in ~/.local/share/gnome-shell/extensions. I thought I could put theme
> in ~/.local/share/gnome-shell/theme to do similar thing. But it
> doesn't seem to work. My style sheet
> ~/.local/share/gnome-shell/theme/gnome-shell.css is not effective.
> Either it is not read or it couldn't override settings
> in /usr/share/gnome-shell/theme/gnome-shell.css.

By default, only $(datadir)/gnome-shell/theme/gnome-shell.css is read
($(datadir) depends on where you install gnome-shell, it's /usr/share if
you use distro packages). You need to install the user-theme extensions
to load additional themes from
~/.themes/ThemeName/gnome-shell/gnome-shell.css.

> 
> So my questions are:
>      1. How to change the window titles to transparent?

Window decorations are not handled by the Shell but by libmutter, and
use the standard Metacity theme format, which is described in
http://developer.gnome.org/creating-metacity-themes/stable/ plus various
text files in mutter git repository.
Also, metacity themes can be chosen with GConf
key /desktop/gnome/shell/windows/theme and are installed in
~/.themes/ThemeName/metacity-1/metacity-theme-3.xml

>      1. Is there any documentation on the UI elements or CSS for Gnome
>         Shell? If not, will there be any?

Currently, no.

>      1. Can we do local style for each single user?

Only with user-theme extension. It was proposed to move this
functionality to the Shell, but it was rejected precisely because there
is no documentation on the format and Shell developer don't want to make
any guarantee on widget hierarchies, style class names or CSS property
syntax (except for what is also standard CSS2.1)

Giovanni

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]