diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-05 08:57:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-05 09:07:55 +0000 |
commit | 3713a4d3bf8ae2df7d02e63b5b827353e5121d19 (patch) | |
tree | cd422f385434aa71efd7f501b0da711ea93080a6 /extensions/vertical-workspaces/search.js | |
parent | Adding debian version 20230204-1. (diff) | |
download | gnome-shell-extensions-extra-3713a4d3bf8ae2df7d02e63b5b827353e5121d19.tar.xz gnome-shell-extensions-extra-3713a4d3bf8ae2df7d02e63b5b827353e5121d19.zip |
Merging upstream version 20230205.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extensions/vertical-workspaces/search.js')
-rw-r--r-- | extensions/vertical-workspaces/search.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/extensions/vertical-workspaces/search.js b/extensions/vertical-workspaces/search.js new file mode 100644 index 0000000..3193eb2 --- /dev/null +++ b/extensions/vertical-workspaces/search.js @@ -0,0 +1,52 @@ +/** + * Vertical Workspaces + * search.js + * + * @author GdH <G-dH@github.com> + * @copyright 2022 - 2023 + * @license GPL-3.0 + * + */ + +'use strict'; + +const { Meta } = imports.gi; + +const Main = imports.ui.main; + +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const _Util = Me.imports.util; + +let _overrides; +let opt; + +let SEARCH_MAX_WIDTH; + +function update(reset = false) { + opt = Me.imports.settings.opt; + _updateSearchViewWidth(reset); + + if (reset) { + Main.overview.searchEntry.visible = true; + Main.overview.searchEntry.opacity = 255; + _overrides = null; + opt = null; + return; + } +} + +function _updateSearchViewWidth(reset = false) { + const searchContent = Main.overview._overview._controls.layoutManager._searchController._searchResults._content; + if (!SEARCH_MAX_WIDTH) { // just store original value; + const themeNode = searchContent.get_theme_node(); + const width = themeNode.get_max_width(); + SEARCH_MAX_WIDTH = width; + } + + if (reset) { + searchContent.set_style(''); + } else { + let width = Math.round(SEARCH_MAX_WIDTH * opt.SEARCH_VIEW_SCALE); + searchContent.set_style(`max-width: ${width}px;`); + } +} |