Configurable screen blank (default 5 min), instant lock/lid blank, instant call/SMS wake
- Config -> Screen blank submenu (Off / 30 s / 1 / 5 / 10 / 30 min) backed by ~/.config/sxmo/idle_blank_timeout and the new bananarchy-idle-timeout.sh get|label|set. Default changed from 60 s to 300 s. dwm reads the file live and reloads it on SIGUSR1, so a menu change takes effect without a restart; sxmo.noidle and SXMO_UNLOCK_IDLE_TIME still override/disable it. - Power -> Lock now uses @plugin:locker:screenoff (like Lock (Screen off)), and lock_phone_screenoff() resets dwm's idle state, so closing the slider/lid or locking blanks the panel immediately instead of waiting for the timeout. - New bananarchy-screen-wake.sh restores the panel via sxmo_wm.sh display on, records /tmp/bananarchy_last_wake and signals dwm (SIGUSR1) to reset idle_blanked / last_input_ms. Called from sxmo_hook_ring.sh (incoming call) and sxmo_hook_notification.sh (SMS / notifications). dwm also self-heals if an external hook turns the panel on without a signal. Verified live on the connected phone (after deploying the rebuilt dwm/dmenu and restarting dwm with a rollback backup): idle_locker job is gone, default reads 300 / 5m, setting 10 s blanks the panel (br 14->0, bl 0->4, DPMS On->Off) after ~14 s of no input, and bananarchy-screen-wake.sh restores it immediately. Lock state and 5-minute default were restored afterwards. All scripts pass sh -n. Rebuilt dwm/dmenu and images/bananarchy-nokia-argon.img with --mkinitfs; boot.img still contains the known-good zImage + DTB byte-for-byte. check-rebuild.sh passes and artifact drift is 0. Docs: MANUAL.md, CHANGELOG.md, AGENTS.md, BATTERY-OPTIMIZATION-ANALYSIS.md (13).
This commit is contained in:
1 parent
22d629f59b
commit
da68bb8c60
14 files changed
+226
-12
No files matched your search
+58
-1
@@ -2428,6 +2428,42 @@ scan_zoneinfo_recursive(const char *base_dir, const char *rel_dir,
|
||||
closedir(d);
|
||||
}
|
||||
|
||||
/* U1: Config-menu idle-blank timeout helpers. */
|
||||
static int
|
||||
read_idle_blank_secs(void)
|
||||
{
|
||||
const char *home = getenv("HOME");
|
||||
char path[256], buf[32];
|
||||
if (!home || !home[0])
|
||||
home = "/home/user";
|
||||
snprintf(path, sizeof(path), "%s/.config/sxmo/idle_blank_timeout", home);
|
||||
if (!read_first_line(path, buf, sizeof(buf)))
|
||||
return 300;
|
||||
char *end = NULL;
|
||||
long v = strtol(buf, &end, 10);
|
||||
if (end == buf || v < 0 || v > 86400)
|
||||
return 300;
|
||||
return (int)v;
|
||||
}
|
||||
|
||||
static const char *
|
||||
idle_blank_label(int secs)
|
||||
{
|
||||
static char out[32];
|
||||
if (secs <= 0)
|
||||
return "Off";
|
||||
if (secs < 60) {
|
||||
snprintf(out, sizeof(out), "%d s", secs);
|
||||
return out;
|
||||
}
|
||||
if (secs % 60 == 0) {
|
||||
snprintf(out, sizeof(out), "%d min", secs / 60);
|
||||
return out;
|
||||
}
|
||||
snprintf(out, sizeof(out), "%d min %d s", secs / 60, secs % 60);
|
||||
return out;
|
||||
}
|
||||
|
||||
static void
|
||||
populate_timezone_menu(void)
|
||||
{
|
||||
@@ -2890,6 +2926,10 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
snprintf(label, sizeof(label), "%s Change Timezone", ICON_CLK);
|
||||
add_menu_item(label, "@menu:timezone", 1);
|
||||
|
||||
snprintf(label, sizeof(label), "%s Screen blank: %s", ICON_CLK,
|
||||
idle_blank_label(read_idle_blank_secs()));
|
||||
add_menu_item(label, "@menu:idle_blank", 1);
|
||||
|
||||
if (!duress) {
|
||||
int ext_log_on = (access("/tmp/bananarchy_ext_logging", F_OK) == 0 ||
|
||||
access("/etc/bananarchy/ext_logging", F_OK) == 0);
|
||||
@@ -2910,11 +2950,28 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
add_menu_item(label, "@menu:sys", 1);
|
||||
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
|
||||
add_menu_item(label, "@close", 0);
|
||||
} else if (strcmp(menu_name, "idle_blank") == 0) {
|
||||
reset_session_defaults(1, "Screen blank");
|
||||
int cur = read_idle_blank_secs();
|
||||
static const struct { int secs; const char *name; } opts[] = {
|
||||
{ 0, "Off" }, { 30, "30 seconds" }, { 60, "1 minute" },
|
||||
{ 300, "5 minutes" }, { 600, "10 minutes" }, { 1800, "30 minutes" }
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(opts) / sizeof(opts[0]); i++) {
|
||||
snprintf(label, sizeof(label), "%s %s",
|
||||
opts[i].secs == cur ? ICON_TON : ICON_TOF, opts[i].name);
|
||||
snprintf(cmd, sizeof(cmd), "bananarchy-idle-timeout.sh set %d", opts[i].secs);
|
||||
add_menu_item(label, cmd, 1);
|
||||
}
|
||||
snprintf(label, sizeof(label), "%s Back to Config", ICON_CFG);
|
||||
add_menu_item(label, "@menu:config", 1);
|
||||
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
|
||||
add_menu_item(label, "@close", 0);
|
||||
} else if (strcmp(menu_name, "power") == 0) {
|
||||
reset_session_defaults(1, "Power");
|
||||
append_active_call_entries();
|
||||
snprintf(label, sizeof(label), "%s Lock", ICON_LCK);
|
||||
add_menu_item(label, "@plugin:locker", 0);
|
||||
add_menu_item(label, "@plugin:locker:screenoff", 0);
|
||||
snprintf(label, sizeof(label), "%s Lock (Screen off)", ICON_LCK);
|
||||
add_menu_item(label, "@plugin:locker:screenoff", 0);
|
||||
snprintf(label, sizeof(label), "%s Logout", ICON_OUT);
|
||||
|
||||
Reference in new issue
Block a user