delaylock: delay lock 5 sec after backlight off

New bootloader app for delaying the locking of the touchscreen to 5 seconds after the backlight turns off. Giving you the chance to interact with the watch without having to press the hardware button again.

Inspired by the conversation between Gordon Williams and user156427 linked here: https://forum.espruino.com/conversations/392219/
pull/3480/head
thyttan 2024-06-30 18:03:54 +02:00
parent 98e10cdffe
commit 19d94c11d1
5 changed files with 58 additions and 0 deletions

1
apps/delaylock/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New App!

23
apps/delaylock/README.md Normal file
View File

@ -0,0 +1,23 @@
# Delayed Locking
Delay the locking of the touchscreen to 5 seconds after the backlight turns off. Giving you the chance to interact with the watch without having to press the hardware button again.
## Usage
Just install and the behavior is tweaked at boot time.
## Features
- respects the LCD Timeout and Brightness as configured in the settings app.
## Requests
Tag @thyttan in an issue to https://gitbub.com/espruino/BangleApps/issues to report problems or suggestions.
## Creator
thyttan
## Acknowledgements
Inspired by the conversation between Gordon Williams and user156427 linked here: https://forum.espruino.com/conversations/392219/

BIN
apps/delaylock/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

21
apps/delaylock/boot.js Normal file
View File

@ -0,0 +1,21 @@
{
let backlightTimeout = Bangle.getOptions().backlightTimeout;
let brightness = require("Storage").readJSON("setting.json", true);
brightness = brightness?brightness.brightness:1;
Bangle.setOptions({
backlightTimeout: backlightTimeout,
lockTimeout: backlightTimeout+5000
});
let turnLightsOn = (_,numOrObj)=>{
if (!Bangle.isBacklightOn()) {
Bangle.setLCDPower(brightness);
if (typeof numOrObj !== "number") E.stopEventPropagation(); // Touches will not be passed on to other listeners, but swipes will.
}
};
setWatch(turnLightsOn, BTN1, { repeat: true, edge: 'rising' });
Bangle.prependListener("swipe", turnLightsOn);
Bangle.prependListener("touch", turnLightsOn);
}

View File

@ -0,0 +1,13 @@
{ "id": "delaylock",
"name": "Delayed Locking",
"version":"0.01",
"description": "Delay the locking of the screen to 5 seconds after the backlight turns off.",
"icon": "app.png",
"tags": "settings, configuration, backlight, touchscreen, screen",
"type": "bootloader",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"delaylock.boot.js","url":"boot.js"}
]
}