aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-06-14 12:48:09 -0400
committerGitHub <noreply@github.com>2024-06-14 16:48:09 +0000
commite4331ab90ee605e073139e20772d5ec69110ec1e (patch)
tree9cba972a9853d4b8d082873d2511285bc743118b /ext/js/display
parent25bbe3f86a16d6ebece160af435e899f0ba45e44 (diff)
Add web option to profile switching keybinds (#933)
* Add web option to profile switching keybinds * Fix spacing * Refactor * Fix comment on update * Make linter happy --------- Signed-off-by: Kuuuube <61125188+Kuuuube@users.noreply.github.com>
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display.js25
1 files changed, 3 insertions, 22 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index 82d84979..e9fdfd9f 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -26,6 +26,7 @@ import {ExtensionError} from '../core/extension-error.js';
import {log} from '../core/log.js';
import {toError} from '../core/to-error.js';
import {clone, deepEqual, promiseTimeout} from '../core/utilities.js';
+import {setProfile} from '../data/profiles-util.js';
import {PopupMenu} from '../dom/popup-menu.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
import {ScrollElement} from '../dom/scroll-element.js';
@@ -200,8 +201,8 @@ export class Display extends EventDispatcher {
['firstEntry', () => { this._focusEntry(0, 0, true); }],
['historyBackward', () => { this._sourceTermView(); }],
['historyForward', () => { this._nextTermView(); }],
- ['profilePrevious', async () => { await this._setProfile(-1); }],
- ['profileNext', async () => { await this._setProfile(1); }],
+ ['profilePrevious', async () => { await setProfile(-1, this._application); }],
+ ['profileNext', async () => { await setProfile(1, this._application); }],
['copyHostSelection', () => this._copyHostSelection()],
['nextEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(1, true); }],
['previousEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(-1, true); }],
@@ -2029,26 +2030,6 @@ export class Display extends EventDispatcher {
this._focusEntry(this._index + count * sign, 0, true);
}
- /**
- * @param {number} direction
- */
- async _setProfile(direction) {
- const optionsFull = await this.application.api.optionsGetFull();
-
- const profileCount = optionsFull.profiles.length;
- const newProfile = (optionsFull.profileCurrent + direction + profileCount) % profileCount;
-
- /** @type {import('settings-modifications').ScopedModificationSet} */
- const modification = {
- action: 'set',
- path: 'profileCurrent',
- value: newProfile,
- scope: 'global',
- optionsContext: null,
- };
- await this.application.api.modifySettings([modification], 'search');
- }
-
/** */
_closeAllPopupMenus() {
for (const popupMenu of PopupMenu.openMenus) {