Blame SOURCES/0001-Add-gesture-inhibitor-extension.patch

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