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