We have moved to a new Sailfish OS Forum. Please start new discussions there.

Double click to lock doesn't work when automatic locking is "not in use"

Tracked by Jolla

asked 2014-12-21 18:37:40 +0200

tadzik gravatar image

updated 2019-02-15 08:45:29 +0200

eson gravatar image

I would like to be able to lock my device manually by double clicking the power button, but never have the device lock itself after a certain time. Now I have to use 60 minutes, because if Automatic Locking is set to Not In Use, double click to lock doesn't work.

That's quite counterintuitive; double click to lock is not Automatic Locking, it should not have been disabled by the lack of it.


Still no manual device lock only, in SFOS

edit retag flag offensive close delete



should also lock device when using a swipe from the top on the home screen, considering it shows a padlock icon on the gesture.

r0kk3rz ( 2014-12-21 18:46:49 +0200 )edit

Agreed on both

simo ( 2014-12-21 19:09:06 +0200 )edit

Indeed. I only lock device when I leave it somewhere (ie. the dressing room - this step could be automated easily with a smart watch..) so it is annoying to need to use the code along the day when just picking it out from my pocket.

flux ( 2015-02-26 18:09:39 +0200 )edit

any help on this one? alternatively, does anybody know where the timeout value is stored? I guess setting a high-enough value (e.g. 1 day, 1 month or 1 year..) for the timeout would effectively provide this feature.

reinob ( 2015-09-25 14:26:34 +0200 )edit

This is still present in As the fingerprint sensor is not yet implemented in XA2, it would be great if this bug would be resolved.

speactra ( 2018-12-08 23:36:06 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-02-15 15:37:08 +0200

spiiroin gravatar image

updated 2019-02-19 02:58:15 +0200

The way it works under the hood is

  • There is only one setting: Automatic locking delay in minutes
  • Device locking is "in use" when delay >= 0
  • Double power key press can lock device only when device locking is "in use"
  • To lock via double press, you have to have auto lock delay > 0
  • Settings ui limits the value to maximum 60 minutes
  • But underlying SW is ok with using also values larger than that

So, you can use command line and set timeout to for example 24 hours via:

/usr/lib/qt5/plugins/devicelock/encpartition --set-config-key /desktop/nemo/devicelock/automatic_locking 1440

The tool will prompt for security code before making the change.

You can also give the security code as a parameter, but that will leave it readable in shell history...

Note that settings ui will show "Automatic locking not in use" whenever custom values (not included in selection menu) are used.


On a closer look the maximum value that survives through the whole sw stack is 254, i.e. 4 hours 14 minutes.

edit flag offensive delete publish link more



@spiiroin Thanks a lot! That will help.

eson ( 2019-02-15 15:53:27 +0200 )edit

But as I stated above in my other comment there's a vibrating feedback when activating device lock by double press of power button, regardless of Automatic locking setting. So even if the Automatic locking is set to 0 there's that (now misleading) feedback, which indicates that the device is locked but actually it's not.

Pohli ( 2019-02-15 16:20:21 +0200 )edit

@Pohli By default double power key press yields: 1. Display power off request, 2. lockscreen activation request, 3. device locking request, and 4. vibration feedback request. All four are handled independently from each other and can get ignored under some circumstances i.e. vibration indicates double power key press rather than device locking. Normally it also indicates that device lock request has been made, but tells nothing about whether it succeeded or not.

spiiroin ( 2019-02-15 22:45:10 +0200 )edit

So why is there indication of double press, it doesn't make sense for UX. What's the difference to single press then? Vibration should be connected to device lock, that's how I've interpreted it so far.

Pohli ( 2019-02-16 12:59:22 +0200 )edit

@Pohli Single press defaults to:

mcetool --set-display-on-single-powerkey-press-actions=blank,tklock

Whereas double press defaults to:

mcetool --set-display-on-double-powerkey-press-actions=blank,tklock, devlock,vibrate


  • blank - turn display off
  • tklock - lock ui
  • devlock - lock device
  • vibrate - play vibrate event via ngfd
  • ...

So the difference is that double press - in addition to turning display off and locking ui - also makes an attempt to lock device and play vibration event.

Consider that

  • User making an attempt to perform double press does not necessarily mean that software running in the device sees double press
  • The common "ux" for both single and double power key press is that display blanks and no more visual clues are going to be available

So, the vibration is meant to be thought as an indication for: "Double press was received and actions bound to it have been executed - whatever they were."

You can always disable the vibration with:

mcetool --set-display-on-double-powerkey-press-actions=blank,tklock,devlock

Or disable the whole lock device on double power key press with:

mcetool --set-display-on-double-powerkey-press-actions=blank,tklock
spiiroin ( 2019-02-18 11:13:16 +0200 )edit

answered 2019-04-18 21:03:06 +0200

rasmarc gravatar image

updated 2019-04-19 22:45:07 +0200

Manual device lock using the power key seems to work when modifying


The value "-1" for "Automatic device lock not in use" has to be set to "-2".

EDIT: Same as the other work around - it's limited to 254 minutes before the device gets locked automatically.

For that change

MenuItem {
    //% "Not in use"
    text: qsTrId("settings_devicelock-me-off")
    visible: deviceLockSettings.maximumAutomaticLocking === -1
    onClicked: lockingCombobox.setAutomaticLocking(-1)


MenuItem {
    //% "Not in use"
    text: qsTrId("settings_devicelock-me-off")
    visible: deviceLockSettings.maximumAutomaticLocking === -1
    onClicked: lockingCombobox.setAutomaticLocking(-2)


function updateIndex(value) {
    if (value === -1) {
        return 0


function updateIndex(value) {
    if (value === -2) {
        return 0

and restart the device.

I didn't check yet if the device gets locked automatically after a certain time. Seems to work on Jolla C with SF3.0.2.8.

Because the vibration indicating a power key double press is quite short and weak I also did:

mcetool --set-display-on-double-powerkey-press-actions=tklock,devlock

[strike] mcetool --set-blank-from-lockscreen-timeout=5 This way a power key double press shows the lock screen for 5 seconds before blanking the display. [/strike]

This way a power key double press shows the lock screen and another single power key press blanks the screen.

edit flag offensive delete publish link more


@rasmac That -2 ends up being handled as 254 -> 4h 14min -> you might as well use 254 for clarity.

spiiroin ( 2019-04-19 18:19:45 +0200 )edit

@spiiroin Right, I edited my post.

rasmarc ( 2019-04-19 20:56:23 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2014-12-21 18:37:40 +0200

Seen: 631 times

Last updated: Apr 19 '19