Merge pull request #3480 from thyttan/delaylock

delaylock: delay lock 5 sec after backlight off
master
Rob Pilling 2024-07-04 18:04:55 +01:00 committed by GitHub
commit 4ca5707c56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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"}
]
}