Add option to override escape key for Show Applications

This commit is contained in:
Charles Gagnon
2020-05-01 17:40:55 -04:00
parent 602f5cf693
commit d878987d48
5 changed files with 74 additions and 1 deletions

View File

@@ -3936,6 +3936,54 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_show_applications_esc_key">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_show_applications_esc_key">
<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="GtkSwitch" id="show_applications_esc_key_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>
<child>
<object class="GtkLabel" id="show_applications_esc_key_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Override escape key and return to desktop</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>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<object class="GtkAdjustment" id="show_showdesktop_delay_adjustment">
<property name="upper">5000</property>

View File

@@ -355,8 +355,9 @@ var dtpPanelManager = Utils.defineClass({
},
setFocusedMonitor: function(monitor, ignoreRelayout) {
this._needsIconAllocate = 1;
if (!this.checkIfFocusedMonitor(monitor)) {
this._needsIconAllocate = 1;
Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index;
Main.overview._overview.clear_constraints();

View File

@@ -937,6 +937,7 @@ const Settings = new Lang.Class({
// restore default settings
this._settings.set_value('show-apps-icon-side-padding', this._settings.get_default_value('show-apps-icon-side-padding'));
this._builder.get_object('show_applications_side_padding_spinbutton').set_value(this._settings.get_int('show-apps-icon-side-padding'));
this._settings.set_value('show-apps-override-escape', this._settings.get_default_value('show-apps-override-escape'));
handleIconChange.call(this, null);
} else {
// remove the settings box so it doesn't get destroyed;
@@ -957,6 +958,10 @@ const Settings = new Lang.Class({
this._builder.get_object('application_button_animation_button'),
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-apps-override-escape',
this._builder.get_object('show_applications_esc_key_switch'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('show-activities-button',
this._builder.get_object('show_activities_button_switch'),
'active',

View File

@@ -367,6 +367,11 @@
<summary>Show Applications icon side padding</summary>
<description>Customize the Show Applications icon side padding</description>
</key>
<key type="b" name="show-apps-override-escape">
<default>true</default>
<summary>Override escape key</summary>
<description>Override the escape key to return to the desktop when entering the overview using the Show Applications button</description>
</key>
<key type="b" name="animate-show-apps">
<default>true</default>
<summary>Animate Show Applications from the desktop</summary>

View File

@@ -1112,6 +1112,19 @@ var taskbar = Utils.defineClass({
});
if (this.showAppsButton.checked) {
if (Me.settings.get_boolean('show-apps-override-escape')) {
//override escape key to return to the desktop when entering the overview using the showapps button
Main.overview.viewSelector._onStageKeyPress = function(actor, event) {
if (Main.modalCount == 1 && event.get_key_symbol() === Clutter.KEY_Escape) {
this._searchActive ? this.reset() : Main.overview.hide();
return Clutter.EVENT_STOP;
}
return this.__proto__._onStageKeyPress.call(this, actor, event);
};
}
// force spring animation triggering.By default the animation only
// runs if we are already inside the overview.
if (!Main.overview._shown) {
@@ -1156,6 +1169,7 @@ var taskbar = Utils.defineClass({
let overviewHiddenId = Main.overview.connect('hidden', () => {
Main.overview.disconnect(overviewHiddenId);
this.dtpPanel.panelManager.setFocusedMonitor(this.dtpPanel.panelManager.primaryPanel.monitor, true);
delete Main.overview.viewSelector._onStageKeyPress;
});
// Finally show the overview