desktop: prompt to power off on back button long press (#1279)
* desktop: prompt to power off on back button long press Implemented by launching Power Settings app, passing "off" as arg to directly jump to "power off" scene.
This commit is contained in:
@@ -103,6 +103,15 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
case DesktopMainEventOpenPowerOff: {
|
||||
LoaderStatus status = loader_start(desktop->loader, "Power", "off");
|
||||
if(status != LoaderStatusOk) {
|
||||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
consumed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case DesktopMainEventOpenFavoritePrimary:
|
||||
LOAD_DESKTOP_SETTINGS(&desktop->settings);
|
||||
if(desktop->settings.favorite_primary < FLIPPER_APPS_COUNT) {
|
||||
|
@@ -8,6 +8,7 @@ typedef enum {
|
||||
DesktopMainEventOpenMenu,
|
||||
DesktopMainEventOpenDebug,
|
||||
DesktopMainEventOpenPassport, /**< Broken, don't use it */
|
||||
DesktopMainEventOpenPowerOff,
|
||||
|
||||
DesktopLockedEventUnlocked,
|
||||
DesktopLockedEventUpdate,
|
||||
|
@@ -53,6 +53,8 @@ bool desktop_main_input(InputEvent* event, void* context) {
|
||||
main_view->callback(DesktopMainEventOpenDebug, main_view->context);
|
||||
} else if(event->key == InputKeyLeft) {
|
||||
main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context);
|
||||
} else if(event->key == InputKeyBack) {
|
||||
main_view->callback(DesktopMainEventOpenPowerOff, main_view->context);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user