Allow different colors for focused app's indicator

This commit is contained in:
jderose9
2017-02-22 16:57:53 -05:00
parent 809a0b7536
commit 6c5a84c64b
4 changed files with 500 additions and 145 deletions

View File

@@ -368,145 +368,387 @@
<child>
<object class="GtkListBoxRow" id="listboxrow_dot_color">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_dot_color">
<object class="GtkBox" id="box_dot_color">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="row_spacing">4</property>
<property name="column_spacing">32</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="dot_color_label">
<object class="GtkBox" id="dot_color_override_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Color - Override Theme</property>
<property name="xalign">0</property>
<child>
<object class="GtkLabel" id="dot_color_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Color - Override Theme</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="dot_color_override_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_1_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_2_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_3_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_4_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_1_label">
<object class="GtkGrid" id="grid_dot_color">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">1 window open</property>
<property name="xalign">0</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="row_spacing">4</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="dot_color_1_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">1 window open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="dot_color_1_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="dot_color_apply_all_button">
<property name="label" translatable="yes">Apply to all</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_1_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_2_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">2 windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_3_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">3 windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_4_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">4+ windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_2_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_3_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_4_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_2_label">
<object class="GtkBox" id="dot_color_unfocused_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">2 windows open</property>
<property name="xalign">0</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="dot_color_unfocused_different_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<child>
<object class="GtkLabel" id="dot_color_unfocused_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Use different for unfocused</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="dot_color_unfocused_different_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid_dot_color_unfocused">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="row_spacing">4</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="dot_color_unfocused_1_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">1 window open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="dot_color_unfocused_1_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="dot_color_unfocused_apply_all_button">
<property name="label" translatable="yes">Apply to all</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_unfocused_1_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_unfocused_2_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">2 windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_unfocused_2_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_unfocused_3_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">3 windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_unfocused_3_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_unfocused_4_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">4+ windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="dot_color_unfocused_4_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_3_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">3 windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dot_color_4_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">4+ windows open</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="dot_color_override_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>

View File

@@ -181,8 +181,33 @@ const Settings = new Lang.Class({
let hexString = cssHexString(css);
this._settings.set_string('dot-color-' + idx, hexString);
}));
this._builder.get_object('dot_color_unfocused_' + idx + '_colorbutton').connect('notify::color', Lang.bind(this, function(button) {
let rgba = button.get_rgba();
let css = rgba.to_string();
let hexString = cssHexString(css);
this._settings.set_string('dot-color-unfocused-' + idx, hexString);
}));
}
this._builder.get_object('dot_color_apply_all_button').connect('clicked', Lang.bind(this, function() {
for (let i = 2; i <= MAX_WINDOW_INDICATOR; i++) {
this._settings.set_value('dot-color-' + i, this._settings.get_value('dot-color-1'));
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-' + i));
this._builder.get_object('dot_color_' + i + '_colorbutton').set_rgba(rgba);
}
}));
this._builder.get_object('dot_color_unfocused_apply_all_button').connect('clicked', Lang.bind(this, function() {
for (let i = 2; i <= MAX_WINDOW_INDICATOR; i++) {
this._settings.set_value('dot-color-unfocused-' + i, this._settings.get_value('dot-color-unfocused-1'));
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-unfocused-' + i));
this._builder.get_object('dot_color_unfocused_' + i + '_colorbutton').set_rgba(rgba);
}
}));
this._builder.get_object('dot_style_options_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Running Indicator Options'),
@@ -201,21 +226,35 @@ const Settings = new Lang.Class({
this._builder.get_object('dot_color_override_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-unfocused-different',
this._builder.get_object('dot_color_unfocused_different_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-override',
this._builder.get_object('grid_dot_color'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-override',
this._builder.get_object('dot_color_unfocused_box'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-unfocused-different',
this._builder.get_object('grid_dot_color_unfocused'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
for (let i = 1; i <= MAX_WINDOW_INDICATOR; i++) {
this._settings.bind('dot-color-override',
this._builder.get_object('dot_color_' + i + '_colorbutton'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-override',
this._builder.get_object('dot_color_' + i + '_label'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-' + i));
this._builder.get_object('dot_color_' + i + '_colorbutton').set_rgba(rgba);
rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-unfocused-' + i));
this._builder.get_object('dot_color_unfocused_' + i + '_colorbutton').set_rgba(rgba);
}
this._settings.bind('focus-highlight',
@@ -232,12 +271,18 @@ const Settings = new Lang.Class({
if (id == 1) {
// restore default settings
this._settings.set_value('dot-color-override', this._settings.get_default_value('dot-color-override'));
this._settings.set_value('dot-color-unfocused-different', this._settings.get_default_value('dot-color-unfocused-different'));
for (let i = 1; i <= MAX_WINDOW_INDICATOR; i++) {
this._settings.set_value('dot-color-' + i, this._settings.get_default_value('dot-color-' + i));
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-' + i));
this._builder.get_object('dot_color_' + i + '_colorbutton').set_rgba(rgba);
this._settings.set_value('dot-color-unfocused-' + i, this._settings.get_default_value('dot-color-unfocused-' + i));
rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color-unfocused-' + i));
this._builder.get_object('dot_color_unfocused_' + i + '_colorbutton').set_rgba(rgba);
}
this._settings.set_value('dot-size', this._settings.get_default_value('dot-size'));

View File

@@ -87,6 +87,31 @@
<summary>Color of running indicator (4+ windows)</summary>
<description>Customize the color of the running indicator when four or more windows are running for that application</description>
</key>
<key type="b" name="dot-color-unfocused-different">
<default>false</default>
<summary>Unfocused color is different than focused</summary>
<description>Whether to apply a 2nd color scheme to the indicator when the app is not focused</description>
</key>
<key type="s" name="dot-color-unfocused-1">
<default>"#5294e2"</default>
<summary>Color of unfocused running indicator (1 window)</summary>
<description>Customize the color of the unfocused running indicator when one window is running for that application</description>
</key>
<key type="s" name="dot-color-unfocused-2">
<default>"#5294e2"</default>
<summary>Color of unfocused running indicator (2 windows)</summary>
<description>Customize the color of the unfocused running indicator when two windows are running for that application</description>
</key>
<key type="s" name="dot-color-unfocused-3">
<default>"#5294e2"</default>
<summary>Color of unfocused running indicator (3 windows)</summary>
<description>Customize the color of the unfocused running indicator when three windows are running for that application</description>
</key>
<key type="s" name="dot-color-unfocused-4">
<default>"#5294e2"</default>
<summary>Color of unfocused running indicator (4+ windows)</summary>
<description>Customize the color of the unfocused running indicator when four or more windows are running for that application</description>
</key>
<key type="i" name="dot-size">
<default>3</default>
<summary>Running indicator height</summary>

View File

@@ -147,6 +147,24 @@ function ItemShowLabel() {
function extendDashItemContainer(dashItemContainer) {
dashItemContainer.showLabel = ItemShowLabel;
// override show so we know when an animation is occurring to suppress indicator animations
dashItemContainer.show = Lang.bind(dashItemContainer, function(animate) {
if (this.child == null)
return;
let time = animate ? DASH_ANIMATION_TIME : 0;
this.animatingIn = true;
Tweener.addTween(this,
{ childScale: 1.0,
childOpacity: 255,
time: time,
transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() {
this.animatingIn = false;
})
});
});
};
/* This class is a fork of the upstream DashActor class (ui.dash.js)
@@ -519,7 +537,9 @@ const taskbar = new Lang.Class({
let item = new Dash.DashItemContainer();
extendDashItemContainer(item);
item.setChild(appIcon.actor);
appIcon._dashItemContainer = item;
appIcon.actor.connect('notify::hover', Lang.bind(this, function() {
if (appIcon.actor.hover){
@@ -1275,6 +1295,11 @@ const taskbarAppIcon = new Lang.Class({
this._dtpSettings.connect('changed::dot-color-2', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-3', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-4', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-unfocused-different', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-unfocused-1', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-unfocused-2', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-unfocused-3', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-unfocused-4', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::focus-highlight', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::appicon-margin', Lang.bind(this, this._setIconStyle));
@@ -1368,17 +1393,27 @@ const taskbarAppIcon = new Lang.Class({
return;
}
this._focusedDots = new St.DrawingArea({width: 1 /* need to set some initial width so the area will be painted */, y_expand: true});
this._unfocusedDots = new St.DrawingArea({width: 1 /* need to set some initial width so the area will be painted */, y_expand: true});
this._focusedDots = new St.DrawingArea({width:1, y_expand: true});
this._unfocusedDots = new St.DrawingArea({width:1, y_expand: true});
this._focusedDots.connect('repaint', Lang.bind(this, function() {
if(this._dashItemContainer.animatingIn || this._dashItemContainer.animatingOut) {
// don't draw and trigger more animations if the icon is in the middle of
// being added to the panel
return;
}
this._drawRunningIndicator(this._focusedDots, this._dtpSettings.get_string('dot-style-focused'), true);
this._onFocusAppChanged();
this._displayProperIndicator();
}));
this._unfocusedDots.connect('repaint', Lang.bind(this, function() {
if(this._dashItemContainer.animatingIn || this._dashItemContainer.animatingOut) {
// don't draw and trigger more animations if the icon is in the middle of
// being added to the panel
return;
}
this._drawRunningIndicator(this._unfocusedDots, this._dtpSettings.get_string('dot-style-unfocused'), false);
this._onFocusAppChanged();
this._displayProperIndicator();
}));
@@ -1392,7 +1427,7 @@ const taskbarAppIcon = new Lang.Class({
this._updateCounterClass();
this._focusedDots.queue_repaint();
this._unfocusedDots.queue_repaint();
this._onFocusAppChanged(true);
this._displayProperIndicator(true);
},
_setIconStyle: function() {
@@ -1459,7 +1494,11 @@ const taskbarAppIcon = new Lang.Class({
return false;
},
_onFocusAppChanged: function(force) {
_onFocusAppChanged: function(windowTracker) {
this._displayProperIndicator();
},
_displayProperIndicator: function (force) {
let containerWidth = this._iconContainer.get_width();
let isFocused = (tracker.focus_app == this.app);
let focusedDotStyle = this._dtpSettings.get_string('dot-style-focused');
@@ -1488,7 +1527,7 @@ const taskbarAppIcon = new Lang.Class({
newFocusedDotsOpacity = (isFocused && this._nWindows > 0) ? 255 : 0;
}
if(focusedIsWide) {
if(unfocusedIsWide) {
newUnfocusedDotsWidth = (!isFocused && this._nWindows > 0) ? containerWidth : 0;
newUnfocusedDotsOpacity = 255;
} else {
@@ -1500,14 +1539,13 @@ const taskbarAppIcon = new Lang.Class({
// animation is enabled in settings
// AND (going from a wide style to a narrow style indicator or vice-versa
// OR going from an open app to a closed app or vice versa)
if(this._dtpSettings.get_boolean('animate-app-switch') && (
focusedIsWide != unfocusedIsWide ||
(focusedIsWide && (this._focusedDots.width != newUnfocusedDotsWidth || this._unfocusedDots.width != newFocusedDotsWidth)) ||
(!focusedIsWide && (this._focusedDots.opacity != newUnfocusedDotsOpacity || this._unfocusedDots.opacity != newFocusedDotsOpacity))
)) {
this._animateDotDisplay(this._focusedDots, newFocusedDotsWidth, newFocusedDotsOpacity);
this._animateDotDisplay(this._unfocusedDots, newUnfocusedDotsWidth, newUnfocusedDotsOpacity);
} else {
if(this._dtpSettings.get_boolean('animate-app-switch') &&
((focusedIsWide != unfocusedIsWide) ||
(this._focusedDots.width != newUnfocusedDotsWidth || this._unfocusedDots.width != newFocusedDotsWidth))) {
this._animateDotDisplay(this._focusedDots, newFocusedDotsWidth, this._unfocusedDots, newUnfocusedDotsOpacity, force);
this._animateDotDisplay(this._unfocusedDots, newUnfocusedDotsWidth, this._focusedDots, newFocusedDotsOpacity, force);
}
else {
this._focusedDots.opacity = newFocusedDotsOpacity;
this._unfocusedDots.opacity = newUnfocusedDotsOpacity;
this._focusedDots.width = newFocusedDotsWidth;
@@ -1515,20 +1553,22 @@ const taskbarAppIcon = new Lang.Class({
}
},
_animateDotDisplay: function (dots, newWidth, newOpacity, force) {
if( (dots.width != newWidth && dots._tweeningToWidth !== newWidth) ||
(dots.opacity != newOpacity && dots._tweeningToOpacity !== newOpacity) ||
force) {
_animateDotDisplay: function (dots, newWidth, otherDots, newOtherOpacity, force) {
if((dots.width != newWidth && dots._tweeningToWidth !== newWidth) || force) {
log('tweening ' + this._dashItemContainer._labelText + " " + dots.width + " " + newWidth + " " + force);
dots._tweeningToWidth = newWidth;
dots._tweeningToOpacity = newOpacity;
Tweener.addTween(dots,
{ width: newWidth,
opacity: newOpacity,
time: DASH_ANIMATION_TIME,
transition: 'easeInOutCubic',
onStart: Lang.bind(this, function() {
if(newOtherOpacity == 0)
otherDots.opacity = newOtherOpacity;
}),
onComplete: Lang.bind(this, function() {
if(newOtherOpacity > 0)
otherDots.opacity = newOtherOpacity;
dots._tweeningToWidth = null;
dots._tweeningToOpacity = null;
})
});
}
@@ -1680,7 +1720,10 @@ const taskbarAppIcon = new Lang.Class({
_drawRunningIndicator: function(area, type, isFocused) {
let bodyColor;
if(this._dtpSettings.get_boolean('dot-color-override')) {
bodyColor = Clutter.color_from_string(this._dtpSettings.get_string('dot-color-' + (this._nWindows > 0 ? this._nWindows : 1)))[1];
let dotColorSettingPrefix = 'dot-color-';
if(!isFocused && this._dtpSettings.get_boolean('dot-color-unfocused-different'))
dotColorSettingPrefix = 'dot-color-unfocused-';
bodyColor = Clutter.color_from_string(this._dtpSettings.get_string(dotColorSettingPrefix + (this._nWindows > 0 ? this._nWindows : 1)))[1];
} else {
// Re-use the style - background color, and border width and color -
// of the default dot