Add setting to select the windows affecting transparency

This commit is contained in:
Charles Gagnon
2018-10-15 10:21:34 -04:00
parent 6476d6d8dd
commit 411829bd06
6 changed files with 135 additions and 98 deletions

View File

@@ -3014,7 +3014,53 @@
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listbox_trans_options_distance">
<object class="GtkListBoxRow" id="listboxrow_trans_options_window_type">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="trans_options_window_type_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">4</property>
<child>
<object class="GtkLabel" id="trans_options_window_type_label">
<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="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="trans_options_window_type_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item id="ALL_WINDOWS" translatable="yes">All windows</item>
<item id="FOCUSED_WINDOWS" translatable="yes">Focused windows</item>
<item id="MAXIMIZED_WINDOWS" translatable="yes">Maximized windows</item>
</items>
</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_trans_options_distance">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -3113,7 +3159,7 @@
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listbox_trans_options_anim_time">
<object class="GtkListBoxRow" id="listboxrow_trans_options_anim_time">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -4293,80 +4339,61 @@
<property name="top_attach">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="GtkBox" id="trans_opacity_box">
<property name="name">trans_custom_opacity_box</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="trans_opacity_select_box">
<object class="GtkGrid" id="trans_opacity_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>
<child>
<object class="GtkLabel" id="trans_opacity_label">
<object class="GtkBox" id="trans_opacity_select_box">
<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="use_markup">True</property>
<property name="xalign">0</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<child>
<object class="GtkLabel" id="trans_opacity_label">
<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="use_markup">True</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="GtkScale" id="trans_opacity_scale">
<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="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkScale" id="trans_opacity_scale">
<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">0</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="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="trans_dyn_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_dyn_label">
<property name="visible">True</property>
@@ -4378,7 +4405,25 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="trans_dyn_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Change opacity when a window gets close to 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">2</property>
</packing>
</child>
<child>
@@ -4427,40 +4472,22 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="trans_dyn_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Change opacity when a window gets close to 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>
<property name="height">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
</object>

View File

@@ -53,7 +53,7 @@ var Intellihide = new Lang.Class({
this._signalsHandler = new Utils.GlobalSignalsHandler();
this._timeoutsHandler = new Utils.TimeoutsHandler();
this._intellihideChangedId = this._dtpSettings.connect('changed::intellihide', Lang.bind(this, this._changeEnabledStatus));
this._intellihideChangedId = this._dtpSettings.connect('changed::intellihide', () => this._changeEnabledStatus());
if (this._dtpSettings.get_boolean('intellihide')) {
this.enable();
@@ -97,10 +97,6 @@ var Intellihide = new Lang.Class({
},
disable: function(reset) {
if (!reset) {
this._dtpSettings.disconnect(this._intellihideChangedId);
}
this._proximityManager.removeWatch(this._proximityWatchId);
this._setTrackPanel(reset, false);
@@ -116,6 +112,7 @@ var Intellihide = new Lang.Class({
},
destroy: function() {
this._dtpSettings.disconnect(this._intellihideChangedId);
this.disable();
},

View File

@@ -536,6 +536,11 @@ const Settings = new Lang.Class({
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('trans-dynamic-behavior',
this._builder.get_object('trans_options_window_type_combo'),
'active-id',
Gio.SettingsBindFlags.DEFAULT);
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());
@@ -564,6 +569,8 @@ const Settings = new Lang.Class({
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
// restore default settings
this._settings.set_value('trans-dynamic-behavior', this._settings.get_default_value('trans-dynamic-behavior'));
this._settings.set_value('trans-dynamic-distance', this._settings.get_default_value('trans-dynamic-distance'));
this._builder.get_object('trans_options_distance_spinbutton').set_value(this._settings.get_int('trans-dynamic-distance'));

View File

@@ -42,7 +42,7 @@ var ProximityWatch = new Lang.Class({
_init: function(actor, mode, xThreshold, yThreshold, handler) {
this.actor = actor;
this.mode = mode;
this.threshold = [xThreshold, yThreshold];
this.threshold = [xThreshold || 1, yThreshold || 1];
this.handler = handler;
this._allocationChangedId = actor.connect('allocation-changed', () => this._update());

View File

@@ -51,7 +51,7 @@
<value value='0' nick='BOTTOM'/>
<value value='1' nick='TOP'/>
</enum>
<enum id='org.gnome.shell.extensions.dash-to-panel.intellihideBehaviour'>
<enum id='org.gnome.shell.extensions.dash-to-panel.proximityBehavior'>
<value value='0' nick='ALL_WINDOWS'/>
<value value='1' nick='FOCUSED_WINDOWS'/>
<value value='2' nick='MAXIMIZED_WINDOWS'/>
@@ -194,6 +194,11 @@
<summary>Panel opacity</summary>
<description>Custom opacity for the panel</description>
</key>
<key name="trans-dynamic-behavior" enum="org.gnome.shell.extensions.dash-to-panel.proximityBehavior">
<default>'ALL_WINDOWS'</default>
<summary>Dynamic opacity behavior</summary>
<description>Dictates which window type affects the panel opacity</description>
</key>
<key type="i" name="trans-dynamic-distance">
<default>20</default>
<summary>Distance to change opacity</summary>
@@ -219,7 +224,7 @@
<summary>Only hide from windows</summary>
<description>Dictates if the dash should only hide when in conflict with windows</description>
</key>
<key name="intellihide-behaviour" enum="org.gnome.shell.extensions.dash-to-panel.intellihideBehaviour">
<key name="intellihide-behaviour" enum="org.gnome.shell.extensions.dash-to-panel.proximityBehavior">
<default>'FOCUSED_WINDOWS'</default>
<summary>Intellihide behaviour</summary>
<description>Dictates how to intelligently hide the panel</description>

View File

@@ -88,6 +88,7 @@ var DynamicTransparency = new Lang.Class({
[
this._dtpSettings,
[
'changed::trans-dynamic-behavior',
'changed::trans-use-dynamic-opacity',
'changed::trans-dynamic-distance'
],
@@ -107,7 +108,7 @@ var DynamicTransparency = new Lang.Class({
if (this._dtpSettings.get_boolean('trans-use-dynamic-opacity')) {
this._proximityWatchId = this._proximityManager.createWatch(
this._dtpPanel.panelBox,
Proximity.Mode.ALL_WINDOWS,
Proximity.Mode[this._dtpSettings.get_string('trans-dynamic-behavior')],
0, this._dtpSettings.get_int('trans-dynamic-distance'),
overlap => {
this._windowOverlap = overlap;