[gnome-shell-extensions/wip/rstrode/heads-up-display: 8/62] Add disable-screenshield extension




commit ae069509c3e2bb6d8257aa20f2ec533e04248a9c
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Mar 26 21:32:09 2019 +0100

    Add disable-screenshield extension

 extensions/disable-screenshield/extension.js     | 27 ++++++++++++++++++++++++
 extensions/disable-screenshield/meson.build      |  5 +++++
 extensions/disable-screenshield/metadata.json.in |  9 ++++++++
 extensions/disable-screenshield/stylesheet.css   |  1 +
 meson.build                                      |  1 +
 5 files changed, 43 insertions(+)
---
diff --git a/extensions/disable-screenshield/extension.js b/extensions/disable-screenshield/extension.js
new file mode 100644
index 0000000..91204c0
--- /dev/null
+++ b/extensions/disable-screenshield/extension.js
@@ -0,0 +1,27 @@
+/* exported enable disable */
+
+const ScreenShield = imports.ui.screenShield;
+
+let _onUserBecameActiveOrig;
+
+function _onUserBecameActiveInjected() {
+    this.idleMonitor.remove_watch(this._becameActiveId);
+    this._becameActiveId = 0;
+
+    this._longLightbox.hide();
+    this._shortLightbox.hide();
+
+    this.deactivate(false);
+}
+
+function enable() {
+    _onUserBecameActiveOrig =
+        ScreenShield.ScreenShield.prototype._onUserBecameActive;
+    ScreenShield.ScreenShield.prototype._onUserBecameActive =
+        _onUserBecameActiveInjected;
+}
+
+function disable() {
+    ScreenShield.ScreenShield.prototype._onUserBecameActive =
+        _onUserBecameActiveOrig;
+}
diff --git a/extensions/disable-screenshield/meson.build b/extensions/disable-screenshield/meson.build
new file mode 100644
index 0000000..48504f6
--- /dev/null
+++ b/extensions/disable-screenshield/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: metadata_name + '.in',
+  output: metadata_name,
+  configuration: metadata_conf
+)
diff --git a/extensions/disable-screenshield/metadata.json.in 
b/extensions/disable-screenshield/metadata.json.in
new file mode 100644
index 0000000..10c4806
--- /dev/null
+++ b/extensions/disable-screenshield/metadata.json.in
@@ -0,0 +1,9 @@
+{
+  "extension-id": "@extension_id@",
+  "uuid": "@uuid@",
+  "name": "Disable Screen Shield",
+  "description": "Disable screen shield when screen lock is disabled",
+  "shell-version": [ "@shell_current@" ],
+  "original-authors": [ "lgpasquale gmail com" ],
+  "url": "@url@"
+}
diff --git a/extensions/disable-screenshield/stylesheet.css b/extensions/disable-screenshield/stylesheet.css
new file mode 100644
index 0000000..25134b6
--- /dev/null
+++ b/extensions/disable-screenshield/stylesheet.css
@@ -0,0 +1 @@
+/* This extensions requires no special styling */
diff --git a/meson.build b/meson.build
index 4b9d138..cf855a0 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,7 @@ all_extensions = default_extensions
 all_extensions += [
   'auto-move-windows',
   'dash-to-dock',
+  'disable-screenshield',
   'native-window-placement',
   'no-hot-corner',
   'panel-favorites',


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