Skip to content

Commit

Permalink
FileView: allow opening current folder in the other view (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
warpdesign authored Jan 24, 2023
1 parent 8eb7911 commit 502a65e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/FileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const FileView = observer(({ hide }: Props) => {
}

const onItemDoubleClick = ({ event }: ItemMouseEvent): void => {
openFileOrDirectory(cursor, event.shiftKey)
openFileOrDirectory(cursor, isMac ? event.altKey : event.ctrlKey)
}

const openFileOrDirectory = (file: FileDescriptor, useInactiveCache: boolean): void => {
Expand All @@ -186,7 +186,7 @@ const FileView = observer(({ hide }: Props) => {

const onOpenFile = (e: KeyboardEvent): void => {
if (isViewActive && cursor) {
openFileOrDirectory(cursor, e.shiftKey)
openFileOrDirectory(cursor, isMac ? e.altKey : e.ctrlKey)
}
}

Expand All @@ -211,8 +211,8 @@ const FileView = observer(({ hide }: Props) => {
},
{
global: true,
combo: 'mod + shift + o',
label: t('SHORTCUT.ACTIVE_VIEW.OPEN_FILE'),
combo: isMac ? 'mod + alt + o' : 'mod + shift + o',
label: t('SHORTCUT.ACTIVE_VIEW.OPEN_FILE_INACTIVE_VIEW'),
onKeyDown: onOpenFile,
group: t('SHORTCUT.GROUP.ACTIVE_VIEW'),
},
Expand Down
4 changes: 4 additions & 0 deletions src/components/dialogs/ShortcutsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const buildShortcuts = (t: TFunction<'translation', undefined>) => ({
{ combo: 'mod + shift + c', label: t('SHORTCUT.ACTIVE_VIEW.COPY_PATH') },
{ combo: 'mod + shift + n', label: t('SHORTCUT.ACTIVE_VIEW.COPY_FILENAME') },
{ combo: 'mod + o', label: t('SHORTCUT.ACTIVE_VIEW.OPEN_FILE') },
{
combo: isMac ? 'mod + alt + o' : 'mod + shift + o',
label: t('SHORTCUT.ACTIVE_VIEW.OPEN_FILE_INACTIVE_VIEW'),
},
{ combo: 'mod + a', label: t('SHORTCUT.ACTIVE_VIEW.SELECT_ALL') },
{ combo: 'mod + i', label: t('SHORTCUT.ACTIVE_VIEW.SELECT_INVERT') },
{ combo: 'mod + l', label: t('SHORTCUT.ACTIVE_VIEW.FOCUS_PATH') },
Expand Down
1 change: 1 addition & 0 deletions src/locale/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"BACKWARD_HISTORY": "Go Back",
"FORWARD_HISTORY": "Go Forward",
"OPEN_FILE": "Open the selected file/folder",
"OPEN_FILE_INACTIVE_VIEW": "Open the selected file/folder in the other view",
"COPY_PATH": "Copy selected items'path into the clipboard",
"COPY_FILENAME": "Copy selected items' filenames into the clipboard",
"DELETE": "Delete selected items",
Expand Down
1 change: 1 addition & 0 deletions src/locale/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"BACKWARD_HISTORY": "Reculer d'un dossier (historique)",
"FORWARD_HISTORY": "Avancer d'un dossier (historique)",
"OPEN_FILE": "Ouvre le fichier/dossier sélectionné",
"OPEN_FILE_INACTIVE_VIEW": "Ouvre le fichier/dossier sélectionné dans l'autre vue",
"COPY_PATH": "Copier le chemin des éléments sélectionnés",
"COPY_FILENAME": "Copier le nom des éléments sélectionnés",
"DELETE": "Supprimer les éléments sélectionnés",
Expand Down

0 comments on commit 502a65e

Please sign in to comment.