[gnome-shell-extensions/wip/rstrode/heads-up-display: 6/62] Add no-hot-corner extension




commit e6a4b67964c8bd3741d47917833519e5a25eb621
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 1 23:57:14 2017 +0200

    Add no-hot-corner extension

 extensions/no-hot-corner/extension.js     | 31 +++++++++++++++++++++++++++++++
 extensions/no-hot-corner/meson.build      |  5 +++++
 extensions/no-hot-corner/metadata.json.in |  9 +++++++++
 extensions/no-hot-corner/stylesheet.css   |  1 +
 meson.build                               |  1 +
 5 files changed, 47 insertions(+)
---
diff --git a/extensions/no-hot-corner/extension.js b/extensions/no-hot-corner/extension.js
new file mode 100644
index 0000000..e7a0d63
--- /dev/null
+++ b/extensions/no-hot-corner/extension.js
@@ -0,0 +1,31 @@
+const Main = imports.ui.main;
+
+let _id;
+
+function _disableHotCorners() {
+  // Disables all hot corners
+  Main.layoutManager.hotCorners.forEach(function(hotCorner) {
+    if (!hotCorner) {
+      return;
+    }
+
+    hotCorner._toggleOverview = function() {};
+    hotCorner._pressureBarrier._trigger = function() {};
+  });
+}
+
+function init() {
+}
+
+function enable() {
+  _disableHotCorners();
+  // Hot corners may be re-created afterwards (for example, If there's a monitor change).
+  // So we catch all changes.
+  _id = Main.layoutManager.connect('hot-corners-changed', _disableHotCorners);
+}
+
+function disable() {
+  // Disconnects the callback and re-creates the hot corners
+  Main.layoutManager.disconnect(_id);
+  Main.layoutManager._updateHotCorners();
+}
diff --git a/extensions/no-hot-corner/meson.build b/extensions/no-hot-corner/meson.build
new file mode 100644
index 0000000..48504f6
--- /dev/null
+++ b/extensions/no-hot-corner/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: metadata_name + '.in',
+  output: metadata_name,
+  configuration: metadata_conf
+)
diff --git a/extensions/no-hot-corner/metadata.json.in b/extensions/no-hot-corner/metadata.json.in
new file mode 100644
index 0000000..406d83b
--- /dev/null
+++ b/extensions/no-hot-corner/metadata.json.in
@@ -0,0 +1,9 @@
+{
+"extension-id": "@extension_id@",
+"uuid": "@uuid@",
+"name": "No Topleft Hot Corner",
+"description": "Disable the hot corner in the top left; you can still reach the overview by clicking the 
Activities button or pressing the dedicated key.",
+"shell-version": [ "@shell_current@" ],
+"url": "https://github.com/HROMANO/nohotcorner/";,
+"version": 15
+}
diff --git a/extensions/no-hot-corner/stylesheet.css b/extensions/no-hot-corner/stylesheet.css
new file mode 100644
index 0000000..25134b6
--- /dev/null
+++ b/extensions/no-hot-corner/stylesheet.css
@@ -0,0 +1 @@
+/* This extensions requires no special styling */
diff --git a/meson.build b/meson.build
index d129e6c..6f27f46 100644
--- a/meson.build
+++ b/meson.build
@@ -51,6 +51,7 @@ all_extensions += [
   'auto-move-windows',
   'dash-to-dock',
   'native-window-placement',
+  'no-hot-corner',
   'panel-favorites',
   'top-icons',
   'updates-dialog',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]