Swaps the given chords for all matching shortcuts.
This is done by using forceUnequal for each set of matching shortcuts in turn.
EXAMPLES:
Given the following shortcuts:
1A 1B 2C 2D
swapChords([[1]], [[2]]) would result in:
2A 2B 1C 1D
Multiple chords, and chords of unequal lengths can be safely swapped.
12A 12B 3C 3D
swapChords([[1], [2]], [[3]]):
3A 3B 12C 12D
A filter function is provided, to, for example, filter out disabled entries from the swap. Note that it might be unsafe to swap entries with a filter if the new entries can be equal to the ignored ones, hence why the check exists.
Example of how it might be a problem:
A B
shortcutSwapChords([[A]], [[B]], () => { filter that ignores A }) would result in two A shortcuts.
But if, for example, you use the filter to ignore disabled shortcuts, this wouldn't be a problem because you'd get two unequal shortcuts (A and A(disabled)), though re/dis-abling one of them would trigger a conflict.
Note: Certain types of chords cannot be swapped, like empty chords, or chords which share a base.
If using the experimental ignoreModifierConflicts Shortcuts["ignoreModifierConflicts"], note that you cannot use this to swap the base modifiers.
For example, say you had:
Ctrl+A Ctrl
If you do swapChords([Ctrl],[Shift]), Ctrl+A is not considered to match the [Ctrl] chord and you will get:
Swaps the given chords for all matching shortcuts.
This is done by using forceUnequal for each set of matching shortcuts in turn.
EXAMPLES:
Given the following shortcuts:
swapChords([[1]], [[2]])
would result in:Multiple chords, and chords of unequal lengths can be safely swapped.
swapChords([[1], [2]], [[3]])
:A filter function is provided, to, for example, filter out disabled entries from the swap. Note that it might be unsafe to swap entries with a filter if the new entries can be equal to the ignored ones, hence why the
check
exists.Example of how it might be a problem:
shortcutSwapChords([[A]], [[B]], () => { filter that ignores A })
would result in two A shortcuts.But if, for example, you use the filter to ignore disabled shortcuts, this wouldn't be a problem because you'd get two unequal shortcuts (A and A(disabled)), though re/dis-abling one of them would trigger a conflict.
Note: Certain types of chords cannot be swapped, like empty chords, or chords which share a base.
If using the experimental ignoreModifierConflicts Shortcuts["ignoreModifierConflicts"], note that you cannot use this to swap the base modifiers.
For example, say you had:
If you do
swapChords([Ctrl],[Shift])
,Ctrl+A
is not considered to match the[Ctrl]
chord and you will get: