eonpatapon / gnome-shell-extension-caffeine

Disable screensaver and auto suspend
GNU General Public License v2.0
573 stars 107 forks source link

gets deactivated as soon screen gets locked #132

Open spi43984 opened 5 years ago

spi43984 commented 5 years ago

When I have a long running task and enable caffeine, I often lock my screen and go for a coffee ;-) But caffeine gets deactivated when I lock the screen.

kwilczynski commented 2 years ago

Hi @spi43984,

There have been similar requests in the past to do this or to disable such behaviour, or to allow users to enable/disable state restoration as per:

https://github.com/eonpatapon/gnome-shell-extension-caffeine/issues/53 https://github.com/eonpatapon/gnome-shell-extension-caffeine/issues/56 https://github.com/eonpatapon/gnome-shell-extension-caffeine/issues/58

The current implementation with an option to remember state seems to be what things have settled at.

mlo-poc commented 1 year ago

I notice, that this report is quite old but I still see the need.

I switched back to GNOME a few days ago and found that there is no simple way to lock the screen and keep the system alive (e.g. not going to suspend mode) at the same time.

this is quite important to me because I sometimes want my screen locked for security but still be able to connect remotely - which of course is not possible if the systems goes to suspend mode.

tutacat commented 1 year ago

I notice, that this report is quite old but I still see the need.

I switched back to GNOME a few days ago and found that there is no simple way to lock the screen and keep the system alive (e.g. not going to suspend mode) at the same time.

this is quite important to me because I sometimes want my screen locked for security but still be able to connect remotely - which of course is not possible if the systems goes to suspend mode.

You could disable auto sleep and use manual sleep

mlo-poc commented 1 year ago

You could disable auto sleep and use manual sleep

well ... I surely could do that, but I usually want my computer to go to sleep when I leave it for a while. It's something I just don't think about in day to day operation. I use the Pause-Key for locking my screen on all my computers, so this is wired very deeply in my muscular memory and I love caffeine, because it is so convenient to have a one-click to disable the screensaver.

It used to work like that for ages: One click to activate caffeine (or similar) + press Pause to enable screensaver and computer is in locked but don't sleep state.

With your suggestion this state is at least six clicks away. Not very user friendly.

Janhouse commented 4 months ago

Seems like this still has not been resolved. Is this not technically possible or is it just a matter of someone adding that feature?

eonpatapon commented 4 months ago

Well the issue was that the lock screen disables extensions, and when Caffeine gets disabled all inhibitors are removed.

Now I have found that since version 42 it is now possible to not disable an extension when the screen lock gets activated: https://gjs.guide/extensions/overview/anatomy.html#session-modes

One could very simply test this by adding in the metadata.json file of the extension:

session-modes: ["user", "unlock-dialog"]

However the doc says: "Extensions that specify user and unlock-dialog must still be prepared to have disable() and enable() called when the session mode changes."

This seem to imply that the extension might be disabled and then enabled when screen lock is activated. In this case if you have enabled the restore state option of Caffeine, it might work.

svenjacobs commented 1 month ago

Hello, this still happens for me. Is the mentioned change to metadata.json not part of version 54?

Also, from a user perspective, it isn't clear that the "restore state" option needs to be enabled, and that this setting relates to the lock screen. What I usually do is, when for example a long download is running, I enable caffeine forever and lock the screen. I was confused when my computer was turned off when I returned. For someone who didn't know the delicate detail of GNOME turning extensions off when the screen is locked, this was unexpected.

called-ishan commented 1 month ago

Hello, this still happens for me. Is the mentioned change to metadata.json not part of version 54?

Also, from a user perspective, it isn't clear that the "restore state" option needs to be enabled, and that this setting relates to the lock screen. What I usually do is, when for example a long download is running, I enable caffeine forever and lock the screen. I was confused when my computer was turned off when I returned. For someone who didn't know the delicate detail of GNOME turning extensions off when the screen is locked, this was unexpected.

did you find any solutions for it, having the same issue

svenjacobs commented 1 month ago

did you find any solutions for it, having the same issue

No. I hope the author sees this 😉

HaukurPall commented 1 month ago

I tested adding session-modes: ["user", "unlock-dialog"] into ~/.local/share/gnome-shell/extensions/caffeine@patapon.info/metadata.json. After making the change I restarted my computer, but perhaps a log-out/in is sufficient. After the change caffeine keeps on running after locking. I have not tested it enough - but you can try adding it.

I don't have "Remember state" active.