Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4bb9817 authored by Suhua Lei's avatar Suhua Lei
Browse files

Add desktop switch shortcuts to shortcut helper

Bug: 389959157
Flag: com.android.window.flags.enable_multiple_desktops_frontend
Flag: com.android.window.flags.enable_multiple_desktops_backend
Flag: com.android.window.flags.keyboard_shortcuts_to_switch_desks
Test: manual check the shortcut helper
Change-Id: I98ea617dbb84951d9def0297370d643a98045ed4
parent b8f396ee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2502,6 +2502,8 @@
    <string name="system_desktop_mode_toggle_maximize_window">Maximize window</string>
    <!-- User visible title for the keyboard shortcut that minimizes a task in desktop mode [CHAR LIMIT=70] -->
    <string name="system_desktop_mode_minimize_window">Minimize window</string>
    <!-- User visible title for the keyboard shortcut that switches between desktops in multiple desktop mode [CHAR LIMIT=70] -->
    <string name="system_multiple_desktop_mode_switch_between_desks">Move between desktops</string>

    <!-- User visible title for the input keyboard shortcuts list. [CHAR LIMIT=70] -->
    <string name="keyboard_shortcut_group_input">Input</string>
+22 −0
Original line number Diff line number Diff line
@@ -129,5 +129,27 @@ constructor(@Main private val resources: Resources, @Application private val con
                }
            )
        }

        if (
            DesktopModeStatus.enableMultipleDesktops(context) &&
                DesktopExperienceFlags.ENABLE_KEYBOARD_SHORTCUTS_TO_SWITCH_DESKS.isTrue
        ) {
            // Move between desktops
            //  - Meta + Ctrl + [ or ]
            add(
                shortcutInfo(
                    resources.getString(R.string.system_multiple_desktop_mode_switch_between_desks)
                ) {
                    command(META_META_ON or META_CTRL_ON, KEYCODE_LEFT_BRACKET)
                }
            )
            add(
                shortcutInfo(
                    resources.getString(R.string.system_multiple_desktop_mode_switch_between_desks)
                ) {
                    command(META_META_ON or META_CTRL_ON, KEYCODE_RIGHT_BRACKET)
                }
            )
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ class ShortcutHelperExclusions @Inject constructor(private val context: Context)
            listOf(
                context.getString(R.string.group_system_cycle_forward),
                context.getString(R.string.group_system_cycle_back),
                context.getString(R.string.system_multiple_desktop_mode_switch_between_desks),
            )

    fun isShortcutCustomizable(label: String) = !nonCustomizableShortcutsLabels.contains(label)