From 3713a4d3bf8ae2df7d02e63b5b827353e5121d19 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 Feb 2023 09:57:47 +0100 Subject: Merging upstream version 20230205. Signed-off-by: Daniel Baumann --- .../vertical-workspaces/workspaceSwitcherPopup.js | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 extensions/vertical-workspaces/workspaceSwitcherPopup.js (limited to 'extensions/vertical-workspaces/workspaceSwitcherPopup.js') diff --git a/extensions/vertical-workspaces/workspaceSwitcherPopup.js b/extensions/vertical-workspaces/workspaceSwitcherPopup.js new file mode 100644 index 0000000..5401903 --- /dev/null +++ b/extensions/vertical-workspaces/workspaceSwitcherPopup.js @@ -0,0 +1,55 @@ +/** + * Vertical Workspaces + * workspacesSwitcherPopup.js + * + * @author GdH + * @copyright 2022 - 2023 + * @license GPL-3.0 + * + */ + +'use strict'; + +const Main = imports.ui.main; +const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup; + +const ExtensionUtils = imports.misc.extensionUtils; +const Me = ExtensionUtils.getCurrentExtension(); + +const _Util = Me.imports.util; +let _overrides; + +let opt; +var _activateSearchProvider; + +function update(reset = false) { + if (_overrides) { + _overrides.removeAll(); + } + + if (reset) { + _overrides = null; + opt = null; + return; + } + + opt = Me.imports.settings.opt; + + _overrides = new _Util.Overrides(); + + if (opt.ORIENTATION) {// 1-VERTICAL, 0-HORIZONTAL + const settings = ExtensionUtils.getSettings('org.gnome.shell'); + const enabled = settings.get_strv('enabled-extensions'); + const allowWsPopupInjection = !(enabled.includes('workspace-switcher-manager@G-dH.github.com') || enabled.includes('WsSwitcherPopupManager@G-dH.github.com-dev')); + if (opt.shellVersion >= 42 && allowWsPopupInjection) + _overrides.addInjection('WorkspaceSwitcherPopup', WorkspaceSwitcherPopup.WorkspaceSwitcherPopup.prototype, WorkspaceSwitcherPopupInjections); + } +} + +const WorkspaceSwitcherPopupInjections = { + _init: function() { + if (this._list) { + this._list.vertical = true; + } + } +} -- cgit v1.2.3