mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Add settings to define panel gradient
This commit is contained in:
244
Settings.ui
244
Settings.ui
@@ -2994,15 +2994,25 @@
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_gradient_opacity1_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_gradient_opacity2_adjustment">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_opacity_adjustment">
|
||||
<property name="upper">1</property>
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="trans_opacity_min_adjustment">
|
||||
<property name="upper">1</property>
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="box_dynamic_opacity_options">
|
||||
<property name="visible">True</property>
|
||||
@@ -3031,7 +3041,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">The panel opacity is affected by</property>
|
||||
<property name="label" translatable="yes">The panel background opacity is affected by</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -3092,7 +3102,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Change panel opacity when a window gets closer than (px)</property>
|
||||
<property name="label" translatable="yes">Change opacity when a window gets closer than (px)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -3122,7 +3132,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="label" translatable="yes">Change opacity to</property>
|
||||
<property name="label" translatable="yes">Change opacity to (%)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -3133,24 +3143,16 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="trans_options_min_opacity_scale">
|
||||
<object class="GtkSpinButton" id="trans_options_min_opacity_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="text" translatable="yes">0</property>
|
||||
<property name="adjustment">trans_opacity_min_adjustment</property>
|
||||
<property name="lower_stepper_sensitivity">on</property>
|
||||
<property name="restrict_to_fill_level">False</property>
|
||||
<property name="fill_level">0</property>
|
||||
<property name="round_digits">2</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="trans_opacity_min_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="trans_opacity_min_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -4299,7 +4301,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Override theme opacity</property>
|
||||
<property name="label" translatable="yes">Override theme background opacity</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -4326,7 +4328,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Define custom opacity options for the panel </property>
|
||||
<property name="label" translatable="yes">Define custom opacity options for the panel background</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
@@ -4355,7 +4357,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="label" translatable="yes">Panel opacity</property>
|
||||
<property name="label" translatable="yes">Panel background opacity (%)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -4366,24 +4368,15 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="trans_opacity_scale">
|
||||
<object class="GtkSpinButton" id="trans_opacity_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="adjustment">trans_opacity_adjustment</property>
|
||||
<property name="lower_stepper_sensitivity">on</property>
|
||||
<property name="restrict_to_fill_level">False</property>
|
||||
<property name="fill_level">0</property>
|
||||
<property name="round_digits">2</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="value_pos">right</property>
|
||||
<signal name="format-value" handler="trans_opacity_scale_format_value_cb" swapped="no"/>
|
||||
<signal name="value-changed" handler="trans_opacity_scale_value_changed_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -4399,7 +4392,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Dynamic opacity</property>
|
||||
<property name="label" translatable="yes">Dynamic background opacity</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@@ -4494,6 +4487,179 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="trans_gradient_row">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="trans_gradient_grid">
|
||||
<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="trans_gradient_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Override theme gradient </property>
|
||||
<property name="use_markup">True</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="GtkLabel" id="trans_gradient_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Define a custom gradient for the panel</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="trans_gradient_box">
|
||||
<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">6</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="trans_gradient_color1_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Gradient top color and opacity (%)</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="GtkLabel" id="trans_gradient_color2_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Gradient bottom color and opacity (%)</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="trans_gradient_color1_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="trans_gradient_color1_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="GtkSpinButton" id="trans_gradient_color1_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">trans_gradient_opacity1_adjustment</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="GtkBox" id="trans_gradient_color2_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="trans_gradient_color2_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="GtkSpinButton" id="trans_gradient_color2_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">trans_gradient_opacity2_adjustment</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">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="trans_gradient_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item">
|
||||
|
||||
86
prefs.js
86
prefs.js
@@ -524,7 +524,10 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('trans_dyn_switch').set_active(false);
|
||||
});
|
||||
|
||||
this._builder.get_object('trans_opacity_scale').set_value(this._settings.get_double('trans-panel-opacity'));
|
||||
this._builder.get_object('trans_opacity_spinbutton').set_value(this._settings.get_double('trans-panel-opacity') * 100);
|
||||
this._builder.get_object('trans_opacity_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_double('trans-panel-opacity', widget.get_value() * 0.01);
|
||||
}));
|
||||
|
||||
this._settings.bind('trans-use-dynamic-opacity',
|
||||
this._builder.get_object('trans_dyn_switch'),
|
||||
@@ -541,12 +544,57 @@ const Settings = new Lang.Class({
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('trans-use-custom-gradient',
|
||||
this._builder.get_object('trans_gradient_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('trans-use-custom-gradient',
|
||||
this._builder.get_object('trans_gradient_box'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
rgba.parse(this._settings.get_string('trans-gradient-top-color'));
|
||||
this._builder.get_object('trans_gradient_color1_colorbutton').set_rgba(rgba);
|
||||
|
||||
this._builder.get_object('trans_gradient_color1_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('trans-gradient-top-color', hexString);
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_gradient_color1_spinbutton').set_value(this._settings.get_double('trans-gradient-top-opacity') * 100);
|
||||
this._builder.get_object('trans_gradient_color1_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_double('trans-gradient-top-opacity', widget.get_value() * 0.01);
|
||||
}));
|
||||
|
||||
rgba.parse(this._settings.get_string('trans-gradient-bottom-color'));
|
||||
this._builder.get_object('trans_gradient_color2_colorbutton').set_rgba(rgba);
|
||||
|
||||
this._builder.get_object('trans_gradient_color2_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('trans-gradient-bottom-color', hexString);
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_gradient_color2_spinbutton').set_value(this._settings.get_double('trans-gradient-bottom-opacity') * 100);
|
||||
this._builder.get_object('trans_gradient_color2_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_double('trans-gradient-bottom-opacity', widget.get_value() * 0.01);
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance'));
|
||||
this._builder.get_object('trans_options_distance_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_int('trans-dynamic-distance', widget.get_value());
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_options_min_opacity_scale').set_value(this._settings.get_double('trans-dynamic-anim-target'));
|
||||
this._builder.get_object('trans_options_min_opacity_spinbutton').set_value(this._settings.get_double('trans-dynamic-anim-target') * 100);
|
||||
this._builder.get_object('trans_options_min_opacity_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
this._settings.set_double('trans-dynamic-anim-target', widget.get_value() * 0.01);
|
||||
}));
|
||||
|
||||
this._builder.get_object('trans_options_min_opacity_spinbutton').set_value(this._settings.get_double('trans-dynamic-anim-target'));
|
||||
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-time'));
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
|
||||
@@ -575,7 +623,7 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance'));
|
||||
|
||||
this._settings.set_value('trans-dynamic-anim-target', this._settings.get_default_value('trans-dynamic-anim-target'));
|
||||
this._builder.get_object('trans_options_min_opacity_scale').set_value(this._settings.get_double('trans-dynamic-anim-target'));
|
||||
this._builder.get_object('trans_options_min_opacity_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-target') * 100);
|
||||
|
||||
this._settings.set_value('trans-dynamic-anim-time', this._settings.get_default_value('trans-dynamic-anim-time'));
|
||||
this._builder.get_object('trans_options_anim_time_spinbutton').set_value(this._settings.get_int('trans-dynamic-anim-time'));
|
||||
@@ -1435,38 +1483,6 @@ const Settings = new Lang.Class({
|
||||
}));
|
||||
},
|
||||
|
||||
trans_opacity_scale_format_value_cb: function(scale, value) {
|
||||
return Math.round(value * 100) + ' %';
|
||||
},
|
||||
|
||||
trans_opacity_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the opacity consinuosly
|
||||
if (this._opacity_timeout > 0)
|
||||
Mainloop.source_remove(this._opacity_timeout);
|
||||
|
||||
this._opacity_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_double('trans-panel-opacity', scale.get_value());
|
||||
this._opacity_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
trans_opacity_min_scale_format_value_cb: function(scale, value) {
|
||||
return Math.round(value * 100) + ' %';
|
||||
},
|
||||
|
||||
trans_opacity_min_scale_value_changed_cb: function(scale) {
|
||||
// Avoid settings the opacity consinuosly
|
||||
if (this._opacity_timeout > 0)
|
||||
Mainloop.source_remove(this._opacity_timeout);
|
||||
|
||||
this._opacity_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() {
|
||||
this._settings.set_double('trans-dynamic-anim-target', scale.get_value());
|
||||
this._opacity_timeout = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
},
|
||||
|
||||
tray_padding_scale_format_value_cb: function(scale, value) {
|
||||
return value+ ' px';
|
||||
},
|
||||
|
||||
@@ -214,6 +214,31 @@
|
||||
<summary>Opacity change duration</summary>
|
||||
<description>The duration of the animation when the opacity changes</description>
|
||||
</key>
|
||||
<key type="b" name="trans-use-custom-gradient">
|
||||
<default>false</default>
|
||||
<summary>Custom gradient</summary>
|
||||
<description>Replace current theme gradient for the panel</description>
|
||||
</key>
|
||||
<key type="s" name="trans-gradient-top-color">
|
||||
<default>"#000"</default>
|
||||
<summary>Custom gradient top color</summary>
|
||||
<description>Custom gradient top color for the panel</description>
|
||||
</key>
|
||||
<key type="d" name="trans-gradient-top-opacity">
|
||||
<default>0</default>
|
||||
<summary>Custom gradient top opacity</summary>
|
||||
<description>Custom gradient top opacity for the panel</description>
|
||||
</key>
|
||||
<key type="s" name="trans-gradient-bottom-color">
|
||||
<default>"#000"</default>
|
||||
<summary>Custom gradient bottom color</summary>
|
||||
<description>Custom gradient bottom color for the panel</description>
|
||||
</key>
|
||||
<key type="d" name="trans-gradient-bottom-opacity">
|
||||
<default>0.2</default>
|
||||
<summary>Custom gradient bottom opacity</summary>
|
||||
<description>Custom gradient bottom opacity for the panel</description>
|
||||
</key>
|
||||
<key type="b" name="intellihide">
|
||||
<default>false</default>
|
||||
<summary>Intellihide</summary>
|
||||
|
||||
@@ -81,10 +81,21 @@ var DynamicTransparency = new Lang.Class({
|
||||
'changed::trans-panel-opacity',
|
||||
'changed::trans-bg-color',
|
||||
'changed::trans-dynamic-anim-target',
|
||||
'changed::trans-use-dynamic-opacity',
|
||||
'changed::trans-use-dynamic-opacity'
|
||||
],
|
||||
() => this._updateAlphaAndSet()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
[
|
||||
'changed::trans-use-custom-gradient',
|
||||
'changed::trans-gradient-top-color',
|
||||
'changed::trans-gradient-bottom-color',
|
||||
'changed::trans-gradient-top-opacity',
|
||||
'changed::trans-gradient-bottom-opacity'
|
||||
],
|
||||
() => this._updateGradientAndSet()
|
||||
],
|
||||
[
|
||||
this._dtpSettings,
|
||||
[
|
||||
@@ -119,7 +130,7 @@ var DynamicTransparency = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateAnimationDuration: function() {
|
||||
this._animationDuration = this._dtpSettings.get_int('trans-dynamic-anim-time') * 0.001;
|
||||
this._animationDuration = (this._dtpSettings.get_int('trans-dynamic-anim-time') * 0.001) + 's;';
|
||||
},
|
||||
|
||||
_updateAllAndSet: function() {
|
||||
@@ -127,7 +138,9 @@ var DynamicTransparency = new Lang.Class({
|
||||
|
||||
this._updateColor(themeBackground);
|
||||
this._updateAlpha(themeBackground);
|
||||
this._updateGradient();
|
||||
this._setBackground();
|
||||
this._setGradient();
|
||||
},
|
||||
|
||||
_updateColorAndSet: function() {
|
||||
@@ -140,9 +153,14 @@ var DynamicTransparency = new Lang.Class({
|
||||
this._setBackground();
|
||||
},
|
||||
|
||||
_updateGradientAndSet: function() {
|
||||
this._updateGradient();
|
||||
this._setGradient();
|
||||
},
|
||||
|
||||
_updateColor: function(themeBackground) {
|
||||
this._backgroundColor = this._dtpSettings.get_boolean('trans-use-custom-bg') ?
|
||||
Clutter.color_from_string(this._dtpSettings.get_string('trans-bg-color'))[1] :
|
||||
this._dtpSettings.get_string('trans-bg-color') :
|
||||
(themeBackground || this._getThemeBackground());
|
||||
},
|
||||
|
||||
@@ -156,18 +174,47 @@ var DynamicTransparency = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateGradient: function() {
|
||||
this._gradientStyle = '';
|
||||
|
||||
if (this._dtpSettings.get_boolean('trans-use-custom-gradient')) {
|
||||
this._gradientStyle += 'background-gradient-direction: vertical; ' +
|
||||
'background-gradient-start: ' + this._getrgbaColor(this._dtpSettings.get_string('trans-gradient-top-color'),
|
||||
this._dtpSettings.get_double('trans-gradient-top-opacity')) +
|
||||
'background-gradient-end: ' + this._getrgbaColor(this._dtpSettings.get_string('trans-gradient-bottom-color'),
|
||||
this._dtpSettings.get_double('trans-gradient-bottom-opacity'));
|
||||
}
|
||||
},
|
||||
|
||||
_setBackground: function() {
|
||||
this._dtpPanel.panel.actor.set_style(
|
||||
'background-color: rgba(' +
|
||||
this._backgroundColor.red + ',' +
|
||||
this._backgroundColor.green + ',' +
|
||||
this._backgroundColor.blue + ',' +
|
||||
this._alpha + '); ' +
|
||||
'border-image: none; background-image: none; ' +
|
||||
'transition-duration:' + this._animationDuration + 's'
|
||||
this._dtpPanel.panelBox.set_style(
|
||||
'background-color: ' + this._getrgbaColor(this._backgroundColor, this._alpha) +
|
||||
'transition-duration:' + this._animationDuration
|
||||
);
|
||||
},
|
||||
|
||||
_setGradient: function() {
|
||||
this._dtpPanel.panel.actor.set_style(
|
||||
'background-color: none; ' +
|
||||
'border-image: none; ' +
|
||||
'background-image: none; ' +
|
||||
this._gradientStyle +
|
||||
'transition-duration:' + this._animationDuration
|
||||
);
|
||||
},
|
||||
|
||||
_getrgbaColor: function(color, alpha) {
|
||||
if (alpha <= 0) {
|
||||
return 'transparent; ';
|
||||
}
|
||||
|
||||
if (typeof color === 'string') {
|
||||
color = Clutter.color_from_string(color)[1];
|
||||
}
|
||||
|
||||
return 'rgba(' + color.red + ',' + color.green + ',' + color.blue + ',' + (Math.floor(alpha * 100) * 0.01) + '); ' ;
|
||||
},
|
||||
|
||||
_getThemeBackground: function(reload) {
|
||||
if (reload || !this._themeBackground) {
|
||||
let fakePanel = new St.Bin({ name: 'panel' });
|
||||
|
||||
Reference in New Issue
Block a user