Compare commits

...

2 Commits

Author SHA1 Message Date
Alessandro Bono
d0d0350a8c layout: Use background gradient when top bar is transparent
Make sure the legibility of top bar elements doesn't depend on the
wallpaper by adding a light gradient at the top when the top bar
is transparent, similar to what Android does.

https://bugzilla.gnome.org/show_bug.cgi?id=783913
2018-10-09 15:01:01 +02:00
Florian Müllner
e45e8a2a14 panel: Notify when solid style changes
In order to improve the transparent top bar's legibility with lighter
wallpapers, we want the background to adapt to the top bar style. To
allow for that in a clean way, export that information in a property
and notify when it changes.

https://bugzilla.gnome.org/show_bug.cgi?id=783913
2018-10-09 15:01:01 +02:00
3 changed files with 49 additions and 6 deletions

View File

@ -729,7 +729,9 @@ StScrollBar {
/* TOP BAR */ /* TOP BAR */
#panel { #panel {
background-color: rgba(0, 0, 0, 0.35); background-gradient-start: rgba(0,0,0,0.3);
background-gradient-end: rgba(0,0,0,0);
background-gradient-direction: vertical;
/* transition from solid to transparent */ /* transition from solid to transparent */
transition-duration: 500ms; transition-duration: 500ms;
font-weight: bold; font-weight: bold;
@ -748,7 +750,7 @@ StScrollBar {
.panel-corner { .panel-corner {
-panel-corner-radius: $panel-corner-radius; -panel-corner-radius: $panel-corner-radius;
-panel-corner-background-color: rgba(0, 0, 0, 0.35); -panel-corner-background-color: rgba(0, 0, 0, 0);
-panel-corner-border-width: 2px; -panel-corner-border-width: 2px;
-panel-corner-border-color: transparent; -panel-corner-border-color: transparent;
@ -768,7 +770,7 @@ StScrollBar {
-minimum-hpadding: 6px; -minimum-hpadding: 6px;
font-weight: bold; font-weight: bold;
color: #eee; color: #eee;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.9); text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.8);
transition-duration: 100ms; transition-duration: 100ms;
.app-menu-icon { .app-menu-icon {
@ -781,17 +783,17 @@ StScrollBar {
.system-status-icon, .system-status-icon,
.app-menu-icon > StIcon, .app-menu-icon > StIcon,
.popup-menu-arrow { .popup-menu-arrow {
icon-shadow: 0px 1px 2px rgba(0, 0, 0, 0.9); icon-shadow: 0px 1px 2px rgba(0, 0, 0, 0.8);
} }
&:hover { &:hover {
color: lighten($fg_color, 10%); color: lighten($fg_color, 10%);
text-shadow: 0px 1px 6px rgba(0, 0, 0, 1); text-shadow: 0px 1px 3px rgba(0, 0, 0, 1);
.system-status-icon, .system-status-icon,
.app-menu-icon > StIcon, .app-menu-icon > StIcon,
.popup-menu-arrow { .popup-menu-arrow {
icon-shadow: 0px 1px 6px rgba(0, 0, 0, 1); icon-shadow: 0px 1px 3px rgba(0, 0, 0, 1);
} }
} }
@ -830,6 +832,9 @@ StScrollBar {
&.solid { &.solid {
background-color: black; background-color: black;
background-gradient-start: none;
background-gradient-end: none;
background-gradient-direction: none;
/* transition from transparent to solid */ /* transition from transparent to solid */
transition-duration: 300ms; transition-duration: 300ms;

View File

@ -21,6 +21,8 @@ const Tweener = imports.ui.tweener;
var STARTUP_ANIMATION_TIME = 0.5; var STARTUP_ANIMATION_TIME = 0.5;
var KEYBOARD_ANIMATION_TIME = 0.15; var KEYBOARD_ANIMATION_TIME = 0.15;
var BACKGROUND_FADE_ANIMATION_TIME = 1.0; var BACKGROUND_FADE_ANIMATION_TIME = 1.0;
var GRADIENT_FADE_IN_ANIMATION_TIME = 1.0;
var GRADIENT_FADE_OUT_ANIMATION_TIME = 0.3;
var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
@ -301,8 +303,10 @@ var LayoutManager = new Lang.Class({
// This is called by Main after everything else is constructed // This is called by Main after everything else is constructed
init() { init() {
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
Main.panel.connect('solid-style-changed', this._updatePrimaryBackground.bind(this));
this._loadBackground(); this._loadBackground();
this._updatePrimaryBackground();
}, },
showOverview() { showOverview() {
@ -324,6 +328,29 @@ var LayoutManager = new Lang.Class({
this._queueUpdateRegions(); this._queueUpdateRegions();
}, },
_updatePrimaryBackground() {
let metaBackgroundActor = this._bgManagers[this.primaryIndex].backgroundActor;
metaBackgroundActor.gradient = true;
metaBackgroundActor.gradient_height = 3 * Main.panel.actor.get_height();
if (Main.panel.solidStyle) {
Tweener.addTween(metaBackgroundActor,
{ gradient_max_darkness: 0,
time: GRADIENT_FADE_OUT_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: function() {
metaBackgroundActor.gradient = false;
}
});
} else {
Tweener.removeTweens(metaBackgroundActor);
Tweener.addTween(metaBackgroundActor,
{ gradient_max_darkness: 0.4,
time: GRADIENT_FADE_IN_ANIMATION_TIME,
transition: 'easeOutQuad'
});
}
},
_updateMonitors() { _updateMonitors() {
let display = global.display; let display = global.display;

View File

@ -1039,6 +1039,10 @@ var Panel = new Lang.Class({
return this._leftBox.opacity; return this._leftBox.opacity;
}, },
get solidStyle() {
return this.actor.has_style_class_name('solid');
},
_updatePanel() { _updatePanel() {
let panel = Main.sessionMode.panel; let panel = Main.sessionMode.panel;
this._hideIndicators(); this._hideIndicators();
@ -1073,8 +1077,12 @@ var Panel = new Lang.Class({
}, },
_updateSolidStyle() { _updateSolidStyle() {
let hadSolidStyle = this.solidStyle;
if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) { if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
this._removeStyleClassName('solid'); this._removeStyleClassName('solid');
if (hadSolidStyle)
this.emit('solid-style-changed');
return; return;
} }
@ -1104,6 +1112,8 @@ var Panel = new Lang.Class({
else else
this._removeStyleClassName('solid'); this._removeStyleClassName('solid');
if (isNearEnough != hadSolidStyle)
this.emit('solid-style-changed');
}, },
_hideIndicators() { _hideIndicators() {
@ -1213,3 +1223,4 @@ var Panel = new Lang.Class({
}); });
} }
}); });
Signals.addSignalMethods(Panel.prototype);