Open repository keybinding can also be used in welcome page to open file explorer

This commit is contained in:
Abdelilah El Aissaoui 2024-09-14 15:50:08 +02:00
parent fb542c9677
commit aab0e01a30
No known key found for this signature in database
GPG Key ID: 7587FC860F594869
3 changed files with 13 additions and 5 deletions

View File

@ -69,9 +69,9 @@ enum class KeybindingOption {
STASH_POP,
/**
* Used to pop stash changes to workspace
* Used to open a repository
*/
OPEN_ANOTHER_REPOSITORY,
OPEN_REPOSITORY,
/**
* Used to open a new tab
@ -131,7 +131,7 @@ private fun baseKeybindings() = mapOf(
KeybindingOption.STASH_POP to listOf(
Keybinding(key = Key.S, control = true, shift = true),
),
KeybindingOption.OPEN_ANOTHER_REPOSITORY to listOf(
KeybindingOption.OPEN_REPOSITORY to listOf(
Keybinding(key = Key.O, control = true),
),
KeybindingOption.OPEN_NEW_TAB to listOf(

View File

@ -22,7 +22,6 @@ import com.jetpackduba.gitnuro.keybindings.KeybindingOption
import com.jetpackduba.gitnuro.keybindings.matchesBinding
import com.jetpackduba.gitnuro.models.AuthorInfoSimple
import com.jetpackduba.gitnuro.ui.components.SecondaryButton
import com.jetpackduba.gitnuro.ui.components.TabInformation
import com.jetpackduba.gitnuro.ui.components.TripleVerticalSplitPanel
import com.jetpackduba.gitnuro.ui.dialogs.*
import com.jetpackduba.gitnuro.ui.diff.Diff
@ -154,7 +153,7 @@ fun RepositoryOpenPage(
true
}
it.matchesBinding(KeybindingOption.OPEN_ANOTHER_REPOSITORY) -> {
it.matchesBinding(KeybindingOption.OPEN_REPOSITORY) -> {
showOpenPopup = true
true
}

View File

@ -130,6 +130,15 @@ fun WelcomeView(
.focusable(true)
.focusRequester(welcomeViewFocusRequester)
.background(MaterialTheme.colors.surface)
.onPreviewKeyEvent {
when {
it.matchesBinding(KeybindingOption.OPEN_REPOSITORY) -> {
onOpenRepository()
true
}
else -> false
}
},
) {
Column(