Add option to only hide secondary panels

This commit is contained in:
Charles Gagnon
2019-02-02 20:59:10 -05:00
parent 29e970009e
commit 99133b841b
4 changed files with 77 additions and 5 deletions

View File

@@ -1816,6 +1816,50 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_intellihide_only_secondary">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_intellihide_only_secondary">
<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">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="intellihide_only_secondary_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Only hide secondary panels (requires multi-monitors option)</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="GtkSwitch" id="intellihide_only_secondary_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>
<child>
<object class="GtkListBoxRow" id="listboxrow_intellihide_toggle">
<property name="visible">True</property>

View File

@@ -61,10 +61,10 @@ var Intellihide = new Lang.Class({
this._timeoutsHandler = new Utils.TimeoutsHandler();
this._intellihideChangedId = this._dtpSettings.connect('changed::intellihide', () => this._changeEnabledStatus());
this._intellihideOnlySecondaryChangedId = this._dtpSettings.connect('changed::intellihide-only-secondary', () => this._changeEnabledStatus());
if (this._dtpSettings.get_boolean('intellihide')) {
this.enable();
}
this._enabled = false;
this._changeEnabledStatus();
},
enable: function(reset) {
@@ -121,6 +121,7 @@ var Intellihide = new Lang.Class({
destroy: function() {
this._dtpSettings.disconnect(this._intellihideChangedId);
this._dtpSettings.disconnect(this._intellihideOnlySecondaryChangedId);
this.disable();
},
@@ -150,7 +151,13 @@ var Intellihide = new Lang.Class({
},
_changeEnabledStatus: function() {
this[this._dtpSettings.get_boolean('intellihide') ? 'enable' : 'disable']();
let intellihide = this._dtpSettings.get_boolean('intellihide');
let onlySecondary = this._dtpSettings.get_boolean('intellihide-only-secondary');
let enabled = intellihide && (this._dtpPanel.isSecondary || !onlySecondary);
if (this._enabled !== enabled) {
this[enabled ? 'enable' : 'disable']();
}
},
_bindGeneralSignals: function() {

View File

@@ -695,7 +695,22 @@ const Settings = new Lang.Class({
this._settings.bind('intellihide-show-in-fullscreen',
this._builder.get_object('intellihide_show_in_fullscreen_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('intellihide-only-secondary',
this._builder.get_object('intellihide_only_secondary_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('multi-monitors',
this._builder.get_object('grid_intellihide_only_secondary'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('multimon_multi_switch').connect('notify::active', (widget) => {
if (!widget.get_active())
this._builder.get_object('intellihide_only_secondary_switch').set_active(false);
});
this._builder.get_object('intellihide_pressure_threshold_spinbutton').set_value(this._settings.get_int('intellihide-pressure-threshold'));
this._builder.get_object('intellihide_pressure_threshold_spinbutton').connect('value-changed', Lang.bind(this, function (widget) {
@@ -743,6 +758,7 @@ const Settings = new Lang.Class({
this._settings.set_value('intellihide-behaviour', this._settings.get_default_value('intellihide-behaviour'));
this._settings.set_value('intellihide-use-pressure', this._settings.get_default_value('intellihide-use-pressure'));
this._settings.set_value('intellihide-show-in-fullscreen', this._settings.get_default_value('intellihide-show-in-fullscreen'));
this._settings.set_value('intellihide-only-secondary', this._settings.get_default_value('intellihide-only-secondary'));
this._settings.set_value('intellihide-pressure-threshold', this._settings.get_default_value('intellihide-pressure-threshold'));
this._builder.get_object('intellihide_pressure_threshold_spinbutton').set_value(this._settings.get_int('intellihide-pressure-threshold'));

View File

@@ -290,6 +290,11 @@
<summary>Intellihide pressure</summary>
<description>Allow the panel to be revealed while an application is in fullscreen mode</description>
</key>
<key type="b" name="intellihide-only-secondary">
<default>false</default>
<summary>Intellihide only secondary</summary>
<description>Whether to only hide secondary panels</description>
</key>
<key type="i" name="intellihide-animation-time">
<default>200</default>
<summary>Intellihide animation time</summary>