mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 18:59:58 +02:00
refactor: Initialize shortcuts only on the browser page
This commit is contained in:
parent
47c4361082
commit
fd893e06f6
2 changed files with 7 additions and 5 deletions
|
@ -136,7 +136,9 @@ var gZenKeyboardShortcuts = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_initShortcuts() {
|
_initShortcuts() {
|
||||||
|
if (window.location.href == "chrome://browser/content/browser.xhtml") {
|
||||||
this._initSavedShortcuts();
|
this._initSavedShortcuts();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createShortcutElement(action) {
|
_createShortcutElement(action) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ var ZenWorkspaces = {
|
||||||
activeWorkspace.used = true;
|
activeWorkspace.used = true;
|
||||||
await this.saveWorkspaces();
|
await this.saveWorkspaces();
|
||||||
}
|
}
|
||||||
await this.changeWorkspace(activeWorkspace);
|
await this.changeWorkspace(activeWorkspace, true);
|
||||||
}
|
}
|
||||||
this._initializeWorkspaceIcons();
|
this._initializeWorkspaceIcons();
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ var ZenWorkspaces = {
|
||||||
button.removeAttribute("disabled");
|
button.removeAttribute("disabled");
|
||||||
},
|
},
|
||||||
|
|
||||||
async changeWorkspace(window) {
|
async changeWorkspace(window, onInit = false) {
|
||||||
if (!this.workspaceEnabled) {
|
if (!this.workspaceEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ var ZenWorkspaces = {
|
||||||
gBrowser.showTab(tab);
|
gBrowser.showTab(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof firstTab === "undefined") {
|
if (typeof firstTab === "undefined" && !onInit) {
|
||||||
this._createNewTabForWorkspace(window);
|
this._createNewTabForWorkspace(window);
|
||||||
}
|
}
|
||||||
for (let tab of gBrowser.tabs) {
|
for (let tab of gBrowser.tabs) {
|
||||||
|
@ -389,7 +389,7 @@ var ZenWorkspaces = {
|
||||||
if (!workspaceID) {
|
if (!workspaceID) {
|
||||||
let workspaces = await this._workspaces();
|
let workspaces = await this._workspaces();
|
||||||
let activeWorkspace = workspaces.workspaces.find(workspace => workspace.used);
|
let activeWorkspace = workspaces.workspaces.find(workspace => workspace.used);
|
||||||
if (!activeWorkspace) {
|
if (!activeWorkspace || tab.hasAttribute("hidden")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tab.setAttribute("zen-workspace-id", activeWorkspace.uuid);
|
tab.setAttribute("zen-workspace-id", activeWorkspace.uuid);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue