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

(configurable) lock screen on wake up from suspend #84

Open
gsgatlin opened this issue Oct 15, 2015 · 9 comments
Open

(configurable) lock screen on wake up from suspend #84

gsgatlin opened this issue Oct 15, 2015 · 9 comments

Comments

@gsgatlin
Copy link

gsgatlin commented Oct 15, 2015

Any chance you guys will implement a setting so that the screen won't always lock when you wake up from suspend on systemd distros like fedora?

I tried running dconf-editor and changing:

org -> mate -> power-manager

lock-blank-screen (unchecked)
lock-hibernate (unchecked)
lock-keyring-hibernate (unchecked)
lock-keyring-suspend (unchecked)
lock-suspend (unchecked)
lock-use-screensaver (unchecked)

and also

org -> mate -> screensaver

lock-enabled (unchecked)

and changing these settings has no effect. It still always locks the screen when it wakes from suspend.

Cheers.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/27420903-configurable-lock-screen-on-wake-up-from-suspend?utm_campaign=plugin&utm_content=tracker%2F1635706&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1635706&utm_medium=issues&utm_source=github).
@monsta monsta changed the title Allow disabling lock screen on wake up from suspend [1.11] Allow disabling lock screen on wake up from suspend Oct 16, 2015
@monsta
Copy link
Contributor

monsta commented Oct 16, 2015

Oh I was already going to file this request myself 😄

Yes, I think this should be configurable. Not sure which app should actually handle this though. In Cinnamon, lock-on-suspend key is handled in c-s-d's power plugin...

@clefebvre @flexiondotorg @raveit65
thoughts guys?

@flexiondotorg
Copy link
Member

Either power manager or screensaver.

@raveit65
Copy link
Member

I prefer m-s itself in gui and as gsettings key, so users don't have to search in m-p-m.
Note, there are gsettings keys in m-p-m for locking actions, but they don't work anymore on systems with systemd and newer upower.
Don't know if they work on older intvs systems.

@clefebvre
Copy link
Contributor

+1 for 1.14 or as bug-fix to 1.12.x.

In the code, that belongs to MPM.

Visually that setting could be in the lockscreen or power management.. either way.

@monsta monsta changed the title [1.11] Allow disabling lock screen on wake up from suspend (configurable) lock screen on wake up from suspend Oct 20, 2015
@monsta
Copy link
Contributor

monsta commented Oct 20, 2015

@gsgatlin: the offending commit has been reverted. We'll work more on this in the future (e.g. correct enabling/disabling of locking, possible reorganization of gsettings keys to make things simpler, etc.) - so I'll leave this issue open as a reminder.

@emanuele-f
Copy link

I add my note here.

I want to only enable lock when resuming from suspend/hibernate, not when my screensaver activates, nor when I close my laptop lid which causes a blank screen.

Currently this can only be done through gsettings and it's not very intuitive (I'm very glad it works though). You have to put screensaver/lock-enabled to false and set these keys in power-manager section:

  • lock-blank-screen = false
  • lock-use-screensaver = false (this is odd)
  • lock-suspend = true
  • lock-hibernate = true

As stated by @raveit65, it would be nice to control this stuff from UI. In my opinion, the whole locking settings should be presented to the user through a single window, not from separate screensaver/powermanager settings.

From my user point of view, I would like to see a "Lock Screen" entry in mate control center. From
there, a list of checkboxes should control lock policy. "Lock when":

  • screen saver activates
  • screen goes blank
  • device suspends
  • device hibernates

@TomRoche
Copy link

@emanuele-f:

  1. thanks for pointing me to the relevant tool and data to accomplish this task in current MATE.
  2. FWIW, I concur with your UI design; for that matter I would appreciate a single dialog=Lock Screen in Cinnamon Settings as well.

For the benefit of the next poor bastard who

  • websearches their way here before UI is implemented
  • has never used gsettings

hopefully the following bash scriptlets will save you some time:

# find relevant `gsettings` keys
date
for SCHEMA in $(gsettings list-schemas | fgrep -e 'mate' | grep -e 'screensaver\|power-manager') ; do
    echo "schema=${SCHEMA} keys:"
    gsettings list-keys "${SCHEMA}" | fgrep -e 'lock' | sort
    echo # newline
done

should produce console spew like

Tue Feb 14 23:03:12 MST 2017
schema=org.mate.power-manager keys:
lock-blank-screen
lock-hibernate
lock-keyring-hibernate
lock-keyring-suspend
lock-suspend
lock-use-screensaver

schema=org.mate.screensaver keys:
lock-delay
lock-dialog-theme
lock-enabled

# query writability and state of relevant `gsettings` keys
date
for SCHEMA in $(gsettings list-schemas | fgrep -e 'mate' | grep -e 'screensaver\|power-manager') ; do
    echo "schema=${SCHEMA} keys:"
    for KEY in $(gsettings list-keys "${SCHEMA}" | fgrep -e 'lock' | sort) ; do
        KEY_V="$(gsettings get "${SCHEMA}" "${KEY}")"
        KEY_W="$(gsettings writable "${SCHEMA}" "${KEY}")"
        echo "   value(${KEY})=${KEY_V}"
        echo "writable(${KEY})=${KEY_W}"
    done
    echo # newline
done

should produce console spew like

Tue Feb 14 23:16:45 MST 2017
schema=org.mate.power-manager keys:
value(lock-blank-screen)=true
writable(lock-blank-screen)=true
value(lock-hibernate)=true
writable(lock-hibernate)=true
value(lock-keyring-hibernate)=true
writable(lock-keyring-hibernate)=true
value(lock-keyring-suspend)=false
writable(lock-keyring-suspend)=true
value(lock-suspend)=true
writable(lock-suspend)=true
value(lock-use-screensaver)=true
writable(lock-use-screensaver)=true

schema=org.mate.screensaver keys:
value(lock-delay)=0
writable(lock-delay)=true
value(lock-dialog-theme)='default'
writable(lock-dialog-theme)=true
value(lock-enabled)=false
writable(lock-enabled)=true

# set relevant `gsettings` keys
date
gsettings set org.mate.screensaver lock-enabled false
gsettings set org.mate.power-manager lock-blank-screen false
gsettings set org.mate.power-manager lock-use-screensaver false
gsettings set org.mate.power-manager lock-suspend true
gsettings set org.mate.power-manager lock-hibernate true

should produce almost no console spew (just the date)

# requery values (only)
date
for SCHEMA in $(gsettings list-schemas | fgrep -e 'mate' | grep -e 'screensaver\|power-manager') ; do
    echo "schema=${SCHEMA} keys:"
    for KEY in $(gsettings list-keys "${SCHEMA}" | fgrep -e 'lock' | sort) ; do
        KEY_V="$(gsettings get "${SCHEMA}" "${KEY}")"
#        KEY_W="$(gsettings writable "${SCHEMA}" "${KEY}")"
        echo "   value(${KEY})=${KEY_V}"
#        echo "writable(${KEY})=${KEY_W}"
    done
    echo # newline
done

should produce console spew like

Tue Feb 14 23:29:53 MST 2017
schema=org.mate.power-manager keys:
value(lock-blank-screen)=false
value(lock-hibernate)=true
value(lock-keyring-hibernate)=true
value(lock-keyring-suspend)=false
value(lock-suspend)=true
value(lock-use-screensaver)=false

schema=org.mate.screensaver keys:
value(lock-delay)=0
value(lock-dialog-theme)='default'
value(lock-enabled)=false

At which point, you should be able to

  1. sleep/suspend your MATE device
  2. wake/resume your MATE device
  3. get a lock screen

... at least, it WFM :-)

@dairefagan
Copy link

dairefagan commented Sep 10, 2020

@emanuele-f:

  1. thanks for pointing me to the relevant tool and data to accomplish this task in current MATE.
  2. FWIW, I concur with your UI design; for that matter I would appreciate a single dialog=Lock Screen in Cinnamon Settings as well.

For the benefit of the next poor bastard who

  • websearches their way here before UI is implemented
  • has never used gsettings

hopefully the following bash scriptlets will save you some time:

Tom, I may be the next poor bastard of which you speak!

I am experiencing an issue from a fresh install of 20.04.1 yesterday, where I do not receive a password prompt when waking from suspend if I have suspended from the power menu, or with systemctl suspend, although a password is requested when waking if I suspend by closing the lid.

My current enabled settings are:

/org/mate/power-manager/ >> lock-suspend, lock-blank-screen, lock-use-screensaver, lock-keyring-suspend, lock-use-screensaver
/org/mate/screensaver/ >> lock-delay = 1, lock-enabled
/org/gnome/desktop/screensaver/ >> lock-delay = 0, lock enabled, ubuntu-lock-on-suspend

I tried the scripts but this did not help:

daire@apparatus:~/Downloads$ chmod +x script1.sh
daire@apparatus:~/Downloads$ ./script1.sh
Thu 10 Sep 2020 16:12:42 IST
schema=org.mate.screensaver keys:
lock-delay
lock-dialog-theme
lock-enabled

schema=org.mate.power-manager keys:
lock-blank-screen
lock-hibernate
lock-keyring-hibernate
lock-keyring-suspend
lock-suspend
lock-use-screensaver

daire@apparatus:~/Downloads$ chmod +x script2.sh
daire@apparatus:~/Downloads$ ./script2.sh
Thu 10 Sep 2020 16:13:38 IST
schema=org.mate.screensaver keys:
   value(lock-delay)=0
writable(lock-delay)=true
   value(lock-dialog-theme)='default'
writable(lock-dialog-theme)=true
   value(lock-enabled)=false
writable(lock-enabled)=true

schema=org.mate.power-manager keys:
   value(lock-blank-screen)=false
writable(lock-blank-screen)=true
   value(lock-hibernate)=true
writable(lock-hibernate)=true
   value(lock-keyring-hibernate)=true
writable(lock-keyring-hibernate)=true
   value(lock-keyring-suspend)=false
writable(lock-keyring-suspend)=true
   value(lock-suspend)=true
writable(lock-suspend)=true
   value(lock-use-screensaver)=false
writable(lock-use-screensaver)=true

daire@apparatus:~/Downloads$ chmod +x script3.sh
daire@apparatus:~/Downloads$ ./script3.sh
Thu 10 Sep 2020 16:14:23 IST
daire@apparatus:~/Downloads$ chmod +x script4.sh
daire@apparatus:~/Downloads$ ./script4.sh
Thu 10 Sep 2020 16:14:59 IST
schema=org.mate.screensaver keys:
   value(lock-delay)=0
   value(lock-dialog-theme)='default'
   value(lock-enabled)=false

schema=org.mate.power-manager keys:
   value(lock-blank-screen)=false
   value(lock-hibernate)=true
   value(lock-keyring-hibernate)=true
   value(lock-keyring-suspend)=false
   value(lock-suspend)=true
   value(lock-use-screensaver)=false

Is there anything else I could try?

@stephematician
Copy link

@emanuele-f:

  1. thanks for pointing me to the relevant tool and data to accomplish this task in current MATE.
  2. FWIW, I concur with your UI design; for that matter I would appreciate a single dialog=Lock Screen in Cinnamon Settings as well.

For the benefit of the next poor bastard who

  • websearches their way here before UI is implemented
  • has never used gsettings

hopefully the following bash scriptlets will save you some time:

Tom, I may be the next poor bastard of which you speak!

I am experiencing an issue from a fresh install of 20.04.1 yesterday, where I do not receive a password prompt when waking from suspend if I have suspended from the power menu, or with systemctl suspend, although a password is requested when waking if I suspend by closing the lid.

This is probably a different issue - related to ayatana-indicator-session - see AyatanaIndicators/ayatana-indicator-session#101. The 'Suspend' item in the power menu calls systemd-logind to handle the suspend operation. Which - as you have noticed - also does not lock the session. A workaround is to create a system service that locks (the session) whenever systemd suspends, e.g. https://ubuntu-mate.community/t/how-to-lock-screen-on-suspend/16836/7

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

9 participants