mate-desktop / mate-settings-daemon

MATE settings daemon
https://mate-desktop.org
GNU General Public License v2.0
43 stars 48 forks source link

xrandr-applet-popup: make a label bg matching monitor rectangles work and add icons #223

Closed lukefromdc closed 6 years ago

lukefromdc commented 6 years ago

The last commit adds subtle borders that make light themes like Menta look much better. Side effect was I had to put a minimum height on the icon, as the css seems to be added after the popup exists and the border width will thus otherwise put scrollbars on it. This is good to a 12pt text size, if we need that to be able to go larger without scrollbars I can add more height at the expense of ballooning the popup a bit vertically in more normal text sizes

xrandr_popup_w_borders_menta xrandr_popup_w_borders_usl

raveit65 commented 6 years ago

Thanks for dropping symbolic shiat, we're MATE and not gnome ;) I am just trying to use 'GTK_STYLE_PROVIDER_PRIORITY_FALLBACK' to make it possible to eliminate the bg color in themes.

raveit65 commented 6 years ago

Sigh, using GTK_STYLE_PROVIDER_PRIORITY_FALLBACK makes the label color pale again, because themes are setting an insensitive color for labels like https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/theme/Adwaita/gtk-contained.css#L65 Or like our own themes which use stupid wildcards https://github.com/mate-desktop/mate-themes/blob/master/desktop-themes/BlueMenta/gtk-3.0/gtk-widgets.css#L50 ......someday i will drop them....

Menta themes are looking perfect for me with using

/* xrandr applet */
.mate-panel-menu-bar menuitem.xrandr-applet:disabled > box > label {
    color: @menu_fg_color;
    border-style: none;
    text-shadow: none;
}

For some reasons Menta themes doesn't show me the color background here with using GTK_STYLE_PROVIDER_PRIORITY_FALLBACK

lukefromdc commented 6 years ago

What ran into was that GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and GTK_STYLE_PROVIDER_PRIORITY_THEME did not work. I will play with this some more today, I want to find a better way around the scrollbar issue and think I haveit

lukefromdc commented 6 years ago

Iif FALLBACK works with some themes but not with others, then it is a matter of finding the offending selectors in the themes. I can do a "theme bisect" in which I chop out parts of a test copy of a theme (breaking it but OK for test) until the offender is found.

raveit65 commented 6 years ago

I don't like that we have to use a color background for fixing only one theme, and all other themes are looking bad. I noticed that the border color doesn't look very nice with submarine themes. Honestly, i think it is impossible to find one setting which will work for all themes, the result will be that all themes won't be looking nice here. We can easily fix the insensitive fg color for our own themes in theme settings. Adwaita and adwaita-dark and HCI are looking Ok for me if using the insensitive color for the header. And nobody did blame us that the monitor title is unreadable in HC theme.

Well, i will except this weirdness if it is the only way to fix it. But for fedora i will hopefully find an easy solution not to use this color backgrounds.

PS: the regular icon for the monitor is a great idea.

raveit65 commented 6 years ago

Main problem in our themes are those wildcards in gtk-widget.css Eg. https://github.com/mate-desktop/mate-themes/blob/master/desktop-themes/BlueMenta/gtk-3.0/gtk-widgets.css#L50 If i delete this line the insensitive color goes away In gtk+ themes they use 'label:disabled' instead of wildcards, which make more sense Eg. https://gitlab.gnome.org/GNOME/gtk/blob/master/gtk/theme/Adwaita/gtk-contained.css#L65

lukefromdc commented 6 years ago

OK, I found out how to use FALLBACK for the background color and get it to work. In my theme (and thus probably also in BlackMATE), the offending lines are


/*************
 * images and labels *
 *************/

image,
image:hover,
image:active,
image:hover:active,
image:disabled,
label,
label:hover,
label:active,
label:hover:active,
label:disabled,
box,
box:disabled,
grid,
grid:disabled {
    background-image: none;
    background-color: transparent;
}

.mate-panel-menu-bar menuitem:disabled,
.mate-panel-menu-bar  menuitem:disabled *{
    background-image:none;
    background-color:transparent;
    border-image:none;
    border-width: 0px;
}

Unfortunately FALLBACK does not work for keeping the text black. I can leave that to themes or hardcode it black, what do you all prefer?

lukefromdc commented 6 years ago

https://github.com/mate-desktop/mate-settings-daemon/pull/223/commits/bb78656b5b36bd5f99d8779ee619287d9479c99a allows themes to override background colors. The foreground (text) color does need to be set by the theme if the disabled color is not to be used. Border-width is hardcoded so scrollbars never appear on the popup, but changing border-color to transparent should make them disappear when that is desired in a theme, as the color is set in the overrideable portion. Width and style (to avoid "none") have to be set earlier, before the widget gets its final size allocation or scrollbars appear, so that is in the hardcoded section.

https://github.com/lukefromdc/gtk-theme-ubuntustudio-legacy/commit/6e3781e3be3622d1205dd4cd89806c947e23b470 to my UbuntuStudio_Legacy theme shows how to stop themes from overriding the background colors and use a chosen color (black here) on the monitor label text. Not pushing BlackMATE changes until this is done.

lukefromdc commented 6 years ago

Same code as in the CSS will reliably allow overriding the background color and the border color, and can be used to set any text color. Only the border width (1px), style (inset if visible/not transparent), and the non-use of dimming or alpha on the icons are hardcoded and can't be overridden.

raveit65 commented 6 years ago

This works nice for me. I did some styling suggestions for our themes for better testing this PR. https://github.com/mate-desktop/mate-themes/tree/xrandr-applet-suggestions

raveit65 commented 6 years ago

Btw. i think blocks like this in theme code are old remnants from < gtk+3.20 syntax and they are save to remove from themes and they doesn't make any sense with new syntax. Sure, this needs to be tested. https://github.com/mate-desktop/mate-themes/blob/master/desktop-themes/BlueMenta/gtk-3.0/gtk-widgets.css#L95

image,
image:disabled,
label,
label:disabled,
box,
box:disabled,
grid,
grid:disabled {
    background-color: transparent;
}

Setting a transparent background color for label prevent the pink and green label backgrounds from working with using GTK_STYLE_PROVIDER_PRIORITY_FALLBACK

lukefromdc commented 6 years ago

Same code, just cleaned up the commit history a bit with a partial squash

raveit65 commented 6 years ago

ahh, cool, you merged it in other PR :)