-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Cmd left/right go back/forward #6466
Make Cmd left/right go back/forward #6466
Conversation
src/renderer/helpers/utils.js
Outdated
unlocalizedShortcuts = [unlocalizedShortcuts] | ||
} | ||
const localizedShortcuts = unlocalizedShortcuts.map((s) => getLocalizedShortcut(s)) | ||
return addKeyboardShortcutToActionTitle(localizedActionTitle, localizedShortcuts.join('/')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (blocking): I think we should localize this like we do here for the plus sign. This is the best quick source I could find, but I think it's apparent enough that some languages do this differently:
American English frequently uses the slash symbol to represent the idea of “or” or “and.” To minimize ambiguity in your source English text for translation, it is recommendable to actually use the words “or” or “and.”
const shortcutJoinOperator = i18n.t('shortcutJoinOperator')
return localizedShortcuts.join(shortcutJoinOperator)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
...( | ||
isMac | ||
? [ | ||
['HISTORY_BACKWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Backward (Mac only)')], | ||
['HISTORY_FORWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Forward (Mac only)')], | ||
] | ||
: [] | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): I'm curious if showing a non-monospace slash character joining the different alts would be more elegant than separate entries for alts. I was thinking about storing alts by storing the shortcut constant as A|B
, which is then parsed into A<span>/</span>B
, where we can then apply a separate styling rule (no monospace) to the nested span
s. But that would need some special logic in the caller as well for Mac-only additional shortcut cases like this one, or a separate character for representing non-Mac and Mac-exclusive shortcut alts (e.g., ┛A|┗B|C|D
for Windows/Mac-specific alt A, Mac-specific alt B, and universal alts C and D).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way too complicated to understand
Left for another PR at least -_-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - this will currently be the only action with two displayed shortcuts we have in the modal (I excluded the dupe alt shortcuts in the original PR), so I suggest we move to a more elegant solution when we want to add more of them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this extra shortcut is only displayed to MacOS users, do we really need to specify in the text that it is macOS only? It also uses the command key which doesn't exist on Windows or Linux, so it seems unlikely that someone would try to use it on Windows or Linux anyway if they happen to use macOS + Windows or Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best way is to have 1 action to N shortcut(s)
Not sure how to do that yet...
Let me take a look ~_~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just have two mappings that use the same title, the Map uses the shortcuts as the key, so it should work? That way it'll still be displayed as two separate lines/rows but with different shortcuts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request doesn't actually close the linked issue, this adds Command+Arrow Left and Command+Arrow Right but the feature request is asking for Cmd+[ and Cmd+]. Would you prefer to unlink the issue so that it stays open for someone else to implement in the future or change the code to use the keyboard shortcuts that that person asked for? Edit: According to the Apple Support link that was provided in the issue:
|
@absidue Yup my Vivaldi uses Cmd+arrow key so I got it wrong. Fixed now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would hardcoding a wider separator be an option, just the slash without any whitespace makes it difficult to easily tell that they are two separate shortcuts.
static/locales/en-US.yaml
Outdated
History Backward (Mac only): Go back one page (Mac only) | ||
History Forward (Mac only): Go forward one page (Mac only) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these new strings are no longer used please remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we now just use it as a list and don't actually use it for the look ups, we can just return an array of arrays.
@@ -110,56 +110,60 @@ const primarySections = computed(() => [ | |||
|
|||
const isMac = process.platform === 'darwin' | |||
|
|||
const localizedShortcutNameDictionary = computed(() => { | |||
const localizedShortcutNameToShortcutsMap = computed(() => { | |||
return new Map([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new Map([ | |
return [ |
[t('KeyboardShortcutPrompt.Last Chapter'), ['LAST_CHAPTER']], | ||
[t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']], | ||
[t('KeyboardShortcutPrompt.Last Frame'), ['LAST_FRAME']], | ||
[t('KeyboardShortcutPrompt.Next Frame'), ['NEXT_FRAME']], | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
]) | |
] |
const shortcutNameToShortcutsMap = localizedShortcutNameToShortcutsMap.value | ||
const shortcutLabelSeparator = t('shortcutLabelSeparator') | ||
|
||
return shortcutNameToShortcutsMap.entries() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return shortcutNameToShortcutsMap.entries() | |
return shortcutNameToShortcutsMap |
If using Going for later assuming that's good enough |
…ries, update shortcut separator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a mac so I wasn't able to test this properly but the code looks like it should work and the keyboard shortcuts prompt seems to work the same as it did before on Windows.
Pull Request Type
Related issue
Closes #5966
Description
For MacOS only, make Cmd left/right as an additional keyboard shortcut to go back/forward in history
Screenshots
Old, outdated
Testing
Desktop
Additional context