mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 14:18:35 -07:00
Fix nightstand location and keybind handling
This commit is contained in:
@@ -6,7 +6,7 @@ App(
|
|||||||
requires=["gui"],
|
requires=["gui"],
|
||||||
stack_size=2 * 1024,
|
stack_size=2 * 1024,
|
||||||
fap_icon="clock.png",
|
fap_icon="clock.png",
|
||||||
fap_category="Misc",
|
fap_category="Tools",
|
||||||
order=81,
|
order=81,
|
||||||
fap_author="@nymda & @Willy-JL",
|
fap_author="@nymda & @Willy-JL",
|
||||||
fap_weburl="https://github.com/nymda/FlipperNightStand",
|
fap_weburl="https://github.com/nymda/FlipperNightStand",
|
||||||
|
|||||||
@@ -471,6 +471,9 @@ void desktop_run_keybind(Desktop* instance, InputType _type, InputKey _key) {
|
|||||||
loader_start_detached_with_gui_error(instance->loader, LOADER_APPLICATIONS_NAME, NULL);
|
loader_start_detached_with_gui_error(instance->loader, LOADER_APPLICATIONS_NAME, NULL);
|
||||||
} else if(!strncmp(keybind, "Archive", MAX_KEYBIND_LENGTH)) {
|
} else if(!strncmp(keybind, "Archive", MAX_KEYBIND_LENGTH)) {
|
||||||
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventOpenArchive);
|
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopMainEventOpenArchive);
|
||||||
|
} else if(!strncmp(keybind, "Clock", MAX_KEYBIND_LENGTH)) {
|
||||||
|
loader_start_detached_with_gui_error(
|
||||||
|
instance->loader, EXT_PATH("apps/Tools/nightstand.fap"), "");
|
||||||
} else if(!strncmp(keybind, "Device Info", MAX_KEYBIND_LENGTH)) {
|
} else if(!strncmp(keybind, "Device Info", MAX_KEYBIND_LENGTH)) {
|
||||||
loader_start_detached_with_gui_error(instance->loader, "Power", "about_battery");
|
loader_start_detached_with_gui_error(instance->loader, "Power", "about_battery");
|
||||||
} else if(!strncmp(keybind, "Lock Menu", MAX_KEYBIND_LENGTH)) {
|
} else if(!strncmp(keybind, "Lock Menu", MAX_KEYBIND_LENGTH)) {
|
||||||
@@ -504,17 +507,7 @@ int32_t desktop_srv(void* p) {
|
|||||||
furi_hal_rtc_set_pin_fails(0);
|
furi_hal_rtc_set_pin_fails(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!DESKTOP_KEYBINDS_LOAD(&desktop->keybinds, sizeof(desktop->keybinds))) {
|
DESKTOP_KEYBINDS_LOAD(&desktop->keybinds, sizeof(desktop->keybinds));
|
||||||
memset(&desktop->keybinds, 0, sizeof(desktop->keybinds));
|
|
||||||
strcpy(desktop->keybinds[KeybindTypePress][KeybindKeyUp].data, "Lock Menu");
|
|
||||||
strcpy(desktop->keybinds[KeybindTypePress][KeybindKeyDown].data, "Archive");
|
|
||||||
strcpy(desktop->keybinds[KeybindTypePress][KeybindKeyRight].data, "Passport");
|
|
||||||
strcpy(
|
|
||||||
desktop->keybinds[KeybindTypePress][KeybindKeyLeft].data,
|
|
||||||
EXT_PATH("apps/Misc/nightstand.fap"));
|
|
||||||
strcpy(desktop->keybinds[KeybindTypeHold][KeybindKeyRight].data, "Device Info");
|
|
||||||
strcpy(desktop->keybinds[KeybindTypeHold][KeybindKeyLeft].data, "Lock with PIN");
|
|
||||||
}
|
|
||||||
|
|
||||||
desktop_clock_toggle_view(desktop, XTREME_SETTINGS()->statusbar_clock);
|
desktop_clock_toggle_view(desktop, XTREME_SETTINGS()->statusbar_clock);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,27 @@ bool DESKTOP_KEYBINDS_SAVE(Keybind (*x)[KeybindTypeCount][KeybindKeyCount], size
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DESKTOP_KEYBINDS_LOAD(Keybind (*x)[KeybindTypeCount][KeybindKeyCount], size_t size) {
|
bool DESKTOP_KEYBINDS_LOAD(Keybind (*x)[KeybindTypeCount][KeybindKeyCount], size_t size) {
|
||||||
return saved_struct_load(
|
bool ok = saved_struct_load(
|
||||||
DESKTOP_KEYBINDS_PATH, x, size, DESKTOP_KEYBINDS_MAGIC, DESKTOP_KEYBINDS_VER);
|
DESKTOP_KEYBINDS_PATH, x, size, DESKTOP_KEYBINDS_MAGIC, DESKTOP_KEYBINDS_VER);
|
||||||
|
if(ok) {
|
||||||
|
for(KeybindType i = 0; i < KeybindTypeCount; i++) {
|
||||||
|
for(KeybindKey j = 0; j < KeybindKeyCount; j++) {
|
||||||
|
char* keybind = (*x)[i][j].data;
|
||||||
|
if(!strncmp(keybind, EXT_PATH("apps/Misc/nightstand.fap"), MAX_KEYBIND_LENGTH)) {
|
||||||
|
strcpy(keybind, "Clock");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
memset(x, 0, size);
|
||||||
|
strcpy((*x)[KeybindTypePress][KeybindKeyUp].data, "Lock Menu");
|
||||||
|
strcpy((*x)[KeybindTypePress][KeybindKeyDown].data, "Archive");
|
||||||
|
strcpy((*x)[KeybindTypePress][KeybindKeyRight].data, "Passport");
|
||||||
|
strcpy((*x)[KeybindTypePress][KeybindKeyLeft].data, "Clock");
|
||||||
|
strcpy((*x)[KeybindTypeHold][KeybindKeyUp].data, "");
|
||||||
|
strcpy((*x)[KeybindTypeHold][KeybindKeyDown].data, "");
|
||||||
|
strcpy((*x)[KeybindTypeHold][KeybindKeyRight].data, "Device Info");
|
||||||
|
strcpy((*x)[KeybindTypeHold][KeybindKeyLeft].data, "Lock with PIN");
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
const char* EXTRA_KEYBINDS[] = {
|
const char* EXTRA_KEYBINDS[] = {
|
||||||
"Apps Menu",
|
"Apps Menu",
|
||||||
"Archive",
|
"Archive",
|
||||||
|
"Clock",
|
||||||
"Device Info",
|
"Device Info",
|
||||||
"Lock Menu",
|
"Lock Menu",
|
||||||
"Lock Keypad",
|
"Lock Keypad",
|
||||||
|
|||||||
Reference in New Issue
Block a user