diff --git a/src/ZenGlanceManager.mjs b/src/ZenGlanceManager.mjs index 3fb086f..443a27c 100644 --- a/src/ZenGlanceManager.mjs +++ b/src/ZenGlanceManager.mjs @@ -136,7 +136,7 @@ } closeGlance({ noAnimation = false } = {}) { - if (this.#animating) { + if (this.#animating || !this.#currentBrowser) { return; } diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index b6f31c5..7ce030d 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -270,6 +270,22 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { openSaveDialog() { let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview'); + + // randomly select an icon + let icon = this._kIcons[Math.floor(Math.random() * this._kIcons.length)]; + this._workspaceCreateInput.textContent = ''; + this._workspaceCreateInput.value = ''; + this._workspaceCreateInput.setAttribute('data-initial-value', ''); + this._workspaceCreateIconsContainer.setAttribute('data-initial-value', icon); + document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => { + if (button.label === icon) { + button.setAttribute('selected', 'true'); + } else { + button.removeAttribute('selected'); + } + }); + document.querySelector('.PanelUI-zen-workspaces-icons-container.create').textContent = icon; + PanelUI.showSubView('PanelUI-zen-workspaces-create', parentPanel); }