Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement, patch] prevent disabling extension on screen lock #100

Open
eugene-rom opened this issue Oct 26, 2017 · 5 comments
Open

[enhancement, patch] prevent disabling extension on screen lock #100

eugene-rom opened this issue Oct 26, 2017 · 5 comments

Comments

@eugene-rom
Copy link

Idea taken from source code https://www.reddit.com/r/gnome/comments/2hj8bx/has_anyone_figured_out_a_way_to_keep_the_screen/cktqjqd/?st=j987r55w&sh=303792a6

Works well for me, can be disabled via gnome-tweak-tool but no recreation on screen lock.

patch:

diff --git a/extension.js b/extension.js
index 77be022..49ccdad 100644
--- a/extension.js
+++ b/extension.js
@@ -32,6 +32,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
 const Me = ExtensionUtils.getCurrentExtension();
 const Convenience = Me.imports.convenience;
 
+let extensionActive = false;
 let settings = null;
 let tray = null;
 let trayIconImplementations = null;
@@ -46,6 +47,9 @@ let blacklist = [["skype","[email protected]"]]; // blackli
 function init() { Convenience.initTranslations(); }
 
 function enable() {
+    if (!extensionActive) {
+        extensionActive = true;
+
         tray = Main.legacyTray;
 
         if (tray)
@@ -64,9 +68,13 @@ function enable() {
         settings.connect('changed::tray-order', Lang.bind(this, placeTray));
 
         connectPanelChildSignals();
+    }
 }
 
 function disable() {
+    // Do not allow disabling the extension when in 'unlock-dialog' (lock-screen) mode.
+    if (extensionActive && Main.sessionMode.currentMode != 'unlock-dialog') {
+        extensionActive = false;
 
         if (Main.legacyTray)
             moveToTray();
@@ -75,6 +83,7 @@ function disable() {
         settings.run_dispose();
 
         disconnectPanelChildSignals();
+    }
 }
 
 function onTrayIconAdded(o, icon, role, delay=1000) {
@jhasse
Copy link

jhasse commented Oct 27, 2017

Will this pass review on e.g.o?

@eugene-rom
Copy link
Author

@jhasse, ahh, you right, it may not pass. :(

Never think about this, as I very novice gnome-shell user (since ubuntu 17.10 release) and just started to settle a new desktop environment.

@ghost
Copy link

ghost commented Oct 27, 2017

Yes, but patch the shell itself is also violate his check and it's more critical create a way to violate the shell itself than just one extension. This is in my opinion less critical that the @jhasse patch with it's the same but for all than want to avoid the gdm rules.

Really the problem is not here. This are just workarouds.

@ghost
Copy link

ghost commented Oct 27, 2017

You can find here https://bugzilla.gnome.org/show_bug.cgi?id=787079 more information about his path:
https://bugzilla.gnome.org/show_bug.cgi?id=781760

@ghost
Copy link

ghost commented Oct 27, 2017

And some thing similar it's what i proposed here: ubuntu/gnome-shell-extension-appindicator#75 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants