Allow multiple dot colors to be configured

Depends on number of running application windows
This commit is contained in:
jderose9
2017-02-19 08:17:15 -05:00
parent 1312cefd92
commit 45e04abe9d
4 changed files with 247 additions and 136 deletions

View File

@@ -278,117 +278,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listboxrow_dot_color">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<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="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</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="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="dot_color_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkColorButton" id="dot_color_colorbutton">
<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="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">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_dot_size">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_dot_size">
<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="column_spacing">32</property>
<child>
<object class="GtkLabel" id="dot_size_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Height (px)</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="GtkSpinButton" id="dot_size_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">dot_size_adjustment</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_focus_highlight">
<property name="width_request">100</property>
@@ -475,6 +364,198 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_dot_size">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_dot_size">
<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="column_spacing">32</property>
<child>
<object class="GtkLabel" id="dot_size_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Height (px)</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="GtkSpinButton" id="dot_size_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">dot_size_adjustment</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_dot_color">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<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="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>
<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="left_attach">0</property>
<property name="top_attach">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">
<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>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</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="margin_left">12</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">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>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@@ -40,6 +40,7 @@ const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ];
const DEFAULT_FONT_SIZES = [ 96, 64, 48, 32, 24, 16, 0 ];
const DEFAULT_MARGIN_SIZES = [ 32, 24, 16, 12, 8, 4, 0 ];
const DEFAULT_PADDING_SIZES = [ 32, 24, 16, 12, 8, 4, 0, -1 ];
const MAX_WINDOW_INDICATOR = 4;
/**
* This function was copied from the activities-config extension
@@ -172,14 +173,15 @@ const Settings = new Lang.Class({
this._settings.set_string('dot-style-unfocused', widget.get_active_id());
}));
log("doo doo always");
this._builder.get_object('dot_color_colorbutton').connect('notify::color', Lang.bind(this, function(button) {
log("doo doo");
let rgba = button.get_rgba();
let css = rgba.to_string();
let hexString = cssHexString(css);
this._settings.set_string('dot-color', hexString);
}));
for (let i = 1; i <= MAX_WINDOW_INDICATOR; i++) {
let idx = i;
this._builder.get_object('dot_color_' + 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-' + idx, hexString);
}));
}
this._builder.get_object('dot_style_options_button').connect('clicked', Lang.bind(this, function() {
@@ -199,14 +201,22 @@ const Settings = new Lang.Class({
this._builder.get_object('dot_color_override_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('dot-color-override',
this._builder.get_object('dot_color_colorbutton'),
'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);
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color'));
this._builder.get_object('dot_color_colorbutton').set_rgba(rgba);
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);
}
this._settings.bind('focus-highlight',
this._builder.get_object('focus_highlight_switch'),
@@ -227,10 +237,12 @@ const Settings = new Lang.Class({
// restore default settings
this._settings.set_value('dot-color-override', this._settings.get_default_value('dot-color-override'));
this._settings.set_value('dot-color', this._settings.get_default_value('dot-color'));
let rgba = new Gdk.RGBA();
rgba.parse(this._settings.get_string('dot-color'));
this._builder.get_object('dot_color_colorbutton').set_rgba(rgba);
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-size', this._settings.get_default_value('dot-size'));
this._builder.get_object('dot_size_spinbutton').set_value(this._settings.get_int('dot-size'));

View File

@@ -62,10 +62,25 @@
<summary>Running indicator color override</summary>
<description>Whether to override the theme background color for .app-well-running-dot</description>
</key>
<key type="s" name="dot-color">
<key type="s" name="dot-color-1">
<default>"#5294e2"</default>
<summary>Dash background color.</summary>
<description>Customize the background color of the dash.</description>
<summary>Color of running indicator (1 window)</summary>
<description>Customize the color of the running indicator when one window is running for that application</description>
</key>
<key type="s" name="dot-color-2">
<default>"#5294e2"</default>
<summary>Color of running indicator (2 windows)</summary>
<description>Customize the color of the running indicator when two windows are running for that application</description>
</key>
<key type="s" name="dot-color-3">
<default>"#5294e2"</default>
<summary>Color of running indicator (3 windows)</summary>
<description>Customize the color of the running indicator when three windows are running for that application</description>
</key>
<key type="s" name="dot-color-4">
<default>"#5294e2"</default>
<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="i" name="dot-size">
<default>3</default>

View File

@@ -1255,7 +1255,10 @@ const taskbarAppIcon = new Lang.Class({
this._dtpSettings.connect('changed::dot-style-focused', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-style-unfocused', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-override', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color', Lang.bind(this, this._settingsChangeRefresh));
this._dtpSettings.connect('changed::dot-color-1', Lang.bind(this, this._settingsChangeRefresh));
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::focus-highlight', Lang.bind(this, this._onFocusAppChanged));
this._dtpSettings.connect('changed::dot-stacked', Lang.bind(this, this._onFocusAppChanged));
@@ -1445,7 +1448,7 @@ const taskbarAppIcon = new Lang.Class({
let dotStyle = "";
if(this._dtpSettings.get_boolean('dot-color-override'))
dotStyle += "background-color: " + this._dtpSettings.get_string('dot-color') + "; ";
dotStyle += "background-color: " + this._dtpSettings.get_string('dot-color-' + (this._nWindows > 0 ? this._nWindows : 1)) + "; ";
if(this._nWindows > 1 && this._dtpSettings.get_boolean('dot-stacked'))
dotStyle += "background-image: url('" +
@@ -1651,7 +1654,7 @@ const taskbarAppIcon = new Lang.Class({
_drawCircles: function(area) {
let bodyColor;
if(this._dtpSettings.get_boolean('dot-color-override')) {
bodyColor = Clutter.color_from_string(this._dtpSettings.get_string('dot-color'))[1];
bodyColor = Clutter.color_from_string(this._dtpSettings.get_string('dot-color-' + (this._nWindows > 0 ? this._nWindows : 1)))[1];
} else {
// Re-use the style - background color, and border width and color -
// of the default dot