mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-31 02:23:04 -07:00
@@ -9,6 +9,7 @@
|
|||||||
#include <cli/cli.h>
|
#include <cli/cli.h>
|
||||||
#include <cli/cli_vcp.h>
|
#include <cli/cli_vcp.h>
|
||||||
#include <locale/locale.h>
|
#include <locale/locale.h>
|
||||||
|
#include <applications/main/archive/helpers/archive_helpers_ext.h>
|
||||||
#include <xtreme.h>
|
#include <xtreme.h>
|
||||||
|
|
||||||
#include "animations/animation_manager.h"
|
#include "animations/animation_manager.h"
|
||||||
@@ -492,7 +493,7 @@ void desktop_run_keybind(Desktop* instance, InputType _type, InputKey _key) {
|
|||||||
} else if(!strncmp(keybind, "Wipe Device", MAX_KEYBIND_LENGTH)) {
|
} else if(!strncmp(keybind, "Wipe Device", MAX_KEYBIND_LENGTH)) {
|
||||||
loader_start_detached_with_gui_error(instance->loader, "Storage", "wipe");
|
loader_start_detached_with_gui_error(instance->loader, "Storage", "wipe");
|
||||||
} else {
|
} else {
|
||||||
loader_start_detached_with_gui_error(instance->loader, keybind, NULL);
|
run_with_default_app(keybind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
DesktopSettingsAppKeybindActionTypeMainApp,
|
DesktopSettingsAppKeybindActionTypeMainApp,
|
||||||
DesktopSettingsAppKeybindActionTypeExternalApp,
|
DesktopSettingsAppKeybindActionTypeExternalApp,
|
||||||
|
DesktopSettingsAppKeybindActionTypeOpenFile,
|
||||||
DesktopSettingsAppKeybindActionTypeMoreActions,
|
DesktopSettingsAppKeybindActionTypeMoreActions,
|
||||||
DesktopSettingsAppKeybindActionTypeRemoveKeybind,
|
DesktopSettingsAppKeybindActionTypeRemoveKeybind,
|
||||||
} DesktopSettingsAppKeybindActionType;
|
} DesktopSettingsAppKeybindActionType;
|
||||||
|
|||||||
+34
-6
@@ -4,6 +4,7 @@
|
|||||||
#include <storage/storage.h>
|
#include <storage/storage.h>
|
||||||
#include <dialogs/dialogs.h>
|
#include <dialogs/dialogs.h>
|
||||||
#include <flipper_application/flipper_application.h>
|
#include <flipper_application/flipper_application.h>
|
||||||
|
#include <xtreme.h>
|
||||||
|
|
||||||
static bool keybinds_fap_selector_item_callback(
|
static bool keybinds_fap_selector_item_callback(
|
||||||
FuriString* file_path,
|
FuriString* file_path,
|
||||||
@@ -29,17 +30,31 @@ static void
|
|||||||
case DesktopSettingsAppKeybindActionTypeMoreActions:
|
case DesktopSettingsAppKeybindActionTypeMoreActions:
|
||||||
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneKeybindsAction);
|
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneKeybindsAction);
|
||||||
break;
|
break;
|
||||||
case DesktopSettingsAppKeybindActionTypeExternalApp: {
|
case DesktopSettingsAppKeybindActionTypeExternalApp:
|
||||||
|
case DesktopSettingsAppKeybindActionTypeOpenFile: {
|
||||||
|
const char* base_path;
|
||||||
|
const char* extension;
|
||||||
|
bool hide_ext;
|
||||||
|
if(index == DesktopSettingsAppKeybindActionTypeExternalApp) {
|
||||||
|
base_path = EXT_PATH("apps");
|
||||||
|
extension = ".fap";
|
||||||
|
hide_ext = true;
|
||||||
|
} else {
|
||||||
|
base_path = STORAGE_EXT_PATH_PREFIX;
|
||||||
|
extension = "*";
|
||||||
|
hide_ext = false;
|
||||||
|
}
|
||||||
const DialogsFileBrowserOptions browser_options = {
|
const DialogsFileBrowserOptions browser_options = {
|
||||||
.extension = ".fap",
|
.extension = extension,
|
||||||
.icon = &I_unknown_10px,
|
.icon = &I_unknown_10px,
|
||||||
|
.hide_dot_files = !XTREME_SETTINGS()->show_hidden_files,
|
||||||
.skip_assets = true,
|
.skip_assets = true,
|
||||||
.hide_ext = true,
|
.hide_ext = hide_ext,
|
||||||
.item_loader_callback = keybinds_fap_selector_item_callback,
|
.item_loader_callback = keybinds_fap_selector_item_callback,
|
||||||
.item_loader_context = app,
|
.item_loader_context = app,
|
||||||
.base_path = EXT_PATH("apps"),
|
.base_path = base_path,
|
||||||
};
|
};
|
||||||
FuriString* temp_path = furi_string_alloc_set_str(EXT_PATH("apps"));
|
FuriString* temp_path = furi_string_alloc_set_str(base_path);
|
||||||
if(storage_file_exists(furi_record_open(RECORD_STORAGE), keybind)) {
|
if(storage_file_exists(furi_record_open(RECORD_STORAGE), keybind)) {
|
||||||
furi_string_set_str(temp_path, keybind);
|
furi_string_set_str(temp_path, keybind);
|
||||||
}
|
}
|
||||||
@@ -83,6 +98,13 @@ void desktop_settings_scene_keybinds_action_type_on_enter(void* context) {
|
|||||||
desktop_settings_scene_keybinds_action_type_submenu_callback,
|
desktop_settings_scene_keybinds_action_type_submenu_callback,
|
||||||
app);
|
app);
|
||||||
|
|
||||||
|
submenu_add_item(
|
||||||
|
submenu,
|
||||||
|
"Open File",
|
||||||
|
DesktopSettingsAppKeybindActionTypeOpenFile,
|
||||||
|
desktop_settings_scene_keybinds_action_type_submenu_callback,
|
||||||
|
app);
|
||||||
|
|
||||||
submenu_add_item(
|
submenu_add_item(
|
||||||
submenu,
|
submenu,
|
||||||
"More Actions",
|
"More Actions",
|
||||||
@@ -112,7 +134,13 @@ void desktop_settings_scene_keybinds_action_type_on_enter(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(storage_file_exists(furi_record_open(RECORD_STORAGE), keybind)) {
|
if(storage_file_exists(furi_record_open(RECORD_STORAGE), keybind)) {
|
||||||
selected = DesktopSettingsAppKeybindActionTypeExternalApp;
|
FuriString* tmp = furi_string_alloc_set(keybind);
|
||||||
|
if(furi_string_end_with_str(tmp, ".fap")) {
|
||||||
|
selected = DesktopSettingsAppKeybindActionTypeExternalApp;
|
||||||
|
} else {
|
||||||
|
selected = DesktopSettingsAppKeybindActionTypeOpenFile;
|
||||||
|
}
|
||||||
|
furi_string_free(tmp);
|
||||||
}
|
}
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user