Persist screen brightness, enable universal evdev key/lid wake, and add *+# screenshot combo
This commit is contained in:
1 parent
eef8584a8d
commit
2e2adcc7f2
38 files changed
+574
-161
No files matched your search
+10
-8
@@ -1081,10 +1081,19 @@ handle_builtin_toggle(const char *toggle_name)
|
||||
int maxv = atoi(max_s);
|
||||
if (maxv <= 0)
|
||||
maxv = 255;
|
||||
int step = MAX(1, maxv / 10);
|
||||
int step = MAX(1, maxv / 14);
|
||||
int nextv = (strcmp(toggle_name, "bright_up") == 0) ? MIN(maxv, cur + step) : MAX(1, cur - step);
|
||||
char out[32];
|
||||
snprintf(out, sizeof(out), "%d\n", nextv);
|
||||
write_str_file("/tmp/sxmo_saved_brightness", out);
|
||||
const char *home = getenv("HOME");
|
||||
if (!home || !home[0])
|
||||
home = "/home/user";
|
||||
char cfgdir[256], cfgpath[256];
|
||||
snprintf(cfgdir, sizeof(cfgdir), "%s/.config/sxmo", home);
|
||||
mkdir(cfgdir, 0755);
|
||||
snprintf(cfgpath, sizeof(cfgpath), "%s/brightness", cfgdir);
|
||||
write_str_file(cfgpath, out);
|
||||
if (!write_str_file(bpath, out))
|
||||
spawn_detached_sh(strcmp(toggle_name, "bright_up") == 0 ? "sxmo_brightness.sh up" : "sxmo_brightness.sh down");
|
||||
} else {
|
||||
@@ -2584,7 +2593,6 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
||||
const char *home = getenv("HOME");
|
||||
if (!home || !home[0])
|
||||
home = "/home/user";
|
||||
char pbuf[256];
|
||||
|
||||
snprintf(label, sizeof(label), "%s Themes", ICON_THM);
|
||||
add_menu_item(label, "@plugin:themes", 0);
|
||||
@@ -2603,14 +2611,8 @@ 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(pbuf, sizeof(pbuf), "%s/.cache/sxmo/sxmo.nosuspend", home);
|
||||
snprintf(label, sizeof(label), "%s Auto-suspend %s", ICON_ZZZ, (access(pbuf, F_OK) == 0) ? ICON_TOF : ICON_TON);
|
||||
add_menu_item(label, "@toggle:autosuspend", 1);
|
||||
|
||||
snprintf(label, sizeof(label), "%s Hooks", ICON_TRM);
|
||||
add_menu_item(label, "sxmo_hookmenu.sh", 0);
|
||||
snprintf(label, sizeof(label), "%s Suspend Blockers", ICON_CFG);
|
||||
add_menu_item(label, "sxmo_terminal.sh sxmo_debug_suspend.sh", 0);
|
||||
snprintf(label, sizeof(label), "%s Log", ICON_INF);
|
||||
snprintf(cmd, sizeof(cmd), "sxmo_terminal.sh tail -n 100 -f %s/sxmo.log", home);
|
||||
add_menu_item(label, cmd, 0);
|
||||
|
||||
Reference in new issue
Block a user