Merge pull request #1101 from hlechner/show-desktop-color

add option to change Show Desktop Button line color
This commit is contained in:
Jason DeRose
2020-08-07 08:10:33 -04:00
committed by GitHub
4 changed files with 91 additions and 2 deletions

View File

@@ -4064,6 +4064,7 @@
<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="show_showdesktop_width_label">
@@ -4093,6 +4094,60 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="override_show_desktop_line_color_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Override Show Desktop line color</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="GtkBox" id="override_show_desktop_line_color_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="halign">end</property>
<child>
<object class="GtkColorButton" id="override_show_desktop_line_color_colorbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="use_alpha">True</property>
<property name="show_editor">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="override_show_desktop_line_color_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>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</object>

View File

@@ -666,6 +666,8 @@ var dtpPanel = Utils.defineClass({
[
'changed::showdesktop-button-width',
'changed::trans-use-custom-bg',
'changed::desktop-line-use-custom-color',
'changed::desktop-line-custom-color',
'changed::trans-bg-color'
],
() => this._setShowDesktopButtonStyle()
@@ -1297,12 +1299,16 @@ var dtpPanel = Utils.defineClass({
},
_setShowDesktopButtonStyle: function() {
let rgb = this._getBackgroundBrightness() ? "55, 55, 55" : "200, 200, 200";
let rgb = this._getBackgroundBrightness() ? "rgba(55, 55, 55, .2)" : "rgba(200, 200, 200, .2)";
let isLineCustom = Me.settings.get_boolean('desktop-line-use-custom-color');
rgb = isLineCustom ? Me.settings.get_string('desktop-line-custom-color') : rgb;
if (this._showDesktopButton) {
let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;';
let isVertical = this.checkIfVertical();
let sytle = "border: 0 solid rgba(" + rgb + ", .2);"
let sytle = "border: 0 solid " + rgb + ";";
sytle += isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize;
this._showDesktopButton.set_style(sytle);

View File

@@ -920,6 +920,24 @@ const Settings = new Lang.Class({
dialog.show_all();
}));
this._settings.bind('desktop-line-use-custom-color',
this._builder.get_object('override_show_desktop_line_color_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('desktop-line-use-custom-color',
this._builder.get_object('override_show_desktop_line_color_colorbutton'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
rgba.parse(this._settings.get_string('desktop-line-custom-color'));
this._builder.get_object('override_show_desktop_line_color_colorbutton').set_rgba(rgba);
this._builder.get_object('override_show_desktop_line_color_colorbutton').connect('notify::color', Lang.bind(this, function (button) {
let rgba = button.get_rgba();
let css = rgba.to_string();
this._settings.set_string('desktop-line-custom-color', css);
}));
this._settings.bind('intellihide',

View File

@@ -92,6 +92,16 @@
<summary>Panel size</summary>
<description>Set the size of the panel.</description>
</key>
<key type="b" name="desktop-line-use-custom-color">
<default>false</default>
<summary>Override Show Desktop line color</summary>
<description>Replace current Show Desktop button line color</description>
</key>
<key type="s" name="desktop-line-custom-color">
<default>"rgba(200,200,200,0.2)"</default>
<summary>Custom Show Desktop line color</summary>
<description>Custom Show Desktop button line color</description>
</key>
<key name="dot-position" enum="org.gnome.shell.extensions.dash-to-panel.position">
<default>'BOTTOM'</default>
<summary>Dot position</summary>