Make Cmd left/right go back/forward#6466
Make Cmd left/right go back/forward#6466FreeTubeBot merged 5 commits intoFreeTubeApp:developmentfrom
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.
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)
| ...( | ||
| 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.
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 spans. 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.
Way too complicated to understand
Left for another PR at least -_-
There was a problem hiding this comment.
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.
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.
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.
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.
|
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 |
absidue
left a comment
There was a problem hiding this comment.
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.
As these new strings are no longer used please remove them.
absidue
left a comment
There was a problem hiding this comment.
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.
|
|
||
| const localizedShortcutNameDictionary = computed(() => { | ||
| const localizedShortcutNameToShortcutsMap = computed(() => { | ||
| return new Map([ |
There was a problem hiding this comment.
| return new Map([ | |
| return [ |
| [t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']], | ||
| [t('KeyboardShortcutPrompt.Last Frame'), ['LAST_FRAME']], | ||
| [t('KeyboardShortcutPrompt.Next Frame'), ['NEXT_FRAME']], | ||
| ]) |
| const shortcutNameToShortcutsMap = localizedShortcutNameToShortcutsMap.value | ||
| const shortcutLabelSeparator = t('shortcutLabelSeparator') | ||
|
|
||
| return shortcutNameToShortcutsMap.entries() |
There was a problem hiding this comment.
| return shortcutNameToShortcutsMap.entries() | |
| return shortcutNameToShortcutsMap |
|
If using Going for later assuming that's good enough |
…ries, update shortcut separator
absidue
left a comment
There was a problem hiding this comment.
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.
* * Make Cmd left/right go back/forward * ! Fix wrong new shortcut * * Allow shortcut label separator to be translated * * Show one action per shortcut action with N shortcuts * * Remove duplicate entry, use array not map, remove unused locale entries, update shortcut separator
* * Make Cmd left/right go back/forward * ! Fix wrong new shortcut * * Allow shortcut label separator to be translated * * Show one action per shortcut action with N shortcuts * * Remove duplicate entry, use array not map, remove unused locale entries, update shortcut separator





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