|
|
07c081 |
From 2a498fef3ec02d834346b545aeacba0a6224494e Mon Sep 17 00:00:00 2001
|
|
|
86af81 |
From: rpm-build <rpm-build>
|
|
|
86af81 |
Date: Thu, 28 Jan 2021 00:06:12 +0100
|
|
|
86af81 |
Subject: [PATCH] Add gesture-inhibitor extension
|
|
|
86af81 |
|
|
|
86af81 |
This extension may disable default GNOME Shell gestures.
|
|
|
86af81 |
---
|
|
|
86af81 |
extensions/gesture-inhibitor/extension.js | 75 +++++++++++++++++++
|
|
|
86af81 |
extensions/gesture-inhibitor/meson.build | 8 ++
|
|
|
86af81 |
extensions/gesture-inhibitor/metadata.json.in | 12 +++
|
|
|
86af81 |
...l.extensions.gesture-inhibitor.gschema.xml | 25 +++++++
|
|
|
86af81 |
extensions/gesture-inhibitor/stylesheet.css | 1 +
|
|
|
86af81 |
meson.build | 1 +
|
|
|
86af81 |
6 files changed, 122 insertions(+)
|
|
|
86af81 |
create mode 100644 extensions/gesture-inhibitor/extension.js
|
|
|
86af81 |
create mode 100644 extensions/gesture-inhibitor/meson.build
|
|
|
86af81 |
create mode 100644 extensions/gesture-inhibitor/metadata.json.in
|
|
|
86af81 |
create mode 100644 extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
|
|
|
86af81 |
create mode 100644 extensions/gesture-inhibitor/stylesheet.css
|
|
|
86af81 |
|
|
|
86af81 |
diff --git a/extensions/gesture-inhibitor/extension.js b/extensions/gesture-inhibitor/extension.js
|
|
|
86af81 |
new file mode 100644
|
|
|
07c081 |
index 00000000..e74ede2f
|
|
|
86af81 |
--- /dev/null
|
|
|
86af81 |
+++ b/extensions/gesture-inhibitor/extension.js
|
|
|
86af81 |
@@ -0,0 +1,75 @@
|
|
|
86af81 |
+/* extension.js
|
|
|
86af81 |
+ *
|
|
|
86af81 |
+ * This program is free software: you can redistribute it and/or modify
|
|
|
86af81 |
+ * it under the terms of the GNU General Public License as published by
|
|
|
86af81 |
+ * the Free Software Foundation, either version 2 of the License, or
|
|
|
86af81 |
+ * (at your option) any later version.
|
|
|
86af81 |
+ *
|
|
|
86af81 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
86af81 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
86af81 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
86af81 |
+ * GNU General Public License for more details.
|
|
|
86af81 |
+ *
|
|
|
86af81 |
+ * You should have received a copy of the GNU General Public License
|
|
|
86af81 |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
86af81 |
+ *
|
|
|
86af81 |
+ * SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
86af81 |
+ */
|
|
|
86af81 |
+
|
|
|
86af81 |
+/* exported init */
|
|
|
86af81 |
+
|
|
|
86af81 |
+const Clutter = imports.gi.Clutter;
|
|
|
86af81 |
+const ExtensionUtils = imports.misc.extensionUtils;
|
|
|
86af81 |
+const Me = ExtensionUtils.getCurrentExtension();
|
|
|
86af81 |
+const ViewSelector = imports.ui.viewSelector;
|
|
|
86af81 |
+const EdgeDragAction = imports.ui.edgeDragAction;
|
|
|
86af81 |
+const WindowManager = imports.ui.windowManager;
|
|
|
86af81 |
+const St = imports.gi.St;
|
|
|
86af81 |
+const Gio = imports.gi.Gio;
|
|
|
86af81 |
+
|
|
|
86af81 |
+class Extension {
|
|
|
86af81 |
+ constructor() {
|
|
|
86af81 |
+ this._settings = ExtensionUtils.getSettings();
|
|
|
86af81 |
+ let actions = global.stage.get_actions();
|
|
|
86af81 |
+
|
|
|
86af81 |
+ actions.forEach(a => {
|
|
|
86af81 |
+ if (a instanceof ViewSelector.ShowOverviewAction)
|
|
|
86af81 |
+ this._showOverview = a;
|
|
|
86af81 |
+ else if (a instanceof WindowManager.AppSwitchAction)
|
|
|
86af81 |
+ this._appSwitch = a;
|
|
|
86af81 |
+ else if (a instanceof EdgeDragAction.EdgeDragAction &&
|
|
|
86af81 |
+ a._side == St.Side.BOTTOM)
|
|
|
86af81 |
+ this._showOsk = a;
|
|
|
86af81 |
+ else if (a instanceof EdgeDragAction.EdgeDragAction &&
|
|
|
86af81 |
+ a._side == St.Side.TOP)
|
|
|
86af81 |
+ this._unfullscreen = a;
|
|
|
86af81 |
+ else if (a instanceof EdgeDragAction.EdgeDragAction)
|
|
|
86af81 |
+ this._showAppGrid = a;
|
|
|
86af81 |
+ });
|
|
|
86af81 |
+
|
|
|
86af81 |
+ this._map = [
|
|
|
86af81 |
+ { setting: 'overview', action: this._showOverview },
|
|
|
86af81 |
+ { setting: 'app-switch', action: this._appSwitch },
|
|
|
86af81 |
+ { setting: 'show-osk', action: this._showOsk },
|
|
|
86af81 |
+ { setting: 'unfullscreen', action: this._unfullscreen },
|
|
|
86af81 |
+ { setting: 'show-app-grid', action: this._showAppGrid }
|
|
|
86af81 |
+ ];
|
|
|
86af81 |
+ }
|
|
|
86af81 |
+
|
|
|
86af81 |
+ enable() {
|
|
|
86af81 |
+ this._map.forEach(m => {
|
|
|
86af81 |
+ this._settings.bind(m.setting, m.action, 'enabled',
|
|
|
86af81 |
+ Gio.SettingsBindFlags.DEFAULT);
|
|
|
86af81 |
+ });
|
|
|
86af81 |
+ }
|
|
|
86af81 |
+
|
|
|
86af81 |
+ disable() {
|
|
|
86af81 |
+ this._map.forEach(m => {
|
|
|
86af81 |
+ m.action.enabled = true;
|
|
|
86af81 |
+ });
|
|
|
86af81 |
+ }
|
|
|
86af81 |
+}
|
|
|
86af81 |
+
|
|
|
86af81 |
+function init() {
|
|
|
86af81 |
+ return new Extension();
|
|
|
86af81 |
+}
|
|
|
86af81 |
diff --git a/extensions/gesture-inhibitor/meson.build b/extensions/gesture-inhibitor/meson.build
|
|
|
86af81 |
new file mode 100644
|
|
|
07c081 |
index 00000000..fdad5cc8
|
|
|
86af81 |
--- /dev/null
|
|
|
86af81 |
+++ b/extensions/gesture-inhibitor/meson.build
|
|
|
86af81 |
@@ -0,0 +1,8 @@
|
|
|
86af81 |
+extension_data += configure_file(
|
|
|
86af81 |
+ input: metadata_name + '.in',
|
|
|
86af81 |
+ output: metadata_name,
|
|
|
86af81 |
+ configuration: metadata_conf
|
|
|
86af81 |
+)
|
|
|
86af81 |
+
|
|
|
86af81 |
+# extension_sources += files('prefs.js')
|
|
|
86af81 |
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
|
|
|
86af81 |
diff --git a/extensions/gesture-inhibitor/metadata.json.in b/extensions/gesture-inhibitor/metadata.json.in
|
|
|
86af81 |
new file mode 100644
|
|
|
07c081 |
index 00000000..37d6a117
|
|
|
86af81 |
--- /dev/null
|
|
|
86af81 |
+++ b/extensions/gesture-inhibitor/metadata.json.in
|
|
|
86af81 |
@@ -0,0 +1,12 @@
|
|
|
86af81 |
+{
|
|
|
86af81 |
+ "uuid": "@uuid@",
|
|
|
86af81 |
+ "extension-id": "@extension_id@",
|
|
|
86af81 |
+ "settings-schema": "@gschemaname@",
|
|
|
86af81 |
+ "gettext-domain": "@gettext_domain@",
|
|
|
86af81 |
+ "name": "Gesture Inhibitor",
|
|
|
86af81 |
+ "description": "Makes touchscreen gestures optional.",
|
|
|
86af81 |
+ "shell-version": [ "@shell_current@" ],
|
|
|
86af81 |
+ "original-authors": [ "cgarnach@redhat.com" ],
|
|
|
86af81 |
+ "url": "@url@"
|
|
|
86af81 |
+}
|
|
|
86af81 |
+
|
|
|
86af81 |
diff --git a/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
|
|
|
86af81 |
new file mode 100644
|
|
|
07c081 |
index 00000000..1d67dcc0
|
|
|
86af81 |
--- /dev/null
|
|
|
86af81 |
+++ b/extensions/gesture-inhibitor/org.gnome.shell.extensions.gesture-inhibitor.gschema.xml
|
|
|
86af81 |
@@ -0,0 +1,25 @@
|
|
|
86af81 |
+<schemalist>
|
|
|
86af81 |
+ <schema id="org.gnome.shell.extensions.gesture-inhibitor" path="/org/gnome/shell/extensions/gesture-inhibitor/">
|
|
|
86af81 |
+ <key name="show-app-grid" type="b">
|
|
|
86af81 |
+ <default>true</default>
|
|
|
86af81 |
+ <summary>Show app grid gesture</summary>
|
|
|
86af81 |
+ </key>
|
|
|
86af81 |
+ <key name="show-osk" type="b">
|
|
|
86af81 |
+ <default>true</default>
|
|
|
86af81 |
+ <summary>Show OSK gesture</summary>
|
|
|
86af81 |
+ </key>
|
|
|
86af81 |
+ <key name="overview" type="b">
|
|
|
86af81 |
+ <default>true</default>
|
|
|
86af81 |
+ <summary>Show Overview gesture</summary>
|
|
|
86af81 |
+ </key>
|
|
|
86af81 |
+ <key name="app-switch" type="b">
|
|
|
86af81 |
+ <default>true</default>
|
|
|
86af81 |
+ <summary>Application switch gesture</summary>
|
|
|
86af81 |
+ </key>
|
|
|
86af81 |
+ <key name="unfullscreen" type="b">
|
|
|
86af81 |
+ <default>true</default>
|
|
|
86af81 |
+ <summary>Unfullscreen gesture</summary>
|
|
|
86af81 |
+ </key>
|
|
|
86af81 |
+ </schema>
|
|
|
86af81 |
+</schemalist>
|
|
|
86af81 |
+
|
|
|
86af81 |
diff --git a/extensions/gesture-inhibitor/stylesheet.css b/extensions/gesture-inhibitor/stylesheet.css
|
|
|
86af81 |
new file mode 100644
|
|
|
07c081 |
index 00000000..37b93f21
|
|
|
86af81 |
--- /dev/null
|
|
|
86af81 |
+++ b/extensions/gesture-inhibitor/stylesheet.css
|
|
|
86af81 |
@@ -0,0 +1 @@
|
|
|
86af81 |
+/* Add your custom extension styling here */
|
|
|
86af81 |
diff --git a/meson.build b/meson.build
|
|
|
07c081 |
index e163b84d..ba84f8f3 100644
|
|
|
86af81 |
--- a/meson.build
|
|
|
86af81 |
+++ b/meson.build
|
|
|
07c081 |
@@ -55,6 +55,7 @@ all_extensions += [
|
|
|
86af81 |
'dash-to-dock',
|
|
|
07c081 |
'dash-to-panel',
|
|
|
86af81 |
'disable-screenshield',
|
|
|
86af81 |
+ 'gesture-inhibitor',
|
|
|
86af81 |
'native-window-placement',
|
|
|
86af81 |
'no-hot-corner',
|
|
|
86af81 |
'panel-favorites',
|
|
|
86af81 |
--
|
|
|
07c081 |
2.32.0
|
|
|
86af81 |
|