Add NeoUI passcode configurator, duress mode profile, and Bluetooth OBEX UI

This commit is contained in:
Luxferre committed 2026-10-30 19:28:31 +02:00
1 parent 51a1a91d42
commit 62ac46e498
100 files changed
+2736 -240

No files matched your search

+107 -32
View File
@@ -814,6 +814,11 @@ spawn_detached_sh(const char *cmd)
{
if (!cmd || !cmd[0])
return;
if (access("/tmp/bananarchy_duress_mode", F_OK) == 0) {
if (strncmp(cmd, "st ", 3) == 0 || strcmp(cmd, "st") == 0 ||
strstr(cmd, "sxmo_terminal.sh") != NULL)
return;
}
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
@@ -2105,6 +2110,16 @@ add_parsed_choice_line(const char *line)
trim_inplace(cmd);
if (!label[0] || !cmd[0])
return;
if (access("/tmp/bananarchy_duress_mode", F_OK) == 0) {
if (strstr(label, "Bantam") || strstr(label, "SIP") ||
strstr(label, "IRC") || strstr(label, "Tox") ||
strstr(label, "Passcode") || strstr(label, "Terminal") ||
strstr(cmd, "xsip") || strstr(cmd, "xirc") ||
strstr(cmd, "xtox") || strstr(cmd, "xpasscode") ||
strstr(cmd, "sxmo_terminal.sh") || strncmp(cmd, "st ", 3) == 0 ||
strcmp(cmd, "st") == 0)
return;
}
for (size_t i = 0; i < items_count; i++) {
if (items[i].text && strcmp(items[i].text, label) == 0)
return;
@@ -2114,6 +2129,10 @@ add_parsed_choice_line(const char *line)
return;
if (items[i].text && strstr(label, "ReMEdy") && strstr(items[i].text, "ReMEdy"))
return;
if (items[i].text && strstr(label, "Scoundrel") && strstr(items[i].text, "Scoundrel"))
return;
if (items[i].text && strstr(label, "Passcode") && strstr(items[i].text, "Passcode"))
return;
if (items[i].text && strstr(label, "SIP VoIP") && strstr(items[i].text, "SIP VoIP"))
return;
if (items[i].text && strstr(label, "Email") && strstr(items[i].text, "Email"))
@@ -2366,6 +2385,7 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(current_builtin_menu, sizeof(current_builtin_menu), "%s", menu_name);
menu_mode = MODE_BUILTIN;
int duress = (access("/tmp/bananarchy_duress_mode", F_OK) == 0);
if (strcmp(menu_name, "sys") == 0) {
reset_session_defaults(1, "Sys");
@@ -2379,12 +2399,14 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Clear Notification", ICON_BEL);
add_menu_item(label, "@toggle:notif_clear_all", 0);
}
const char *sh = getenv("SHELL");
if (!sh || !sh[0])
sh = "/bin/sh";
snprintf(label, sizeof(label), "%s Terminal", ICON_TRM);
snprintf(cmd, sizeof(cmd), "st -e %s", sh);
add_menu_item(label, cmd, 0);
if (!duress) {
const char *sh = getenv("SHELL");
if (!sh || !sh[0])
sh = "/bin/sh";
snprintf(label, sizeof(label), "%s Terminal", ICON_TRM);
snprintf(cmd, sizeof(cmd), "st -e %s", sh);
add_menu_item(label, cmd, 0);
}
snprintf(label, sizeof(label), "%s Apps", ICON_GRD);
add_menu_item(label, "@menu:applications", 1);
@@ -2392,14 +2414,18 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Games", ICON_GAM);
add_menu_item(label, "@menu:games", 1);
snprintf(label, sizeof(label), "%s Scripts", ICON_GRD);
add_menu_item(label, "@menu:scripts", 1);
if (!duress) {
snprintf(label, sizeof(label), "%s Scripts", ICON_GRD);
add_menu_item(label, "@menu:scripts", 1);
}
snprintf(label, sizeof(label), "%s Files", ICON_DIR);
add_menu_item(label, "@plugin:files", 0);
snprintf(label, sizeof(label), "%s SD Card %s", ICON_DIR, sdcard_is_mounted_fast() ? ICON_TON : ICON_TOF);
add_menu_item(label, "@menu:sdcard", 1);
if (!duress) {
snprintf(label, sizeof(label), "%s SD Card %s", ICON_DIR, sdcard_is_mounted_fast() ? ICON_TON : ICON_TOF);
add_menu_item(label, "@menu:sdcard", 1);
}
snprintf(label, sizeof(label), "%s Dialer", ICON_PHN);
add_menu_item(label, "@plugin:dialer", 0);
@@ -2413,17 +2439,21 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Contacts", ICON_USR);
add_menu_item(label, "@plugin:contacts", 0);
snprintf(label, sizeof(label), "%s SIP VoIP", ICON_PHN);
add_menu_item(label, "@plugin:sip", 0);
if (!duress) {
snprintf(label, sizeof(label), "%s SIP VoIP", ICON_PHN);
add_menu_item(label, "@plugin:sip", 0);
}
snprintf(label, sizeof(label), "%s Email", ICON_EML);
add_menu_item(label, "@plugin:email", 0);
snprintf(label, sizeof(label), "%s IRC Chat", ICON_MSG);
add_menu_item(label, "@plugin:irc", 0);
if (!duress) {
snprintf(label, sizeof(label), "%s IRC Chat", ICON_MSG);
add_menu_item(label, "@plugin:irc", 0);
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
add_menu_item(label, "@plugin:tox", 0);
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
add_menu_item(label, "@plugin:tox", 0);
}
snprintf(label, sizeof(label), "%s Kopher (SmallWeb)", ICON_GLB);
add_menu_item(label, "@plugin:smallweb", 0);
@@ -2485,7 +2515,7 @@ open_builtin_menu(const char *menu_name, int keep_idx)
const char *home = getenv("HOME");
char bpath[256];
snprintf(bpath, sizeof(bpath), "%s/.local/bin/bantam", (home && home[0]) ? home : "/home/user");
if (access("/usr/bin/bantam", X_OK) == 0 || access("/usr/local/bin/bantam", X_OK) == 0 || access(bpath, X_OK) == 0) {
if (!duress && (access("/usr/bin/bantam", X_OK) == 0 || access("/usr/local/bin/bantam", X_OK) == 0 || access(bpath, X_OK) == 0)) {
snprintf(label, sizeof(label), "%s Bantam", ICON_TRM);
add_menu_item(label, "cd \"$HOME\" && sxmo_terminal.sh bantam", 0);
}
@@ -2493,14 +2523,18 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s ReMEdy (J2ME)", ICON_GAM);
add_menu_item(label, "remedy", 0);
}
snprintf(label, sizeof(label), "%s SIP VoIP", ICON_PHN);
add_menu_item(label, "@plugin:sip", 0);
if (!duress) {
snprintf(label, sizeof(label), "%s SIP VoIP", ICON_PHN);
add_menu_item(label, "@plugin:sip", 0);
}
snprintf(label, sizeof(label), "%s Email", ICON_EML);
add_menu_item(label, "@plugin:email", 0);
snprintf(label, sizeof(label), "%s IRC Chat", ICON_MSG);
add_menu_item(label, "@plugin:irc", 0);
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
add_menu_item(label, "@plugin:tox", 0);
if (!duress) {
snprintf(label, sizeof(label), "%s IRC Chat", ICON_MSG);
add_menu_item(label, "@plugin:irc", 0);
snprintf(label, sizeof(label), "%s Tox Messenger", ICON_MSG);
add_menu_item(label, "@plugin:tox", 0);
}
snprintf(label, sizeof(label), "%s Kopher (SmallWeb)", ICON_GLB);
add_menu_item(label, "@plugin:smallweb", 0);
snprintf(label, sizeof(label), "%s GPS & Maps", ICON_MAP);
@@ -2537,6 +2571,10 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Tetris", ICON_GAM);
add_menu_item(label, "tetris", 0);
}
if (access("/usr/bin/scoundrel", X_OK) == 0) {
snprintf(label, sizeof(label), "%s Scoundrel", ICON_GAM);
add_menu_item(label, "scoundrel", 0);
}
if (access("/usr/bin/gambatte", X_OK) == 0) {
snprintf(label, sizeof(label), "%s Game Boy (Gambatte)", ICON_GAM);
add_menu_item(label, "gambatte", 0);
@@ -2679,6 +2717,11 @@ open_builtin_menu(const char *menu_name, int keep_idx)
add_menu_item(label, "@menu:config", 1);
populate_timezone_menu();
} else if (strcmp(menu_name, "sdcard") == 0) {
if (duress) {
hide_menu();
menu_mode = MODE_NONE;
return;
}
reset_session_defaults(1, "SD Card");
append_active_call_entries();
int mounted = sdcard_is_mounted_fast();
@@ -2705,6 +2748,11 @@ open_builtin_menu(const char *menu_name, int keep_idx)
if (!home || !home[0])
home = "/home/user";
if (!duress) {
snprintf(label, sizeof(label), "%s Passcode", ICON_PLK);
add_menu_item(label, "@plugin:passcode", 0);
}
snprintf(label, sizeof(label), "%s Themes", ICON_THM);
add_menu_item(label, "@plugin:themes", 0);
snprintf(label, sizeof(label), "%s Wallpapers", ICON_THM);
@@ -2719,19 +2767,23 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Bluetooth %s", ICON_BTH, bt_is_unblocked_fast() ? ICON_TON : ICON_TOF);
add_menu_item(label, "@toggle:bluetooth", 1);
snprintf(label, sizeof(label), "%s SD Card %s", ICON_DIR, sdcard_is_mounted_fast() ? ICON_TON : ICON_TOF);
add_menu_item(label, "@menu:sdcard", 1);
if (!duress) {
snprintf(label, sizeof(label), "%s SD Card %s", ICON_DIR, sdcard_is_mounted_fast() ? ICON_TON : ICON_TOF);
add_menu_item(label, "@menu:sdcard", 1);
}
snprintf(label, sizeof(label), "%s Change Timezone", ICON_CLK);
add_menu_item(label, "@menu:timezone", 1);
snprintf(label, sizeof(label), "%s Hooks", ICON_TRM);
add_menu_item(label, "sxmo_hookmenu.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);
snprintf(label, sizeof(label), "%s Version", ICON_INF);
add_menu_item(label, "sxmo_terminal.sh sxmo_version.sh --block", 0);
if (!duress) {
snprintf(label, sizeof(label), "%s Hooks", ICON_TRM);
add_menu_item(label, "sxmo_hookmenu.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);
snprintf(label, sizeof(label), "%s Version", ICON_INF);
add_menu_item(label, "sxmo_terminal.sh sxmo_version.sh --block", 0);
}
snprintf(label, sizeof(label), "%s System Menu", ICON_MNU);
add_menu_item(label, "@menu:sys", 1);
@@ -2773,6 +2825,11 @@ open_builtin_menu(const char *menu_name, int keep_idx)
add_menu_item("Yes", "sxmo_power.sh poweroff", 0);
add_menu_item("No", "@menu:power", 1);
} else if (strcmp(menu_name, "st") == 0) {
if (duress) {
hide_menu();
menu_mode = MODE_NONE;
return;
}
reset_session_defaults(1, "St");
append_active_call_entries();
snprintf(label, sizeof(label), "%s New Terminal", ICON_TRM);
@@ -2808,6 +2865,11 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
add_menu_item(label, "@close", 0);
} else if (strcmp(menu_name, "nano") == 0) {
if (duress) {
hide_menu();
menu_mode = MODE_NONE;
return;
}
reset_session_defaults(1, "Nano");
append_active_call_entries();
snprintf(label, sizeof(label), "%s Scroll up", ICON_ARU);
@@ -2837,6 +2899,11 @@ open_builtin_menu(const char *menu_name, int keep_idx)
snprintf(label, sizeof(label), "%s Close Menu", ICON_CLS);
add_menu_item(label, "@close", 0);
} else if (strcmp(menu_name, "sthotkeys") == 0) {
if (duress) {
hide_menu();
menu_mode = MODE_NONE;
return;
}
reset_session_defaults(1, "St");
append_active_call_entries();
add_menu_item("Send Ctrl-C", "@key:ctrl:c", 0);
@@ -2891,6 +2958,8 @@ any_other_plugin_active(void)
"xtox.pid",
"xsmallweb.pid",
"xgps.pid",
"xpasscode.pid",
"xengmenu.pid",
};
const char *rdir = getenv("XDG_RUNTIME_DIR");
const char *base = (rdir && rdir[0]) ? rdir : "/run/user/10000";
@@ -2941,6 +3010,8 @@ close_other_active_plugins(void)
{ "xtox.pid", "/tmp/dwm_plugin_tox.fifo" },
{ "xsmallweb.pid", "/tmp/dwm_plugin_smallweb.fifo" },
{ "xgps.pid", "/tmp/dwm_plugin_gps.fifo" },
{ "xpasscode.pid", "/tmp/dwm_plugin_passcode.fifo" },
{ "xengmenu.pid", "/tmp/dwm_plugin_engmenu.fifo" },
};
const char *rdir = getenv("XDG_RUNTIME_DIR");
const char *base = (rdir && rdir[0]) ? rdir : "/run/user/10000";
@@ -2989,6 +3060,8 @@ load_dmenu_xresources(void)
XrmInitialize();
const char *home = getenv("HOME");
if (access("/tmp/bananarchy_duress_mode", F_OK) == 0)
home = "/tmp/duress_home";
char path[512];
snprintf(path, sizeof(path), "%s/.Xresources", (home && home[0]) ? home : "/home/user");
struct stat st;
@@ -3122,6 +3195,8 @@ static void
check_dmenu_xres_changed(void)
{
const char *home = getenv("HOME");
if (access("/tmp/bananarchy_duress_mode", F_OK) == 0)
home = "/tmp/duress_home";
char path[512];
snprintf(path, sizeof(path), "%s/.Xresources", (home && home[0]) ? home : "/home/user");
struct stat st;