Window control buttons in the panel don't respect metacity theme

Reported by Owais Lone on 2011-03-22
290
This bug affects 58 people
Affects Status Importance Assigned to Milestone
Unity
Medium
Unassigned
unity (Ubuntu)
Medium
Unassigned

Bug Description

I've noticed that Unity panel uses hard coded window control buttons for Ambiance and Radiance gtk themes. It uses a generic set of buttons for all other themes. It should take the buttons from the metacity theme in use.

Mirco Müller (macslow) on 2011-03-25
Changed in unity:
status: New → Confirmed
importance: Undecided → Medium
Didier Roche (didrocks) on 2011-03-29
Changed in unity (Ubuntu):
status: New → Confirmed
Changed in unity:
assignee: nobody → Marco Biscaro (marcobiscaro2112)
Changed in unity (Ubuntu):
status: Confirmed → In Progress
Changed in unity:
status: Confirmed → In Progress

I though it would be easier, but I couldn't find any info of how to get the button from metacity theme as a GdkPixbuf (considering that some themes simply haven't image: the buttons are rendered by a set of drawing operations described on XML theme file).

If someone can give me a direction, I can work on this bug. Otherwise, I'll remove my assignee of it.

Thanks!

Changed in unity:
status: In Progress → Confirmed
Changed in unity (Ubuntu):
status: In Progress → Confirmed

Is there a way to find out what styles Gnome is applying? If so, it would be a matter of having Unity peek inside the config file(s) and implement the buttons itself.

I say styles in plural because it's quite possible that someone could have a mix of styles applied. (Buttons from this theme, window decoration from that theme, etc.)

@Paul: The great problem here is that even a simple theme (see /usr/share/themes/Simple/metacity-1/metacity-theme-1.xml) uses relativelly complex operations to determine how the buttons should be drawn.

Metacity window manager already parses all this info and renders the window decoration button, but I can't find a way to get this parsed info as an image.

Owais Lone (loneowais) wrote :

How about using the code snippet from metacity itself and porting it to unity-panel

Owais Lone (loneowais) wrote :

or unity-window-decorator

whatever handles those buttons.

@Owais: indicator-appmenu handles all that. And that would be one way of handling this, as both Gnome and Unity are licensed under the GPL. However, there's the question of copyright.

@Marco: How is Unity getting the buttons for Ambiance and Radiance? Does it just hack it by detecting those two themes and then displaying the appropriate buttons? If so, could a "back-door" be put in place so users could say "use these graphics instead?" It'd be be ugly and less than ideal, but it'd be a start.

I'm concerned about mixing the GTK theme for the panel and the Metacity
theme for the buttons that are a part of that same panel. It won't help
theme authors (or users gluing together metathemes) to have this weird
behaviour where two things that appear in the same place (and are meant to
blend together) are defined in completely different themes and theme
formats.

Please consider how these two elements can be kept together :)

Owais Lone (loneowais) wrote :

@Dylan Unfortunately, this has been the case for ever on the Gnome desktop and I'm afraid we might not be able to use Gnome-Shell's title bar theming in future as it is mutter based and we are still on metacity.

For Natty,
If this cannot be achieved, lets patch metacity to use ambiacen, radiance buttons for light themes and force the generic buttons on every other theme. At least, we'll not have different button in the panel and the titlebar. I'm afraid it might be too late for such a move.

@Dylan: As I understand, the selected GTK theme controls the look of both Gnome Panels and Metacity, so I'm not sure where you're coming from on separate/different themes. Unless you're talking about how Unity disregards the GTK theme.

@Owasis I would highly recommend against that as people who don't use Unity, or disable indicator-appmenu, would be rightly annoyed. As it is now, I'm using Dichotomy and "putting up" with the wrong buttons in indicator-appmenu. If Metacity were to toss out Dichotomy's defined buttons on un-maximized windows just for Unity's sake, I'd be jacked.

Owais Lone (loneowais) wrote :

@Paul No, GTK theme only styles the gtkWidgets not the window decoration. Window decoration is handled by metacity or emerald.

I personally would prefer a not-so-cool theme everywhere than to have a two different awesome themes in two places but probably you are right.

I think we need a new window decorator all together. Resurrect emerald anyone?

and my name is Owais not Owasis. Looks like a typo but a lot of people unfamiliar with the name call me that. I don't know why :)

@Paul: currently, unity is loading the image for button using a fixed path for [Amb|Rad]iance themes (see http://bazaar.launchpad.net/~unity-team/unity/trunk/view/1078/src/PanelStyle.cpp#L160).

If using another theme, the fallback buttons are used.

I've took a look on unity-window-decorator, but it just call the same methods on metacity to render the buttons (and I don't find any way to get this as an image instead).

I'll take a look on indicator-appmenu now.

@Owais: Sorry about that. Despite staring at it a bit to make sure I got it right, I still messed it up.

@Marco: Wow, I didn't know Unity had its own window decorator. I though it was completely up to Metacity. Explains how overlay scroll bars work now, and some of the confusion.

BTW I filed bug 745457 which was originally concerning only indicator-appmenu, but it got marked as a dupe and the affected status changed from indicator-appmenu to unity(Ubuntu). I had a snapshot uploaded there, and looking back it should have been enough to show that it wasn't unity's window decorator but indicator-appmenu as you can see the Ubuntu logo.

I can see how it's all related, but should this be two bugs instead of one? Or is there a common code base that will fix it in both spots?

Owais Lone (loneowais) wrote :

@Paul I believe it is still metacity and unity-window-decorator wraps around it to achieve stuff. Probably long term plans are to turn unity-decorator into a full fledged decorator and replace metacity.

@Paul: the problem is not on indicator-appmenu, but on unity. It's unity that renders the buttons of maximized windows on unity panel. So, this is just one bug, and it's on unity.

And as Owais said, unity-window-decorator just wraps metacity (it was what I tried to say, but I've expressed it badly).

So, any other ideas?

Changed in unity:
assignee: Marco Biscaro (marcobiscaro2112) → nobody
tags: added: oneiric too-late

How about we provide the option to remove the buttons and just show them where the user wants them? For some themes this might be a good solution.

@Roland: sorry, I didn't understand... You mean remove all buttons from panel when the window is maximized?

Another issue, IMHO, concerns the position of the buttons: it doesn't respect the position specified in the theme.
I changed the Ambience theme in order to move the control buttons of every window in the top-right corner.
The buttons in the global menu, however, are displayed always on the top-left side.
I don't know if I should file a different bug, but I think this issue matches the title of this one.

Can somebody at least change the fallback theme to the ambiance buttons? So you can change the gtk theme and keep the ambiance window decoration without that ugliness.

Omer Akram (om26er) on 2011-07-07
Changed in unity (Ubuntu):
importance: Undecided → Medium

What I meant was what if we let the windows show the border optionally and remove the buttons from the panel (like if you are using a different decorator for example).

Owais Lone (loneowais) wrote :

What is the state of this bug. Is anyone on it ?

After reading Mark's post about Unity in 11.10 (http://www.markshuttleworth.com/archives/717), I'm getting really worried as he says that screenshot is the target. Damn, we have those generic button in the panel there for Ambiance theme. I thought this was just a minor hiccup in the development cycle of Oneiric and ambiance buttons will come back until I read that post. I'm a little skeptical about it now.

Can anyone at least confirm that the buttons in panel will at least use light theme controls?

Jeremy Bicha (jbicha) wrote :

Marco, could we please have the Ambiance buttons used in the menu bar as the fallback theme like Dimitris requested?

Owais Lone (loneowais) wrote :

This has been fixed. Check /usr/share/themes/ambiance/unity, you'll find buttons there which are loaded into panel. So, yes Unity window control buttons are now themable.

Changed in unity:
status: Confirmed → Fix Released
Changed in unity (Ubuntu):
status: Confirmed → Fix Released

It's themable when the theme is designed to support unity. And when it is not? The ambiance buttons will be used as fallback?

Owais Lone (loneowais) wrote :

When it is not then generic buttons will be used. Ambiance buttons cannot be used as they might not fit in very well with a range of panel colors. Generic buttons are recognizable on all colours.

Sam Spilsbury (smspillaz) wrote :

On Apr 6, 2011 6:35 AM, "Marco Biscaro" <email address hidden> wrote:
> I though it would be easier, but I couldn't find any info of how to get
> the button from metacity theme as a GdkPixbuf (considering that some
> themes simply haven't image: the buttons are rendered by a set of
> drawing operations described on XML theme file).
>
> If someone can give me a direction, I can work on this bug. Otherwise,
> I'll remove my assignee of it.
>
> Thanks!
>
> ** Changed in: unity
> Status: In Progress => Confirmed
>
> ** Changed in: unity (Ubuntu)
> Status: In Progress => Confirmed
>
> --
> You received this bug notification because you are a member of Unity
> Bugs, which is subscribed to unity in Ubuntu.
> https://bugs.launchpad.net/bugs/740232
>
> Title:
> Window control buttons in the panel don't respect metacity theme
>
> Status in Unity:
> Confirmed
> Status in “unity” package in Ubuntu:
> Confirmed
>
> Bug description:
> I've noticed that Unity panel uses hard coded window control buttons
> for Ambiance and Radiance gtk themes. It uses a generic set of buttons
> for all other themes. It should take the buttons from the metacity
> theme in use.

How to fix the disorder of the buttons windows?
I want to have the buttons to the left but in other order. When i change it in gconf-editor (minimize,maximize,close:) only change when it is not maximized.
Example:
http://i869.photobucket.com/albums/ab253/Forodefinitivo/unitybug1.png
http://i869.photobucket.com/albums/ab253/Forodefinitivo/unitybug2.png
I wanted like the second picture.

So If I am wrong of posting here PLEASE show me where i have to note this or how i would had to do it.

Thank you.

leo (leo-leo-sa) wrote :

Would it be too hard to just open the gtkrc of the current theme and look for a class like "UnityButtons" that points to the png files of the three buttons?

That way, all that theme authors have to do is to add extra pngs of the buttons to their theme folder, and add something like this to the bottom of the gtkrc:

style "unity-buttons"
{
close = "close.png"
minimize = "minimize.png"
maximize = "maximize.png"
}

class "UnityButtons" style "unity-buttons"

Just an idea...

flyingfisch (flyingfisch) wrote :

I'm still having this problem in Oneiric. Should I report this as a separate bug?

luk1don (luk1don) wrote :

"This has been fixed. Check /usr/share/themes/ambiance/unity, you'll find buttons there which are loaded into panel. So, yes Unity window control buttons are now themable."

OK.

@Owais: Please tell me where are the settings of main panel buttons layout (maximized window), left/right side?

Owais Lone (loneowais) wrote :

@luk1don, you can't do that. Having that as possibility would break unity's design. You can just ship buttons for maximized window but there are not any customization settings.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers