Adding upstream version 20230618.
Signed-off-by: Daniel Baumann <daniel@debian.org>
|
@ -1,3 +1,15 @@
|
|||
2023-06-18 Daniel Baumann <daniel.baumann@progress-linux.org>
|
||||
|
||||
* Releasing version 20230618.
|
||||
|
||||
[ Daniel Baumann ]
|
||||
* Adding todo file.
|
||||
* Updating disable-workspace-switcher to version 2 [39fded2].
|
||||
* Updating hibernate-status to version 20230505 [d11284d].
|
||||
* Updating middleclickclose to version 1.9.1 [f1e773d].
|
||||
* Updating multi-monitors-add-on to version 26 [d8ea040].
|
||||
* Updating vertical-workspaces to version 28 [891a8df].
|
||||
|
||||
2023-02-05 Daniel Baumann <daniel.baumann@progress-linux.org>
|
||||
|
||||
* Releasing version 20230205.
|
||||
|
|
2
Makefile
|
@ -41,7 +41,7 @@ package-build: share/man/*.rst
|
|||
|
||||
package-install: package-build
|
||||
mkdir -p $(DESTDIR)/usr/share/doc/$(SOFTWARE)
|
||||
cp -r CHANGELOG.txt LICENSE.txt README.txt $(DESTDIR)/usr/share/doc/$(SOFTWARE)
|
||||
cp -r CHANGELOG.txt LICENSE.txt README.txt share/doc/* $(DESTDIR)/usr/share/doc/$(SOFTWARE)
|
||||
|
||||
for SECTION in $$(seq 1 8); \
|
||||
do \
|
||||
|
|
|
@ -1 +1 @@
|
|||
20230205
|
||||
20230618
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"url": "https://github.com/jbradaric/disable-workspace-switcher",
|
||||
"shell-version": [
|
||||
"42",
|
||||
"43"
|
||||
"43",
|
||||
"44"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ install-local: _build
|
|||
cp -r ./_build/* $(INSTALLBASE)/$(INSTALLNAME)/
|
||||
ifeq ($(INSTALLTYPE),system)
|
||||
# system-wide settings and locale files
|
||||
# rm -r $(INSTALLBASE)/$(INSTALLNAME)/schemas
|
||||
rm -f $(INSTALLBASE)/$(INSTALLNAME)/schemas/*gschema.xml
|
||||
rm -r $(INSTALLBASE)/$(INSTALLNAME)/schemas
|
||||
rm -r $(INSTALLBASE)/$(INSTALLNAME)/locale
|
||||
mkdir -p $(SHARE_PREFIX)/glib-2.0/schemas $(SHARE_PREFIX)/locale
|
||||
cp -r ./schemas/*gschema.* $(SHARE_PREFIX)/glib-2.0/schemas
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
# Bulgarian translation of hibernate-status-button
|
||||
# Copyright (C) 2023 Zetta1 Reid0
|
||||
# This file is distributed under the same license as the hibernate-status-button package.
|
||||
# Zetta1 Reid0, 2023.
|
||||
#
|
||||
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hibernate Status Button\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 17.03.2023 12:41+0200\n"
|
||||
"PO-Revision-Date: 17.03.2023 12:41+0200\n"
|
||||
"Last-Translator: Zetta1 Reid0\n"
|
||||
"Language-Team: Bulgarian\n"
|
||||
"Language: bg\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
|
||||
"X-Generator: Poedit 3.0\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
|
||||
#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32
|
||||
msgid "Hibernate"
|
||||
msgstr "Хиберниране"
|
||||
|
||||
#: extension.js:192
|
||||
msgid "Hybrid Sleep"
|
||||
msgstr "Хибридно Приспиване"
|
||||
|
||||
#: confirmDialog.js:24
|
||||
msgid "Do you really want to hibernate the system?"
|
||||
msgstr "Наистина ли искате да хибернирате системата?"
|
||||
|
||||
#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67
|
||||
msgid "Cancel"
|
||||
msgstr "Отказ"
|
||||
|
||||
#: confirmDialog.js:40
|
||||
msgid "Hibernate button: Systemd Missing"
|
||||
msgstr "Бутон за Хибернация: Systemd Липсва."
|
||||
|
||||
#: confirmDialog.js:41
|
||||
msgid "Systemd seems to be missing and is required."
|
||||
msgstr "Systemd изглежда че липсва, а е задължително."
|
||||
|
||||
#: confirmDialog.js:49 confirmDialog.js:72
|
||||
msgid "Disable Extension"
|
||||
msgstr "Изключване на Разширението"
|
||||
|
||||
#: confirmDialog.js:58
|
||||
msgid "Hibernate button: Hibernate failed"
|
||||
msgstr "Бутон за Хибернация: Хибернирането се провали."
|
||||
|
||||
#: confirmDialog.js:59
|
||||
msgid ""
|
||||
"Looks like hibernation failed.\n"
|
||||
"On some linux distributions hibernation is disabled\n"
|
||||
"because not all hardware supports it well;\n"
|
||||
"please check your distribution documentation\n"
|
||||
"on how to enable it."
|
||||
msgstr ""
|
||||
"Изглежда че Хибернацията се провали.\n"
|
||||
"На някой Линукс дистрибуции хибернирането е изключено,\n"
|
||||
"защото не всеки хардуер го поддържа добре.\n"
|
||||
"Моля проверете документацията на вашата дистрибуция\n"
|
||||
"за това как да я включите"
|
||||
|
||||
#: confirmDialog.js:64
|
||||
msgid "You are wrong, don't check this anymore!"
|
||||
msgstr "Вие сте в грешка, Не проверявайте това повече!"
|
||||
|
||||
#: prefs.js:99
|
||||
msgid "This extension has no settings available"
|
||||
msgstr "Това разширение няма налични настройки."
|
|
@ -0,0 +1,72 @@
|
|||
# Hungarian translation of hibernate-status-button
|
||||
# Copyright (C) 2023 ViBE
|
||||
# This file is distributed under the same license as the hibernate-status-button package.
|
||||
# ViBE <vibe@protonmail.com>, 2023.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hibernate Status Button\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-04-11 18:31+0200\n"
|
||||
"PO-Revision-Date: 2023-02-25 00:00+0100\n"
|
||||
"Last-Translator: ViBE <vibe@protonmail.com>\n"
|
||||
"Language-Team: Hungarian <vibe@protonmail.com>\n"
|
||||
"Language: hu\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
|
||||
"X-Generator: Gtranslator 41.0\n"
|
||||
|
||||
#: confirmDialog.js:23 confirmDialog.js:32
|
||||
msgid "Hibernate"
|
||||
msgstr "Hibernálás"
|
||||
|
||||
#: extension.js:192
|
||||
msgid "Hybrid Sleep"
|
||||
msgstr "Hibrid felfüggesztés"
|
||||
|
||||
#: confirmDialog.js:24
|
||||
msgid "Do you really want to hibernate the system?"
|
||||
msgstr "Valóban hibernálni szeretné a rendszert?"
|
||||
|
||||
#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67
|
||||
msgid "Cancel"
|
||||
msgstr "Mégse"
|
||||
|
||||
#: confirmDialog.js:40
|
||||
msgid "Hibernate button: Systemd Missing"
|
||||
msgstr "Hibernate button: systemd nem található"
|
||||
|
||||
#: confirmDialog.js:41
|
||||
msgid "Systemd seems to be missing and is required."
|
||||
msgstr "Úgy tűnik, hogy a hibernáláshoz szükséges systemd nincs telepítve."
|
||||
|
||||
#: confirmDialog.js:49 confirmDialog.js:72
|
||||
msgid "Disable Extension"
|
||||
msgstr "Kiterjesztés letiltása"
|
||||
|
||||
#: confirmDialog.js:58
|
||||
msgid "Hibernate button: Hibernate failed"
|
||||
msgstr "Hibernate button: Hibernálás meghiúsult"
|
||||
|
||||
#: confirmDialog.js:59
|
||||
msgid ""
|
||||
"Looks like hibernation failed.\n"
|
||||
"On some linux distributions hibernation is disabled\n"
|
||||
"because not all hardware supports it well;\n"
|
||||
"please check your distribution documentation\n"
|
||||
"on how to enable it."
|
||||
msgstr ""
|
||||
"Úgy tűnik, hogy a hibernálás sikertelen volt.\n"
|
||||
"Egyes Linux kiadások nem támogatják ezt a funkciót,\n"
|
||||
"mert nem minden eszköz támogatja a hibernálást;\n"
|
||||
"engedélyezéshez ellenőrizze a rendszer dokumentációját!"
|
||||
|
||||
#: confirmDialog.js:64
|
||||
msgid "You are wrong, don't check this anymore!"
|
||||
msgstr "Ne ellenőrizd ezt többet!"
|
||||
|
||||
#: prefs.js:99
|
||||
msgid "This extension has no settings available"
|
||||
msgstr "Ennek a kiterjesztésnek nincsenek beállításai"
|
|
@ -22,6 +22,10 @@ msgstr ""
|
|||
msgid "Hibernate"
|
||||
msgstr "Slaapstand"
|
||||
|
||||
#: extension.js:192
|
||||
msgid "Hybrid Sleep"
|
||||
msgstr "Hybride slaapstand"
|
||||
|
||||
#: confirmDialog.js:24
|
||||
msgid "Do you really want to hibernate the system?"
|
||||
msgstr "Weet u zeker dat u het systeem in de slaapstand wilt zetten?"
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
# Russian translation of hibernate-status-button
|
||||
# Copyright (C) 2021 Serhii Riznychenko
|
||||
# Updated 2023 Dmitriy Sevastyuk
|
||||
# This file is distributed under the same license as the hibernate-status-button package.
|
||||
# Serhii Riznychenko, 2021.
|
||||
# Dmitriy Sevastyuk, 2023.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hibernate Status Button\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-04-11 18:31+0200\n"
|
||||
"PO-Revision-Date: 2021-11-11 02:00+0200\n"
|
||||
"Last-Translator: Serhii Riznychenko\n"
|
||||
"PO-Revision-Date: 2023-04-01 07:00+0300\n"
|
||||
"Last-Translator: Dmitriy Sevastyuk\n"
|
||||
"Language-Team: Russian\n"
|
||||
"Language: ru\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -21,7 +23,7 @@ msgstr ""
|
|||
|
||||
#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32
|
||||
msgid "Hibernate"
|
||||
msgstr "Спящий режим"
|
||||
msgstr "Режим гибернации"
|
||||
|
||||
#: extension.js:192
|
||||
msgid "Hybrid Sleep"
|
||||
|
@ -29,7 +31,7 @@ msgstr "Гибридный сон"
|
|||
|
||||
#: confirmDialog.js:24
|
||||
msgid "Do you really want to hibernate the system?"
|
||||
msgstr "Вы действительно хотите перевести систему в спящий режим?"
|
||||
msgstr "Вы действительно хотите перевести систему в режим гибернации?"
|
||||
|
||||
#: confirmDialog.js:27 confirmDialog.js:44 confirmDialog.js:67
|
||||
msgid "Cancel"
|
||||
|
@ -41,7 +43,7 @@ msgstr "Не обнаружено systemd"
|
|||
|
||||
#: confirmDialog.js:41
|
||||
msgid "Systemd seems to be missing and is required."
|
||||
msgstr "Кажется отсутствует systemd, необходимый для режима сна."
|
||||
msgstr "Кажется отсутствует systemd, но он необходим."
|
||||
|
||||
#: confirmDialog.js:49 confirmDialog.js:72
|
||||
msgid "Disable Extension"
|
||||
|
@ -49,7 +51,7 @@ msgstr "Отключить расширение"
|
|||
|
||||
#: confirmDialog.js:58
|
||||
msgid "Hibernate button: Hibernate failed"
|
||||
msgstr "Не удалось перевести систему в сон"
|
||||
msgstr "Не удалось перевести систему в режим гибернации"
|
||||
|
||||
#: confirmDialog.js:59
|
||||
msgid ""
|
||||
|
@ -59,10 +61,10 @@ msgid ""
|
|||
"please check your distribution documentation\n"
|
||||
"on how to enable it."
|
||||
msgstr ""
|
||||
"Попытка перевести систему в сон завершилась неудачей.\n"
|
||||
"На некоторых дистрибутивах режим сна отключен\n"
|
||||
"так как не каждое оборудование имеет поддержку,\n"
|
||||
"пожалуйста обратитесь к документации своего дистрибутива\n"
|
||||
"Похоже, перевод системы в режим гибернации завершился неудачей.\n"
|
||||
"На некоторых дистрибутивах режим гибернации отключён,\n"
|
||||
"так как не всё оборудование должным образом его поддерживает;\n"
|
||||
"пожалуйста, обратитесь к документации своего дистрибутива\n"
|
||||
"чтобы узнать как его включить."
|
||||
|
||||
#: confirmDialog.js:64
|
||||
|
@ -71,4 +73,4 @@ msgstr "Вы ошиблись, пожалуйста не трогайте это
|
|||
|
||||
#: prefs.js:99
|
||||
msgid "This extension has no settings available"
|
||||
msgstr "Это расширение не содержит параметров"
|
||||
msgstr "Это расширение не имеет параметров"
|
||||
|
|
|
@ -16,10 +16,14 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: confirmDialog.js:23 confirmDialog.js:32
|
||||
#: extension.js:189 confirmDialog.js:23 confirmDialog.js:32
|
||||
msgid "Hibernate"
|
||||
msgstr "休眠"
|
||||
|
||||
#: extension.js:192
|
||||
msgid "Hybrid Sleep"
|
||||
msgstr "混合睡眠"
|
||||
|
||||
#: confirmDialog.js:24
|
||||
msgid "Do you really want to hibernate the system?"
|
||||
msgstr "确定要休眠系统吗?"
|
||||
|
@ -57,3 +61,7 @@ msgstr "休眠好像失败了。由于不是所有硬件都对该功能支持良
|
|||
#: confirmDialog.js:64
|
||||
msgid "You are wrong, don't check this anymore!"
|
||||
msgstr "忽略本项检查"
|
||||
|
||||
#: prefs.js:99
|
||||
msgid "This extension has no settings available"
|
||||
msgstr "这个扩展没有可用的设置"
|
|
@ -4,7 +4,8 @@
|
|||
"url": "https://github.com/arelange/gnome-shell-extension-hibernate-status",
|
||||
"description": "Adds a Hibernate button in Status menu. Using Alt modifier, you can also select Hybrid Sleep instead.",
|
||||
"shell-version": [
|
||||
"43"
|
||||
"43",
|
||||
"44"
|
||||
],
|
||||
"gettext-domain": "hibernate-status-button"
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ var Prefs = class Prefs {
|
|||
this.KEY_HIBERNATE_WORKS_CHECK = "hibernate-works-check";
|
||||
this._schemaName = "org.gnome.shell.extensions.hibernate-status-button";
|
||||
|
||||
// first try developer local schema
|
||||
try {
|
||||
let schemaDir = Me.dir.get_child('schemas').get_path();
|
||||
|
||||
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(
|
||||
|
@ -27,6 +29,14 @@ var Prefs = class Prefs {
|
|||
this._setting = new Gio.Settings({
|
||||
settings_schema: schema
|
||||
});
|
||||
return;
|
||||
} catch (e) {
|
||||
// now try system-wide one below
|
||||
}
|
||||
|
||||
this._setting = new Gio.Settings({
|
||||
schema_id: this._schemaName
|
||||
});
|
||||
}
|
||||
/**
|
||||
* <p>Binds the given 'callback'-function to the "changed"-signal on the given
|
||||
|
|
|
@ -18,6 +18,6 @@ Otherwise you may
|
|||
glib-compile-schemas $HOME/.local/share/gnome-shell/extensions/middleclickclose@paolo.tranquilli.gmail.com/schemas
|
||||
```
|
||||
|
||||
* reload gnome-shell (Alt-F2, r, Enter)
|
||||
* activate it through Gnome Tweak Tool.
|
||||
* reload gnome-shell (Alt-F2, r, Enter) -> on Wayland you need to log out and log in again, there is no in-place reload
|
||||
* activate it through the Extensions gnome application.
|
||||
![](tweak-tool-screenshot.png)
|
||||
|
|
|
@ -27,6 +27,7 @@ const Workspace = imports.ui.workspace
|
|||
const WindowPreview = imports.ui.windowPreview.WindowPreview
|
||||
const Mainloop = imports.mainloop;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
|
@ -53,8 +54,6 @@ var Init = class Init {
|
|||
}
|
||||
|
||||
enable() {
|
||||
this._oldActivate = WindowPreview.prototype._activate;
|
||||
this._oldDoRemoveWindow = Workspace.Workspace.prototype._doRemoveWindow;
|
||||
this._oldAddWindowClone = Workspace.Workspace.prototype._addWindowClone;
|
||||
this._settings = ExtensionUtils.getSettings();
|
||||
this._oldDelay = Workspace.WINDOW_REPOSITIONING_DELAY;
|
||||
|
@ -69,20 +68,27 @@ var Init = class Init {
|
|||
if (action.get_button() == init._closeButton) {
|
||||
this._deleteAll();
|
||||
} else {
|
||||
init._oldActivate.apply(this);
|
||||
WindowPreview.prototype._activate.apply(this);
|
||||
}
|
||||
};
|
||||
|
||||
// override _addWindowClone to add my event handler
|
||||
Workspace.Workspace.prototype._addWindowClone = function(metaWindow) {
|
||||
let clone = init._oldAddWindowClone.apply(this, [metaWindow]);
|
||||
|
||||
// remove default 'clicked' signal handler
|
||||
let id = GObject.signal_handler_find(
|
||||
clone.get_actions()[0],
|
||||
{signalId: 'clicked'}
|
||||
)
|
||||
clone.get_actions()[0].disconnect(id);
|
||||
|
||||
// add custom 'clicked' signal handler
|
||||
clone.get_actions()[0].connect('clicked', onClicked.bind(clone));
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
// override WindowClone's _activate
|
||||
WindowPreview.prototype._activate = () => {};
|
||||
|
||||
// override Workspace's _doRemoveWindow in order to put into it the
|
||||
// parameteriseable rearrangement delay. Rather than copy the code from
|
||||
// workspace.js, we reuse it but remove the scheduled rearrangement task
|
||||
|
@ -93,8 +99,6 @@ var Init = class Init {
|
|||
}
|
||||
|
||||
disable() {
|
||||
WindowPreview.prototype._activate = this._oldActivate;
|
||||
Workspace.Workspace.prototype._doRemoveWindow = this._oldDoRemoveWindow;
|
||||
Workspace.WINDOW_REPOSITIONING_DELAY = this._oldDelay;
|
||||
Workspace.Workspace.prototype._addWindowClone = this._oldAddWindowClone;
|
||||
this._disconnectSettings();
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{
|
||||
"shell-version": [
|
||||
"42",
|
||||
"43"
|
||||
],
|
||||
"shell-version": ["42","43","44"],
|
||||
"settings-schema": "org.gnome.shell.extensions.middleclickclose",
|
||||
"gettext-domain": "org.gnome.shell.extensions.middleclickclose",
|
||||
"uuid": "middleclickclose@paolo.tranquilli.gmail.com",
|
||||
|
|
|
@ -65,7 +65,7 @@ class MultiMonitorsAddOn {
|
|||
|
||||
constructor() {
|
||||
this._settings = Convenience.getSettings();
|
||||
this._ov_settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
||||
// this._ov_settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
||||
this._mu_settings = new Gio.Settings({ schema: MUTTER_SCHEMA });
|
||||
|
||||
this.mmIndicator = null;
|
||||
|
@ -100,8 +100,8 @@ class MultiMonitorsAddOn {
|
|||
return;
|
||||
}
|
||||
|
||||
if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
this._ov_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false);
|
||||
// if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
// this._ov_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false);
|
||||
if(this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
this._mu_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false);
|
||||
|
||||
|
@ -174,7 +174,10 @@ class MultiMonitorsAddOn {
|
|||
}
|
||||
|
||||
_switchOffThumbnails() {
|
||||
if (this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID) || this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) {
|
||||
if (
|
||||
// this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID) ||
|
||||
this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
{
|
||||
this._settings.set_string(THUMBNAILS_SLIDER_POSITION_ID, 'none');
|
||||
}
|
||||
}
|
||||
|
@ -187,8 +190,8 @@ class MultiMonitorsAddOn {
|
|||
|
||||
this._mmMonitors = 0;
|
||||
|
||||
this._switchOffThumbnailsOvId = this._ov_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID,
|
||||
this._switchOffThumbnails.bind(this));
|
||||
// this._switchOffThumbnailsOvId = this._ov_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID,
|
||||
// this._switchOffThumbnails.bind(this));
|
||||
this._switchOffThumbnailsMuId = this._mu_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID,
|
||||
this._switchOffThumbnails.bind(this));
|
||||
|
||||
|
@ -206,7 +209,7 @@ class MultiMonitorsAddOn {
|
|||
|
||||
disable() {
|
||||
Main.layoutManager.disconnect(this._relayoutId);
|
||||
this._ov_settings.disconnect(this._switchOffThumbnailsOvId);
|
||||
// this._ov_settings.disconnect(this._switchOffThumbnailsOvId);
|
||||
this._mu_settings.disconnect(this._switchOffThumbnailsMuId);
|
||||
|
||||
this._settings.disconnect(this._showPanelId);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"shell-version": ["40", "41", "42", "43"],
|
||||
"shell-version": ["40", "41", "42", "43", "44"],
|
||||
"uuid": "multi-monitors-add-on@spin83",
|
||||
"name": "Multi Monitors Add-On",
|
||||
"settings-schema": "org.gnome.shell.extensions.multi-monitors-add-on",
|
||||
"gettext-domain": "multi-monitors-add-on",
|
||||
"description": "Add multiple monitors overview and panel for gnome-shell.",
|
||||
"url": "https://github.com/spin83/multi-monitors-add-on.git",
|
||||
"version": 25
|
||||
"version": 26
|
||||
}
|
||||
|
|
39
extensions/vertical-workspaces/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Basic debug information**
|
||||
- Did disabling all other extensions help?
|
||||
- Did you find conflicting extension?
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**System:**
|
||||
- OS: [e.g. Fedora 38]
|
||||
- Version of V-Shell extension: [e.g. 25]
|
||||
- Source of installation: [e.g. extension.gnome.org, GitHub]
|
||||
- Other installed and enabled extensions: ...
|
||||
|
||||
**System log output**
|
||||
open terminal, execute:
|
||||
`journalctl /usr/bin/{gjs,gnome-shell} -fo cat`
|
||||
reproduce the bug, copy the output from terminal if any.
|
20
extensions/vertical-workspaces/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -1,22 +1,103 @@
|
|||
## Changelog:
|
||||
|
||||
### v24 (not released yet)
|
||||
### v28 (2023-04-06)
|
||||
**Added:**
|
||||
- Support for horizontally stacked workspaces, available through `Workspaces Thumbnails Position` option.
|
||||
- Options `Workspaces Scale` and `Workspaces Spacing` adjustments for workspace preview.
|
||||
- Options `App Search Icon Size` with reduced spacing between icons and `Search Results Width`.
|
||||
- Option `Workspace Switcher Animation` / `Static Backgroud` for static background while switching workspaces outside of the overview.
|
||||
- Open preferences by middle click on *Show Applications button* in the dash (default dash only).
|
||||
- Text shadow in labels of app grid view icons for better visibility on lighter backgrounds, in case you use `Show Static Background` option for the overview.
|
||||
- App Grid - vertical app folder orientation
|
||||
- App Grid - *App Grid Page Width Scale* and *Grid Spacing* options
|
||||
- Dash - *Click Behavior* option *Open New Window (if supported)* - switches primary and middle mouse buttons action
|
||||
- Improved support for scaled display and icon sizing
|
||||
|
||||
**Fixed:**
|
||||
- Improved blur effect transitions performance
|
||||
- Smaller single windows not properly scaling with workspace preview in `Expose Windows on Hover` mode.
|
||||
- (upstream bug) Closing windows in the overview fills log with "access to destroyed" object errors.
|
||||
- Missing default profile names
|
||||
- App Grid - *Allow Incomplete Pages* option has no effect
|
||||
- App Grid - adaptive folder grid size can exceed display/dialog size
|
||||
- App Grid - unnecessary side spacing when dash and workspace thumbnails are horizontal
|
||||
- Workspace switcher popup when switching workspaces using gestures
|
||||
|
||||
**Other changes:**
|
||||
- Default profiles values
|
||||
- Settings window - Profile buttons order
|
||||
|
||||
|
||||
### v27 (2023-03-24)
|
||||
**Added:**
|
||||
- Predefined customizable profiles for quick configuration changes. The predefined profiles can set the V-Shell to behave like GNOME Shell 3.xx or 40+, make work with the default hot corner more efficient, or make overview behave more like a dock.
|
||||
- Super key double-press behavior options
|
||||
- Brightness setting for background wallpaper in the overview
|
||||
- Hot corner position and hot edge options
|
||||
- Window preview option *Always Activate Selected* allows to switch windows using the overview without clicking
|
||||
- Scrolling over the app icon in the dash can switch between application window previews
|
||||
- OSD position options
|
||||
- Customizable workspace preview corner radius
|
||||
|
||||
**Changed:**
|
||||
- Default max result rows changed from 10 to 5
|
||||
- Max result rows for recent file search provider set to fixed 20 (these results are not included in the standard search)
|
||||
|
||||
**Fixed:**
|
||||
- Dash style affects Dash to Dock / Ubuntu Dock background
|
||||
- GS44 app grid folders - DND with pinned/favorite/running apps can crash the Shell
|
||||
- Compatibility with Dash to Panel and Hide Top Bar extensions
|
||||
- Compatibility with Desktop Cube extension (in horizontal mode)
|
||||
- Dash icon click behavior options moved from appDisplay to dash module
|
||||
- Bg blur transition to the search view
|
||||
|
||||
|
||||
### v26 (2023-03-08)
|
||||
**Added:**
|
||||
- V-Shell modules control - allows disabling expendable modules if they are in conflict with preferred other extensions, or misbehave.
|
||||
- Hot corner options
|
||||
|
||||
**Fixed:**
|
||||
- App grid's adaptive grid size algorithm doesn't support screen scaling.
|
||||
- App grid label option *Always Expanded* doesn't expand labels until the icon is hovered by the pointer.
|
||||
- Scroll over panel that is in the *Overview Only* mode switches workspace.
|
||||
- Leaving the overview using gesture if any window is selected fills the system log with errors - upstream bug.
|
||||
- Panel style transitions in other than default modes.
|
||||
- Overview keyboard navigation.
|
||||
|
||||
|
||||
### v24/25 (2023-03-03)
|
||||
**Added:**
|
||||
- Support for GNOME Shell 44.
|
||||
- Support for horizontally stacked workspaces, the orientation follows `Workspaces Thumbnails Position` option.
|
||||
- `Dash Max Icon Size` menu now offers 80, 96, 112 and 128 px options.
|
||||
- Dash can use available space better if resizes its icons when there is not enough space on the screen for the chosen icon size.
|
||||
- Options `Dash Icon Click`: `Activate Last Used Window Immediately` (default behavior) and `Switch to Workspace with Recently Used Window` which allows you to see an overview of the workspace with the app window before activating it and closing the overview.
|
||||
- Options `Workspaces Scale` and `Workspaces Spacing` adjustments for workspace preview.
|
||||
- Option `Workspace Switcher Animation` / `Static Background` for static background while switching workspaces outside of the overview.
|
||||
- Options `Main Panel Position` and `Main Panel Visibility` allows moving the main panel at the bottom of the screen, hide it, or only show it in the Activities overview.
|
||||
- Options `App Search Icon Size` with reduced spacing between icons and `Search Results Width`.
|
||||
- Option `Max Search Results Rows` allows to set maximum number of rows for all search providers (except for the app search provider that uses grid instead of the list).
|
||||
- Optional Search view transition animation.
|
||||
- Optional `Window Search Provider` directly accessible via an optional icon in the dash, by pressing the Space key in the overview, or by secondary mouse button click on the 'Show Apps' dash icon.
|
||||
- Secondary mouse button click on a window preview opens window search provider searching for the window app name.
|
||||
- Optional `Recent Files Search Provider` directly accessible via an optional icon in the dash or by pressing the Ctr+Space key in the overview.
|
||||
- Text shadow in labels of app grid view icons for better visibility on lighter backgrounds, in case you use `Show Static Background` option for the overview.
|
||||
- Open preferences by middle click on *Show Applications button* in the dash (default dash only).
|
||||
- Option to show current window title in the workspace thumbnail label.
|
||||
- `Close Workspace Button` option can add close button to workspace thumbnails that allows you to close all windows on the workspace/monitor. You can choose whether it close on single click, double-click or single click while holding down the Ctrl key.
|
||||
- App Grid options - `Icon Size`, `Columns/Rows per Page`, `Apps Order` - `Custom`, `Alphabet`, `Usage`, option to `Include Dash Items`, `Reset App Grid Layout`, `Remove App Grid Folders`.
|
||||
- App Grid's *Include Dash Items* option changed to `App Grid Content` and allows exclude favorites and/or running apps from the grid also in the default custom layout mode.
|
||||
- Option `App Labels Behavior` offers setting App Grid app labels to show always expanded or hide them if the app icon is not selected.
|
||||
- Option `Active Icons in Preview Folders` allows you using icons in the folder preview as normal app icons without opening the folder.
|
||||
- App folder preview icons can be displayed in 3x3 grid instead of 2x2 and icon/folder size can be set up to 256px to allow bigger Active folder icons.
|
||||
- Improved app search, now you can find *Firefox* even if you enter *fox* and with the (pseudo) fuzzy search enabled, you'll find it even if you enter *ffx*.
|
||||
- Notification banners position option.
|
||||
- `Window Attention Handler` options - `Disable Notifications`, `Immediately Focus Window`.
|
||||
- New options for secondary monitor overview allow independent workspace thumbnails and workspace preview scales and also can move the ws preview as if there was the main panel, like on the primary monitor.
|
||||
- Custom workspace switcher popup position and visibility.
|
||||
|
||||
**Fixed:**
|
||||
- Some options related to the workspace preview don't work for secondary monitors if workspaces set to "primary monitor only".
|
||||
- Optimized blur effect transitions.
|
||||
- Smaller single windows not properly scaling with workspace preview in `Expose Windows on Hover` mode.
|
||||
- (upstream bug) Closing windows in the overview fills log with "access to destroyed" object errors.
|
||||
- (upstream bug) Glitching transition when minimizing full-screen window.
|
||||
- Workspace thumbnails size breathing during adding/removing workspaces
|
||||
|
||||
**Changed:**
|
||||
- Extension renamed to V-Shell, because the vertical workspace orientation is not the only option any more and the 'V' might stand for *Vertical*, but also for *Variable*.
|
||||
|
||||
### v23 (v19, v20, v21, v22) (2022-12-22)
|
||||
**Added:**
|
||||
- Overview modes `Expose Windows on Hover` and `Static Workspace`
|
||||
|
|
|
@ -1,33 +1,40 @@
|
|||
# V-Shell (former Vertical Workspaces)
|
||||
# V-Shell (Vertical Workspaces)
|
||||
|
||||
A GNOME Shell extension that lets you customize your desktop interface to suit your workflow and style. You can change the horizontal stacking of workspaces to vertical, but also change layout, content, appearance and behavior of the Shell. Forget Dash to Dock and similar dock extensions, with V-Shell you don't need it, just use Static Workspace option.
|
||||
|
||||
Supported GNOME versions: 42, 43 (dropped support for 40, 41 - not tested).
|
||||
|
||||
## Features
|
||||
- Vertically or horizontally stacked workspaces.
|
||||
- Position, orientation, scale and visibility of the overview content.
|
||||
- Support for secondary monitors, workspaces thumbnails can be placed on the opposite side relative to primary monitor. Removes unnecessary transitions.
|
||||
- Static background with blur adjustments.
|
||||
- 2 overview modes with static windows/workspace that expose windows on hover/click on workspace thumbnail. The *Static Workspace* option allows you to use dash like a dock with auto-hide but with all advantages of the activities overview.
|
||||
- Custom dash icons size and behavior when clicked.
|
||||
- Dash background transparency and corner radius adjustments.
|
||||
- App grid icon size, number of columns and rows.
|
||||
- Custom search view width, app results icons size and number of result lists rows.
|
||||
- Workspace thumbnails can show background wallpaper and labels (always or on mouse hover) with combination of workspace index, workspace name, name of the current application and current window title.
|
||||
- Title captions of window previews moves into the preview (originally beneath the preview) and can be set as always visible.
|
||||
- Static background in workspace switcher (outside overview). Keeps Conky below, DING desktop icons stay visible (if not covered by windows).
|
||||
- More efficient and visually appealing transition animations (compared to the original Shell) that can be customized or disabled.
|
||||
- Animation/transition speed adjustment.
|
||||
- Window search provider with *Space* hotkey allows quick window navigation.
|
||||
- Recent files search provider with *Ctrl + Space* hotkey.
|
||||
- Reorder workspaces in overview using *Shift + Scroll* or *Shift + Page Up/Down*
|
||||
- Adds *Force Quit*, *Close Windows on Current Workspace* and *Move Windows to Current Workspace* items to app icon menu. The latter action can be activated using *Shift + click* on app icon.
|
||||
A GNOME Shell extension that lets you customize your GNOME Shell UX to suit your workflow, whether you like horizontally or vertically stacked workspaces.
|
||||
|
||||
Currently supported GNOME versions: 42, 43, 44
|
||||
|
||||
[<img alt="" height="100" src="https://raw.githubusercontent.com/andyholmes/gnome-shell-extensions-badge/master/get-it-on-ego.svg?sanitize=true">](https://extensions.gnome.org/extension/5177/vertical-workspaces/)
|
||||
|
||||
![Various Overview Layouts](screenshots/screenshot.jpg)
|
||||
![Custom Overview Layout](screenshots/screenshot.jpg)
|
||||
![Custom Overview Layout](screenshots/screenshot0.jpg)
|
||||
|
||||
## Features
|
||||
- Vertically or horizontally stacked workspaces
|
||||
- Adjust position, orientation, scale and visibility of overview content
|
||||
- Customizable profiles offer predefined configurations for GNOME 3.xx, GNOME 40+ and another 2 custom layouts
|
||||
- 2 overview modes with static windows/workspace. The *Static Workspace* option allows you to use dash like a dock with auto-hide, but with all advantages of the activities overview
|
||||
- Support for secondary monitors, workspace thumbnails can be placed on the opposite side than on the primary monitor
|
||||
- Wallpaper background with adjustable blur effect and brightness in the overview
|
||||
- Custom Dash icon size and on-click/scroll behavior
|
||||
- Dash background transparency and corner radius adjustments
|
||||
- Adjustable app grid icon size, number of columns and rows, content, optional active and draggable icons in folder preview in optional 3x3 grid
|
||||
- Custom search view width, app results icons size and number of result lists rows, improved app search
|
||||
- Workspace thumbnails can show background wallpaper and labels (always or on mouse hover) with combination of workspace index, workspace name, name of the current application and current window title
|
||||
- Title captions of window previews moved into the preview (originally beneath the preview) and can be set as always visible. Adjustable window preview icon
|
||||
- Static background in workspace switcher (outside overview). Keeps Conky below, DING desktop icons stay visible (if not covered by windows)
|
||||
- Control over transition animations, including speed
|
||||
- Window search provider with *Space* hotkey allows quick window navigation
|
||||
- Recent files search provider with *Ctrl + Space* hotkey
|
||||
- Reorder workspaces in overview using *Shift + Scroll* or *Shift + Page Up/Down*
|
||||
- Adds *Force Quit*, *Close Windows on Current Workspace* and *Move Windows to Current Workspace* items to app icon menu. The latter action can be activated using *Shift + click* on app icon
|
||||
- Change notification banners and OSD popups position
|
||||
- Window attention handler options can activate the attention-demanding window immediately or silence its notification
|
||||
- Optional position of the hot corner that can follow the dash and expand to hot edge
|
||||
- Super key double-press options
|
||||
|
||||
## Changelog
|
||||
[CHANGELOG.md](CHANGELOG.md)
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -52,6 +59,8 @@ Navigate to the directory you want to download the source code and execute follo
|
|||
cd vertical-workspaces
|
||||
make install
|
||||
|
||||
If you get `Can't recursively copy directory` error, take a look at issue #51.
|
||||
|
||||
### Enabling the extension
|
||||
After installation you need to enable the extension and access its settings.
|
||||
|
||||
|
@ -62,11 +71,5 @@ After installation you need to enable the extension and access its settings.
|
|||
This extension uses customized utils and dash modules of the [Vertical Overview extension](https://github.com/RensAlthuis/vertical-overview).
|
||||
|
||||
## Buy me a coffee
|
||||
If you like my extensions and want to keep me motivated, you can also buy me a coffee:
|
||||
If you like my extensions and want to keep me motivated give me some useful feedback, but you can also help me with my coffee expenses:
|
||||
[buymeacoffee.com/georgdh](https://buymeacoffee.com/georgdh)
|
||||
|
||||
![Settings window](screenshots/screenshot1.png)
|
||||
![Settings window](screenshots/screenshot2.png)
|
||||
![Settings window](screenshots/screenshot3.png)
|
||||
![Settings window](screenshots/screenshot4.png)
|
||||
![Settings window](screenshots/screenshot5.png)
|
|
@ -1,944 +0,0 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* appDisplay.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Clutter, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
||||
|
||||
const DND = imports.ui.dnd;
|
||||
const Main = imports.ui.main;
|
||||
const AppDisplay = imports.ui.appDisplay;
|
||||
const IconGrid = imports.ui.iconGrid;
|
||||
const { AppMenu } = imports.ui.appMenu;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const BoxPointer = imports.ui.boxpointer;
|
||||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const IconGridOverride = Me.imports.iconGrid;
|
||||
|
||||
const _Util = Me.imports.util;
|
||||
let _overrides;
|
||||
|
||||
let _appGridLayoutSettings;
|
||||
let _appDisplayScrollConId;
|
||||
let _appSystemStateConId;
|
||||
let _appGridLayoutConId;
|
||||
let _updateAppGridTimeoutId;
|
||||
let _origAppDisplayAcceptDrop;
|
||||
let _origAppViewItemAcceptDrop;
|
||||
let _origAppViewItemHandleDragOver;
|
||||
|
||||
let opt;
|
||||
let shellVersion = _Util.shellVersion;
|
||||
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
_setAppDisplayOrientation(false);
|
||||
_updateAppGridProperties(reset);
|
||||
_updateAppGridDND(reset);
|
||||
_restoreOverviewGroup();
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
if (opt.ORIENTATION === Clutter.Orientation.VERTICAL) {
|
||||
_overrides.addOverride('AppDisplayVertical', AppDisplay.AppDisplay.prototype, AppDisplayVertical);
|
||||
_overrides.addOverride('BaseAppViewVertical', AppDisplay.BaseAppView.prototype, BaseAppViewVertical);
|
||||
}
|
||||
|
||||
_overrides.addOverride('AppSearchProvider', AppDisplay.AppSearchProvider.prototype, AppSearchProvider);
|
||||
|
||||
// Custom App Grid
|
||||
_overrides.addOverride('AppFolderDialog', AppDisplay.AppFolderDialog.prototype, AppFolderDialog);
|
||||
if (shellVersion >= 43) {
|
||||
// const defined class needs to be touched before real access
|
||||
AppDisplay.BaseAppViewGridLayout;
|
||||
_overrides.addOverride('BaseAppViewGridLayout', AppDisplay.BaseAppViewGridLayout.prototype, BaseAppViewGridLayout);
|
||||
_overrides.addOverride('IconGrid', IconGrid.IconGrid.prototype, IconGridOverride.IconGrid);
|
||||
}
|
||||
_overrides.addOverride('FolderView', AppDisplay.FolderView.prototype, FolderView);
|
||||
_overrides.addInjection('AppFolderDialog', AppDisplay.AppFolderDialog.prototype, AppFolderDialogInjections);
|
||||
_overrides.addOverride('AppIcon', AppDisplay.AppIcon.prototype, AppIcon);
|
||||
_overrides.addOverride('BaseAppView', AppDisplay.BaseAppView.prototype, BaseAppView);
|
||||
_overrides.addOverride('AppDisplay', AppDisplay.AppDisplay.prototype, AppDisplayCommon);
|
||||
|
||||
|
||||
_setAppDisplayOrientation(opt.ORIENTATION === Clutter.Orientation.VERTICAL);
|
||||
_updateAppGridProperties();
|
||||
_updateAppGridDND();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
function _setAppDisplayOrientation(vertical = false) {
|
||||
const CLUTTER_ORIENTATION = vertical ? Clutter.Orientation.VERTICAL : Clutter.Orientation.HORIZONTAL;
|
||||
const scroll = vertical ? 'vscroll' : 'hscroll';
|
||||
// app display to vertical has issues - page indicator not working
|
||||
// global appDisplay orientation switch is not built-in
|
||||
let appDisplay = Main.overview._overview._controls._appDisplay;
|
||||
// following line itself only changes in which axis will operate overshoot detection which switches appDisplay pages while dragging app icon to vertical
|
||||
appDisplay._orientation = CLUTTER_ORIENTATION;
|
||||
appDisplay._grid.layoutManager._orientation = CLUTTER_ORIENTATION;
|
||||
appDisplay._swipeTracker.orientation = CLUTTER_ORIENTATION;
|
||||
appDisplay._swipeTracker._reset();
|
||||
if (vertical) {
|
||||
appDisplay._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.EXTERNAL);
|
||||
|
||||
// move and change orientation of page indicators
|
||||
// needs corrections in appgrid page calculations, e.g. appDisplay.adaptToSize() fnc,
|
||||
// which complicates use of super call inside the function
|
||||
const pageIndicators = appDisplay._pageIndicators;
|
||||
pageIndicators.vertical = true;
|
||||
appDisplay._box.vertical = false;
|
||||
pageIndicators.x_expand = false;
|
||||
pageIndicators.y_align = Clutter.ActorAlign.CENTER;
|
||||
pageIndicators.x_align = Clutter.ActorAlign.START;
|
||||
|
||||
const scrollContainer = appDisplay._scrollView.get_parent();
|
||||
if (shellVersion < 43) {
|
||||
// remove touch friendly side navigation bars / arrows
|
||||
appDisplay._hintContainer && scrollContainer.remove_child(appDisplay._hintContainer);
|
||||
} else {
|
||||
// moving these bars needs more patching of the appDisplay's code
|
||||
// for now we just change bars style to be more like vertically oriented arrows indicating direction to prev/next page
|
||||
appDisplay._nextPageIndicator.add_style_class_name('nextPageIndicator');
|
||||
appDisplay._prevPageIndicator.add_style_class_name('prevPageIndicator');
|
||||
}
|
||||
|
||||
// setting their x_scale to 0 removes the arrows and avoid allocation issues compared to .hide() them
|
||||
appDisplay._nextPageArrow.scale_x = 0;
|
||||
appDisplay._prevPageArrow.scale_x = 0;
|
||||
} else {
|
||||
appDisplay._scrollView.set_policy(St.PolicyType.EXTERNAL, St.PolicyType.NEVER);
|
||||
if (_appDisplayScrollConId) {
|
||||
appDisplay._adjustment.disconnect(_appDisplayScrollConId);
|
||||
_appDisplayScrollConId = 0;
|
||||
}
|
||||
|
||||
// restore original page indicators
|
||||
const pageIndicators = appDisplay._pageIndicators;
|
||||
pageIndicators.vertical = false;
|
||||
appDisplay._box.vertical = true;
|
||||
pageIndicators.x_expand = true;
|
||||
pageIndicators.y_align = Clutter.ActorAlign.END;
|
||||
pageIndicators.x_align = Clutter.ActorAlign.CENTER;
|
||||
|
||||
// put back touch friendly navigation bars/buttons
|
||||
const scrollContainer = appDisplay._scrollView.get_parent();
|
||||
appDisplay._hintContainer && appDisplay._hintContainer.get_parent() == null && scrollContainer.add_child(appDisplay._hintContainer);
|
||||
appDisplay._nextPageArrow.scale_x = 1;
|
||||
appDisplay._prevPageArrow.scale_x = 1;
|
||||
|
||||
appDisplay._nextPageIndicator.remove_style_class_name('nextPageIndicator');
|
||||
appDisplay._prevPageIndicator.remove_style_class_name('prevPageIndicator');
|
||||
}
|
||||
|
||||
// value for page indicator is calculated from scroll adjustment, horizontal needs to be replaced by vertical
|
||||
appDisplay._adjustment = appDisplay._scrollView[scroll].adjustment;
|
||||
|
||||
// no need to connect already connected signal (wasn't removed the original one before)
|
||||
if (!vertical) {
|
||||
// reset used appdisplay properties
|
||||
Main.overview._overview._controls._appDisplay.scale_y = 1;
|
||||
Main.overview._overview._controls._appDisplay.scale_x = 1;
|
||||
Main.overview._overview._controls._appDisplay.opacity = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
// update appGrid dot pages indicators
|
||||
_appDisplayScrollConId = appDisplay._adjustment.connect('notify::value', adj => {
|
||||
const value = adj.value / adj.page_size;
|
||||
appDisplay._pageIndicators.setCurrentPosition(value);
|
||||
});
|
||||
}
|
||||
|
||||
// Set App Grid columns, rows, icon size, incomplete pages
|
||||
function _updateAppGridProperties(reset = false) {
|
||||
// columns, rows, icon size
|
||||
const appDisplay = Main.overview._overview._controls._appDisplay;
|
||||
appDisplay.visible = true;
|
||||
|
||||
// replace isFavorite function to always return false to allow dnd with favorite apps
|
||||
if (!reset && opt.APP_GRID_INCLUDE_DASH) {
|
||||
if (!appDisplay._appFavorites._backupIsFavorite) {
|
||||
appDisplay._appFavorites._backupIsFavorite = appDisplay._appFavorites.isFavorite;
|
||||
}
|
||||
appDisplay._appFavorites.isFavorite = () => false;
|
||||
} else {
|
||||
if (appDisplay._appFavorites._backupIsFavorite) {
|
||||
appDisplay._appFavorites.isFavorite = appDisplay._appFavorites._backupIsFavorite;
|
||||
appDisplay._appFavorites._backupIsFavorite = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
appDisplay._grid.layout_manager.fixedIconSize = -1;
|
||||
appDisplay._grid.layoutManager.allow_incomplete_pages = true;
|
||||
appDisplay._grid.setGridModes();
|
||||
if (_appGridLayoutSettings) {
|
||||
_appGridLayoutSettings.disconnect(_appGridLayoutConId);
|
||||
_appGridLayoutConId = 0;
|
||||
_appGridLayoutSettings = null;
|
||||
}
|
||||
appDisplay._redisplay();
|
||||
// secondary call is necessary to properly update app grid
|
||||
appDisplay._redisplay();
|
||||
} else {
|
||||
// update grid on layout reset
|
||||
if (!_appGridLayoutSettings) {
|
||||
_appGridLayoutSettings = ExtensionUtils.getSettings('org.gnome.shell');
|
||||
_appGridLayoutConId = _appGridLayoutSettings.connect('changed::app-picker-layout', _resetAppGrid);
|
||||
}
|
||||
|
||||
// remove icons from App Grid
|
||||
_resetAppGrid();
|
||||
|
||||
const updateGrid = function(rows, columns) {
|
||||
if (rows === -1 || columns === -1) {
|
||||
appDisplay._grid.setGridModes();
|
||||
} else {
|
||||
appDisplay._grid.setGridModes(
|
||||
[{ rows, columns }]
|
||||
);
|
||||
}
|
||||
appDisplay._grid._setGridMode(0);
|
||||
}
|
||||
|
||||
appDisplay._grid._currentMode = -1;
|
||||
if (opt.APP_GRID_ALLOW_CUSTOM) {
|
||||
updateGrid(opt.APP_GRID_ROWS, opt.APP_GRID_COLUMNS);
|
||||
} else {
|
||||
appDisplay._grid.setGridModes();
|
||||
updateGrid(-1, -1);
|
||||
}
|
||||
appDisplay._grid.layoutManager.fixedIconSize = opt.APP_GRID_ICON_SIZE;
|
||||
appDisplay._grid.layoutManager.allow_incomplete_pages = opt.APP_GRID_ALLOW_INCOMPLETE_PAGES;
|
||||
|
||||
// force rebuild icons. size shouldn't be the same as the current one, otherwise can be arbitrary
|
||||
appDisplay._grid.layoutManager.adaptToSize(200, 200);
|
||||
appDisplay._redisplay();
|
||||
|
||||
_realizeAppDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
//------ App Grid - DND ----------------------------------------------------------
|
||||
|
||||
function _updateAppGridDND(reset) {
|
||||
if (opt.APP_GRID_ORDER && !reset) {
|
||||
if (!_appSystemStateConId)
|
||||
_appSystemStateConId = Shell.AppSystem.get_default().connect('app-state-changed', () => Main.overview._overview._controls._appDisplay._redisplay());
|
||||
|
||||
// deny dnd from dash to app grid
|
||||
if (!_origAppDisplayAcceptDrop)
|
||||
_origAppDisplayAcceptDrop = AppDisplay.AppDisplay.prototype.acceptDrop;
|
||||
AppDisplay.AppDisplay.prototype.acceptDrop = function() { return false; };
|
||||
|
||||
// deny creating folders by dnd on other icon
|
||||
if (!_origAppViewItemHandleDragOver)
|
||||
_origAppViewItemHandleDragOver = AppDisplay.AppViewItem.prototype.handleDragOver;
|
||||
AppDisplay.AppViewItem.prototype.handleDragOver = () => DND.DragMotionResult.NO_DROP;
|
||||
|
||||
if (!_origAppViewItemAcceptDrop)
|
||||
_origAppViewItemAcceptDrop = AppDisplay.AppViewItem.prototype.acceptDrop;
|
||||
AppDisplay.AppViewItem.prototype.acceptDrop = () => false;
|
||||
} else {
|
||||
if (_appSystemStateConId) {
|
||||
Shell.AppSystem.get_default().disconnect(_appSystemStateConId);
|
||||
_appSystemStateConId = 0;
|
||||
}
|
||||
|
||||
if (_origAppDisplayAcceptDrop)
|
||||
AppDisplay.AppDisplay.prototype.acceptDrop = _origAppDisplayAcceptDrop;
|
||||
|
||||
if (_origAppViewItemHandleDragOver)
|
||||
AppDisplay.AppViewItem.prototype.handleDragOver = _origAppViewItemHandleDragOver;
|
||||
|
||||
if (_origAppViewItemAcceptDrop)
|
||||
AppDisplay.AppViewItem.prototype.acceptDrop = _origAppViewItemAcceptDrop;
|
||||
}
|
||||
}
|
||||
|
||||
function _realizeAppDisplay() {
|
||||
// force app grid to build all icons before the first visible animation to remove possible stuttering
|
||||
// let the main loop realize previous changes before continuing
|
||||
|
||||
// don't do this during shell startup
|
||||
if (Main.layoutManager._startingUp)
|
||||
return;
|
||||
|
||||
if (_updateAppGridTimeoutId) {
|
||||
GLib.source_remove(_updateAppGridTimeoutId);
|
||||
}
|
||||
|
||||
_updateAppGridTimeoutId = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
1000,
|
||||
() => {
|
||||
Main.layoutManager.overviewGroup.opacity = 1;
|
||||
Main.layoutManager.overviewGroup.scale_x = 0.1;
|
||||
Main.layoutManager.overviewGroup.show();
|
||||
Main.overview.dash.showAppsButton.checked = true;
|
||||
|
||||
GLib.source_remove(_updateAppGridTimeoutId);
|
||||
|
||||
_updateAppGridTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
500,
|
||||
() => {
|
||||
_restoreOverviewGroup();
|
||||
_updateAppGridTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function _restoreOverviewGroup() {
|
||||
Main.overview.dash.showAppsButton.checked = false;
|
||||
Main.layoutManager.overviewGroup.opacity = 255;
|
||||
Main.layoutManager.overviewGroup.scale_x = 1;
|
||||
Main.layoutManager.overviewGroup.hide();
|
||||
}
|
||||
|
||||
//------ appDisplay - Vertical --------------------------------------------------------------------------------
|
||||
|
||||
var AppDisplayVertical = {
|
||||
// correction of the appGrid size when page indicators were moved from the bottom to the right
|
||||
adaptToSize: function(width, height) {
|
||||
const [, indicatorWidth] = this._pageIndicators.get_preferred_width(-1);
|
||||
width -= indicatorWidth;
|
||||
|
||||
this._grid.findBestModeForSize(width, height);
|
||||
|
||||
const adaptToSize = AppDisplay.BaseAppView.prototype.adaptToSize.bind(this);
|
||||
adaptToSize(width, height);
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
//------ AppDisplay.AppSearchProvider ----------------------------------------------------------------------------------
|
||||
|
||||
// App search result size
|
||||
var AppSearchProvider = {
|
||||
createResultObject: function(resultMeta) {
|
||||
if (resultMeta.id.endsWith('.desktop')) {
|
||||
const icon = new AppDisplay.AppIcon(this._appSys.lookup_app(resultMeta['id']), {
|
||||
expandTitleOnHover: false,
|
||||
});
|
||||
icon.icon.setIconSize(opt.SEARCH_ICON_SIZE);
|
||||
return icon;
|
||||
} else {
|
||||
const icon = new AppDisplay.SystemActionIcon(this, resultMeta);
|
||||
icon.icon._setSizeManually = true;
|
||||
icon.icon.setIconSize(opt.SEARCH_ICON_SIZE);
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var BaseAppViewVertical = {
|
||||
// this fixes dnd from appDisplay to the workspace thumbnail on the left if appDisplay is on page 1 because of appgrid left overshoot
|
||||
_pageForCoords: function(x, y) {
|
||||
return AppDisplay.SidePages.NONE;
|
||||
},
|
||||
}
|
||||
|
||||
// ------ AppDisplay - Custom App Grid ------------------------------------------------------------------------
|
||||
|
||||
var AppDisplayCommon = {
|
||||
_ensureDefaultFolders: function() {
|
||||
// disable creation of default folders if user deleted them
|
||||
},
|
||||
|
||||
// apps load adapted for custom sorting and including dash items
|
||||
_loadApps: function() {
|
||||
let appIcons = [];
|
||||
this._appInfoList = Shell.AppSystem.get_default().get_installed().filter(appInfo => {
|
||||
try {
|
||||
appInfo.get_id(); // catch invalid file encodings
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return (opt.APP_GRID_INCLUDE_DASH || !this._appFavorites.isFavorite(appInfo.get_id())) &&
|
||||
this._parentalControlsManager.shouldShowApp(appInfo);
|
||||
});
|
||||
|
||||
let apps = this._appInfoList.map(app => app.get_id());
|
||||
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
|
||||
const appsInsideFolders = new Set();
|
||||
this._folderIcons = [];
|
||||
if (!opt.APP_GRID_ORDER) {
|
||||
|
||||
let folders = this._folderSettings.get_strv('folder-children');
|
||||
folders.forEach(id => {
|
||||
let path = `${this._folderSettings.path}folders/${id}/`;
|
||||
let icon = this._items.get(id);
|
||||
if (!icon) {
|
||||
icon = new AppDisplay.FolderIcon(id, path, this);
|
||||
icon.connect('apps-changed', () => {
|
||||
this._redisplay();
|
||||
this._savePages();
|
||||
});
|
||||
icon.connect('notify::pressed', () => {
|
||||
if (icon.pressed)
|
||||
this.updateDragFocus(icon);
|
||||
});
|
||||
}
|
||||
|
||||
// Don't try to display empty folders
|
||||
if (!icon.visible) {
|
||||
icon.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
appIcons.push(icon);
|
||||
this._folderIcons.push(icon);
|
||||
|
||||
icon.getAppIds().forEach(appId => appsInsideFolders.add(appId));
|
||||
});
|
||||
}
|
||||
|
||||
// Allow dragging of the icon only if the Dash would accept a drop to
|
||||
// change favorite-apps. There are no other possible drop targets from
|
||||
// the app picker, so there's no other need for a drag to start,
|
||||
// at least on single-monitor setups.
|
||||
// This also disables drag-to-launch on multi-monitor setups,
|
||||
// but we hope that is not used much.
|
||||
const isDraggable =
|
||||
global.settings.is_writable('favorite-apps') ||
|
||||
global.settings.is_writable('app-picker-layout');
|
||||
|
||||
apps.forEach(appId => {
|
||||
if (!opt.APP_GRID_ORDER && appsInsideFolders.has(appId))
|
||||
return;
|
||||
|
||||
let icon = this._items.get(appId);
|
||||
if (!icon) {
|
||||
let app = appSys.lookup_app(appId);
|
||||
|
||||
icon = new AppDisplay.AppIcon(app, { isDraggable });
|
||||
icon.connect('notify::pressed', () => {
|
||||
if (icon.pressed)
|
||||
this.updateDragFocus(icon);
|
||||
});
|
||||
}
|
||||
|
||||
appIcons.push(icon);
|
||||
});
|
||||
|
||||
// At last, if there's a placeholder available, add it
|
||||
if (this._placeholder)
|
||||
appIcons.push(this._placeholder);
|
||||
|
||||
//const runningIDs = Shell.AppSystem.get_default().get_running().map(app => app.get_id());
|
||||
|
||||
// remove running apps
|
||||
/*if (!APP_GRID_INCLUDE_DASH) { // !icon.app means folder
|
||||
appIcons = appIcons.filter((icon) => this._folderIcons.includes(icon) || !(runningIDs.includes(icon.app.id) || this._appFavorites.isFavorite(icon.id)));
|
||||
}*/
|
||||
|
||||
return appIcons;
|
||||
},
|
||||
}
|
||||
|
||||
var BaseAppView = {
|
||||
// adds sorting options and option to add favorites and running apps
|
||||
_redisplay: function() {
|
||||
let oldApps = this._orderedItems.slice();
|
||||
let oldAppIds = oldApps.map(icon => icon.id);
|
||||
|
||||
let newApps = this._loadApps().sort(this._compareItems.bind(this));
|
||||
let newAppIds = newApps.map(icon => icon.id);
|
||||
|
||||
let addedApps = newApps.filter(icon => !oldAppIds.includes(icon.id));
|
||||
let removedApps = oldApps.filter(icon => !newAppIds.includes(icon.id));
|
||||
|
||||
// Remove old app icons
|
||||
removedApps.forEach(icon => {
|
||||
this._removeItem(icon);
|
||||
icon.destroy();
|
||||
});
|
||||
|
||||
// Add new app icons, or move existing ones
|
||||
newApps.forEach(icon => {
|
||||
const [page, position] = this._getItemPosition(icon);
|
||||
if (addedApps.includes(icon))
|
||||
this._addItem(icon, page, position);
|
||||
else if (page !== -1 && position !== -1) {
|
||||
this._moveItem(icon, page, position);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Reorder App Grid by usage
|
||||
// sort all alphabetically
|
||||
if(opt.APP_GRID_ORDER > 0) {
|
||||
const { itemsPerPage } = this._grid;
|
||||
let appIcons = this._orderedItems;
|
||||
appIcons.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||
// then sort used apps by usage
|
||||
if (opt.APP_GRID_ORDER === 2) {
|
||||
appIcons.sort((a, b) => Shell.AppUsage.get_default().compare(a.app.id, b.app.id));
|
||||
}
|
||||
// sort favorites first
|
||||
if (opt.APP_GRID_INCLUDE_DASH === 2) {
|
||||
const fav = Object.keys(this._appFavorites._favorites);
|
||||
appIcons.sort((a, b) => {
|
||||
let aFav = fav.indexOf(a.id);
|
||||
if (aFav < 0) aFav = 999;
|
||||
let bFav = fav.indexOf(b.id);
|
||||
if (bFav < 0) bFav = 999;
|
||||
return bFav < aFav;
|
||||
});
|
||||
}
|
||||
|
||||
// sort running first
|
||||
if (opt.APP_GRID_INCLUDE_DASH === 2) {
|
||||
appIcons.sort((a, b) => a.app.get_state() !== Shell.AppState.RUNNING && b.app.get_state() === Shell.AppState.RUNNING);
|
||||
}
|
||||
|
||||
appIcons.forEach((icon, i) => {
|
||||
const page = Math.floor(i / itemsPerPage);
|
||||
const position = i % itemsPerPage;
|
||||
this._moveItem(icon, page, position);
|
||||
});
|
||||
|
||||
this._orderedItems = appIcons;
|
||||
}
|
||||
|
||||
this.emit('view-loaded');
|
||||
},
|
||||
|
||||
_canAccept: function(source) {
|
||||
return (opt.APP_GRID_ORDER ? false : source instanceof AppDisplay.AppViewItem);
|
||||
},
|
||||
|
||||
// GS <= 42 only, Adapt app grid so it can use all available space
|
||||
adaptToSize(width, height) {
|
||||
let box = new Clutter.ActorBox({
|
||||
x2: width,
|
||||
y2: height,
|
||||
});
|
||||
box = this.get_theme_node().get_content_box(box);
|
||||
box = this._scrollView.get_theme_node().get_content_box(box);
|
||||
box = this._grid.get_theme_node().get_content_box(box);
|
||||
|
||||
const availWidth = box.get_width();
|
||||
const availHeight = box.get_height();
|
||||
|
||||
const gridRatio = this._grid.layout_manager.columnsPerPage /
|
||||
this._grid.layout_manager.rowsPerPage;
|
||||
const spaceRatio = availWidth / availHeight;
|
||||
let pageWidth, pageHeight;
|
||||
|
||||
if (spaceRatio > gridRatio * 1.1) {
|
||||
// Enough room for some preview
|
||||
pageHeight = availHeight;
|
||||
pageWidth = Math.ceil(availHeight * gridRatio);
|
||||
|
||||
if (spaceRatio > gridRatio * 1.5) {
|
||||
// Ultra-wide layout, give some extra space for
|
||||
// the page area, but up to an extent.
|
||||
const extraPageSpace = Math.min(
|
||||
Math.floor((availWidth - pageWidth) / 2), 200); // AppDisplay.MAX_PAGE_PADDING == 200
|
||||
pageWidth += extraPageSpace;
|
||||
this._grid.layout_manager.pagePadding.left =
|
||||
Math.floor(extraPageSpace / 2);
|
||||
this._grid.layout_manager.pagePadding.right =
|
||||
Math.ceil(extraPageSpace / 2);
|
||||
}
|
||||
} else {
|
||||
// Not enough room, needs to shrink horizontally
|
||||
pageWidth = Math.ceil(availWidth * 0.95); // width limiter, original is 0.8
|
||||
pageHeight = availHeight;
|
||||
this._grid.layout_manager.pagePadding.left =
|
||||
Math.floor(availWidth * 0.02);
|
||||
this._grid.layout_manager.pagePadding.right =
|
||||
Math.ceil(availWidth * 0.02);
|
||||
}
|
||||
|
||||
this._grid.adaptToSize(pageWidth, pageHeight);
|
||||
|
||||
const leftPadding = Math.floor(
|
||||
(availWidth - this._grid.layout_manager.pageWidth) / 2);
|
||||
const rightPadding = Math.ceil(
|
||||
(availWidth - this._grid.layout_manager.pageWidth) / 2);
|
||||
const topPadding = Math.floor(
|
||||
(availHeight - this._grid.layout_manager.pageHeight) / 2);
|
||||
const bottomPadding = Math.ceil(
|
||||
(availHeight - this._grid.layout_manager.pageHeight) / 2);
|
||||
|
||||
this._scrollView.content_padding = new Clutter.Margin({
|
||||
left: leftPadding,
|
||||
right: rightPadding,
|
||||
top: topPadding,
|
||||
bottom: bottomPadding,
|
||||
});
|
||||
|
||||
this._availWidth = availWidth;
|
||||
this._availHeight = availHeight;
|
||||
|
||||
this._pageIndicatorOffset = leftPadding;
|
||||
this._pageArrowOffset = Math.max(
|
||||
leftPadding - 80, 0); // 80 is AppDisplay.PAGE_PREVIEW_MAX_ARROW_OFFSET
|
||||
}
|
||||
}
|
||||
|
||||
var BaseAppViewGridLayout = {
|
||||
_getIndicatorsWidth(box) {
|
||||
const [width, height] = box.get_size();
|
||||
const arrows = [
|
||||
this._nextPageArrow,
|
||||
this._previousPageArrow,
|
||||
];
|
||||
|
||||
const minArrowsWidth = arrows.reduce(
|
||||
(previousWidth, accessory) => {
|
||||
const [min] = accessory.get_preferred_width(height);
|
||||
return Math.max(previousWidth, min);
|
||||
}, 0);
|
||||
|
||||
const idealIndicatorWidth = (width * 0.1/*PAGE_PREVIEW_RATIO*/) / 2;
|
||||
|
||||
return Math.max(idealIndicatorWidth, minArrowsWidth);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ AppDisplay.AppFolderDialog - injection --------------------------------------------------------------
|
||||
|
||||
var AppFolderDialogInjections = {
|
||||
_init: function() {
|
||||
const iconSize = opt.APP_GRID_FOLDER_ICON_SIZE < 0 ? 96 : opt.APP_GRID_FOLDER_ICON_SIZE;
|
||||
let width = opt.APP_GRID_FOLDER_COLUMNS * (iconSize + 64);
|
||||
width = Math.max(640, Math.round(width + width / 10));
|
||||
let height = opt.APP_GRID_FOLDER_ROWS * (iconSize + 64) + 150;
|
||||
opt.APP_GRID_ALLOW_CUSTOM && this.child.set_style(`
|
||||
width: ${width}px;
|
||||
height: ${height}px;
|
||||
padding: 30px;
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------ AppDisplay.FolderGrid -----------------------------------------------------------------------
|
||||
|
||||
var FolderView = {
|
||||
_createGrid: function() {
|
||||
let grid;
|
||||
if (shellVersion < 43) {
|
||||
grid = new FolderGrid();
|
||||
} else {
|
||||
grid = new FolderGrid43();
|
||||
}
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
|
||||
// folder columns and rows
|
||||
|
||||
var FolderGrid = GObject.registerClass(
|
||||
class FolderGrid extends IconGrid.IconGrid {
|
||||
_init() {
|
||||
super._init({
|
||||
allow_incomplete_pages: false,
|
||||
columns_per_page: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_COLUMNS : 3,
|
||||
rows_per_page: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_ROWS : 3,
|
||||
page_halign: Clutter.ActorAlign.CENTER,
|
||||
page_valign: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
|
||||
opt.APP_GRID_ALLOW_CUSTOM && this.set_style('column-spacing: 10px; row-spacing: 10px;');
|
||||
this.layout_manager.fixedIconSize = opt.APP_GRID_FOLDER_ICON_SIZE;
|
||||
}
|
||||
|
||||
adaptToSize(width, height) {
|
||||
this.layout_manager.adaptToSize(width, height);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// only the first access to the const AppDisplay.AppGrid throws an error, so touch it before it's really needed
|
||||
let FolderGrid43;
|
||||
AppDisplay.AppGrid;
|
||||
if (AppDisplay.AppGrid) {
|
||||
FolderGrid43 = GObject.registerClass(
|
||||
class FolderGrid43 extends AppDisplay.AppGrid {
|
||||
_init() {
|
||||
super._init({
|
||||
allow_incomplete_pages: false,
|
||||
columns_per_page: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_COLUMNS : 3,
|
||||
rows_per_page: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_ROWS : 3,
|
||||
page_halign: Clutter.ActorAlign.CENTER,
|
||||
page_valign: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
|
||||
opt.APP_GRID_ALLOW_CUSTOM && this.set_style('column-spacing: 10px; row-spacing: 10px;');
|
||||
this.layout_manager.fixedIconSize = opt.APP_GRID_FOLDER_ICON_SIZE;
|
||||
|
||||
this.setGridModes([
|
||||
{
|
||||
rows: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_ROWS : 3,
|
||||
columns: opt.APP_GRID_ALLOW_CUSTOM ? opt.APP_GRID_FOLDER_COLUMNS : 3,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
adaptToSize(width, height) {
|
||||
this.layout_manager.adaptToSize(width, height);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var FOLDER_DIALOG_ANIMATION_TIME = 200; // AppDisplay.FOLDER_DIALOG_ANIMATION_TIME
|
||||
var AppFolderDialog = {
|
||||
_zoomAndFadeIn: function() {
|
||||
let [sourceX, sourceY] =
|
||||
this._source.get_transformed_position();
|
||||
let [dialogX, dialogY] =
|
||||
this.child.get_transformed_position();
|
||||
|
||||
this.child.set({
|
||||
translation_x: sourceX - dialogX,
|
||||
translation_y: sourceY - dialogY,
|
||||
scale_x: this._source.width / this.child.width,
|
||||
scale_y: this._source.height / this.child.height,
|
||||
opacity: 0,
|
||||
});
|
||||
|
||||
this.ease({
|
||||
background_color: Clutter.Color.from_pixel(0x00000033), // DIALOG_SHADE_NORMAL
|
||||
duration: FOLDER_DIALOG_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
|
||||
|
||||
this.child.ease({
|
||||
translation_x: 0,
|
||||
translation_y: 0,
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
opacity: 255,
|
||||
duration: FOLDER_DIALOG_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
|
||||
this._needsZoomAndFade = false;
|
||||
|
||||
if (this._sourceMappedId === 0) {
|
||||
this._sourceMappedId = this._source.connect(
|
||||
'notify::mapped', this._zoomAndFadeOut.bind(this));
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function _resetAppGrid(settings = null, key = null) {
|
||||
if (settings) {
|
||||
const currentValue = JSON.stringify(settings.get_value('app-picker-layout').deep_unpack());
|
||||
const emptyValue = JSON.stringify([]);
|
||||
if (key === 'app-picker-layout' && currentValue != emptyValue)
|
||||
return;
|
||||
}
|
||||
const appDisplay = Main.overview._overview._controls._appDisplay;
|
||||
const items = appDisplay._orderedItems;
|
||||
for (let i = items.length - 1; i > -1; i--) {
|
||||
Main.overview._overview._controls._appDisplay._removeItem(items[i]);
|
||||
}
|
||||
// redisplay only from callback
|
||||
if (settings)
|
||||
appDisplay._redisplay();
|
||||
}
|
||||
|
||||
// ------------------ AppDisplay.AppIcon - override ---------------------------------------------------------------
|
||||
|
||||
function _getWindowApp(metaWin) {
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
return tracker.get_window_app(metaWin);
|
||||
}
|
||||
|
||||
function _getAppLastUsedWindow(app) {
|
||||
let recentWin;
|
||||
global.display.get_tab_list(Meta.TabList.NORMAL_ALL, null).forEach(metaWin => {
|
||||
const winApp = _getWindowApp(metaWin);
|
||||
if (!recentWin && winApp == app) {
|
||||
recentWin = metaWin;
|
||||
}
|
||||
});
|
||||
return recentWin;
|
||||
}
|
||||
|
||||
function _getAppRecentWorkspace(app) {
|
||||
const recentWin = _getAppLastUsedWindow(app)
|
||||
if (recentWin)
|
||||
return recentWin.get_workspace();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var AppIcon = {
|
||||
activate: function(button) {
|
||||
const event = Clutter.get_current_event();
|
||||
const modifiers = event ? event.get_state() : 0;
|
||||
const isMiddleButton = button && button == Clutter.BUTTON_MIDDLE;
|
||||
const isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0;
|
||||
const isShiftPressed = (modifiers & Clutter.ModifierType.SHIFT_MASK) != 0;
|
||||
const openNewWindow = this.app.can_open_new_window() &&
|
||||
this.app.state == Shell.AppState.RUNNING &&
|
||||
(isCtrlPressed || isMiddleButton);
|
||||
|
||||
const currentWS = global.workspace_manager.get_active_workspace();
|
||||
const appRecentWorkspace = _getAppRecentWorkspace(this.app);
|
||||
|
||||
let targetWindowOnCurrentWs = false;
|
||||
if (opt.DASH_FOLLOW_RECENT_WIN) {
|
||||
targetWindowOnCurrentWs = appRecentWorkspace === currentWS;
|
||||
} else {
|
||||
this.app.get_windows().forEach(
|
||||
w => targetWindowOnCurrentWs = targetWindowOnCurrentWs || (w.get_workspace() === currentWS)
|
||||
);
|
||||
}
|
||||
|
||||
if ((this.app.state == Shell.AppState.STOPPED || openNewWindow) && !isShiftPressed)
|
||||
this.animateLaunch();
|
||||
|
||||
if (openNewWindow) {
|
||||
this.app.open_new_window(-1);
|
||||
// if the app has more than one window (option: and has no window on the current workspace),
|
||||
// don't activate the app, only move the overview to the workspace with the app's recent window
|
||||
} else if (opt.DASH_SHOW_WINS_BEFORE && !isShiftPressed && this.app.get_n_windows() > 1 && !targetWindowOnCurrentWs) {
|
||||
this._scroll = true;
|
||||
this._scrollTime = Date.now();
|
||||
//const appWS = this.app.get_windows()[0].get_workspace();
|
||||
Main.wm.actionMoveWorkspace(appRecentWorkspace);
|
||||
Main.overview.dash.showAppsButton.checked = false;
|
||||
return;
|
||||
} else if (opt.DASH_SHIFT_CLICK_MV && isShiftPressed && this.app.get_windows().length) {
|
||||
this._moveAppToCurrentWorkspace();
|
||||
return;
|
||||
} else if (isShiftPressed) {
|
||||
return;
|
||||
} else {
|
||||
this.app.activate();
|
||||
}
|
||||
|
||||
Main.overview.hide();
|
||||
},
|
||||
|
||||
_moveAppToCurrentWorkspace: function() {
|
||||
this.app.get_windows().forEach(w => w.change_workspace(global.workspace_manager.get_active_workspace()));
|
||||
},
|
||||
|
||||
popupMenu: function(side = St.Side.LEFT) {
|
||||
if (shellVersion >= 42)
|
||||
this.setForcedHighlight(true);
|
||||
this._removeMenuTimeout();
|
||||
this.fake_release();
|
||||
|
||||
if (!this._getWindowsOnCurrentWs) {
|
||||
this._getWindowsOnCurrentWs = function() {
|
||||
const winList = [];
|
||||
this.app.get_windows().forEach(w => {
|
||||
if(w.get_workspace() === global.workspace_manager.get_active_workspace()) winList.push(w)
|
||||
});
|
||||
return winList;
|
||||
};
|
||||
|
||||
this._windowsOnOtherWs = function() {
|
||||
return (this.app.get_windows().length - this._getWindowsOnCurrentWs().length) > 0;
|
||||
};
|
||||
}
|
||||
|
||||
if (!this._menu) {
|
||||
this._menu = new AppMenu(this, side, {
|
||||
favoritesSection: true,
|
||||
showSingleWindows: true,
|
||||
});
|
||||
|
||||
this._menu.setApp(this.app);
|
||||
this._openSigId = this._menu.connect('open-state-changed', (menu, isPoppedUp) => {
|
||||
if (!isPoppedUp)
|
||||
this._onMenuPoppedDown();
|
||||
});
|
||||
//Main.overview.connectObject('hiding',
|
||||
this._hidingSigId = Main.overview.connect('hiding',
|
||||
() => this._menu.close(), this);
|
||||
|
||||
Main.uiGroup.add_actor(this._menu.actor);
|
||||
this._menuManager.addMenu(this._menu);
|
||||
}
|
||||
|
||||
// once the menu is created, it stays unchanged and we need to modify our items based on current situation
|
||||
if (this._addedMenuItems && this._addedMenuItems.length) {
|
||||
this._addedMenuItems.forEach(i => i.destroy());
|
||||
}
|
||||
|
||||
const popupItems =[];
|
||||
|
||||
const separator = new PopupMenu.PopupSeparatorMenuItem();
|
||||
this._menu.addMenuItem(separator);
|
||||
|
||||
if (this.app.get_n_windows()) {
|
||||
if (/*opt.APP_MENU_FORCE_QUIT*/true) {
|
||||
popupItems.push([_('Force Quit'), () => {
|
||||
this.app.get_windows()[0].kill();
|
||||
}]);
|
||||
}
|
||||
|
||||
if (/*opt.APP_MENU_CLOSE_WS*/true) {
|
||||
const nWin = this._getWindowsOnCurrentWs().length;
|
||||
if (nWin) {
|
||||
popupItems.push([_(`Close ${nWin} Windows on Current Workspace`), () => {
|
||||
const windows = this._getWindowsOnCurrentWs();
|
||||
let time = global.get_current_time();
|
||||
for (let win of windows) {
|
||||
// increase time by 1 ms for each window to avoid errors from GS
|
||||
win.delete(time++);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
if (/*opt.APP_MENU_MV_TO_WS && */this._windowsOnOtherWs()) {
|
||||
popupItems.push([_('Move App to Current Workspace'), this._moveAppToCurrentWorkspace]);
|
||||
}
|
||||
}
|
||||
|
||||
this._addedMenuItems = [];
|
||||
this._addedMenuItems.push(separator);
|
||||
popupItems.forEach(i => {
|
||||
let item = new PopupMenu.PopupMenuItem(i[0]);
|
||||
this._menu.addMenuItem(item);
|
||||
item.connect('activate', i[1].bind(this));
|
||||
this._addedMenuItems.push(item);
|
||||
});
|
||||
|
||||
this.emit('menu-state-changed', true);
|
||||
|
||||
this._menu.open(BoxPointer.PopupAnimation.FULL);
|
||||
this._menuManager.ignoreRelease();
|
||||
this.emit('sync-tooltip');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* extension.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GLib, GObject, Meta, Shell, St } = imports.gi;
|
||||
const { GLib, Shell, St } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
|
||||
|
@ -19,33 +19,36 @@ const Background = imports.ui.background;
|
|||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Settings = Me.imports.settings;
|
||||
const _Util = Me.imports.util;
|
||||
const Settings = Me.imports.lib.settings;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
const WindowSearchProvider = Me.imports.windowSearchProvider;
|
||||
const RecentFilesSearchProvider = Me.imports.recentFilesSearchProvider;
|
||||
const LayoutOverride = Me.imports.layout;
|
||||
const AppDisplayOverride = Me.imports.appDisplay;
|
||||
const WorkspaceThumbnailOverride = Me.imports.workspaceThumbnail;
|
||||
const WorkspaceOverride = Me.imports.workspace;
|
||||
const WorkspacesViewOverride = Me.imports.workspacesView;
|
||||
const WindowPreviewOverride = Me.imports.windowPreview;
|
||||
const IconGridOverride = Me.imports.iconGrid;
|
||||
const WorkspaceAnimationOverride = Me.imports.workspaceAnimation;
|
||||
const WindowManagerOverride = Me.imports.windowManager;
|
||||
const OverviewOverride = Me.imports.overview;
|
||||
const OverviewControlsOverride = Me.imports.overviewControls;
|
||||
const SwipeTrackerOverride = Me.imports.swipeTracker;
|
||||
const WorkspaceSwitcherPopupOverride = Me.imports.workspaceSwitcherPopup;
|
||||
const SearchOverride = Me.imports.search;
|
||||
const PanelOverride = Me.imports.panel;
|
||||
const DashOverride = Me.imports.dash;
|
||||
const WindowSearchProvider = Me.imports.lib.windowSearchProvider;
|
||||
const RecentFilesSearchProvider = Me.imports.lib.recentFilesSearchProvider;
|
||||
const LayoutOverride = Me.imports.lib.layout;
|
||||
const AppDisplayOverride = Me.imports.lib.appDisplay;
|
||||
const WorkspaceThumbnailOverride = Me.imports.lib.workspaceThumbnail;
|
||||
const WorkspaceOverride = Me.imports.lib.workspace;
|
||||
const WorkspacesViewOverride = Me.imports.lib.workspacesView;
|
||||
const WindowPreviewOverride = Me.imports.lib.windowPreview;
|
||||
const IconGridOverride = Me.imports.lib.iconGrid;
|
||||
const WorkspaceAnimationOverride = Me.imports.lib.workspaceAnimation;
|
||||
const WindowManagerOverride = Me.imports.lib.windowManager;
|
||||
const OverviewOverride = Me.imports.lib.overview;
|
||||
const OverviewControlsOverride = Me.imports.lib.overviewControls;
|
||||
const SwipeTrackerOverride = Me.imports.lib.swipeTracker;
|
||||
const WorkspaceSwitcherPopupOverride = Me.imports.lib.workspaceSwitcherPopup;
|
||||
const SearchOverride = Me.imports.lib.search;
|
||||
const PanelOverride = Me.imports.lib.panel;
|
||||
const DashOverride = Me.imports.lib.dash;
|
||||
const WindowAttentionHandlerOverride = Me.imports.lib.windowAttentionHandler;
|
||||
const AppFavoritesOverride = Me.imports.lib.appFavorites;
|
||||
const MessageTrayOverride = Me.imports.lib.messageTray;
|
||||
const OsdWindowOverride = Me.imports.lib.osdWindow;
|
||||
const OverlayKey = Me.imports.lib.overlayKey;
|
||||
|
||||
|
||||
let opt = null;
|
||||
let opt;
|
||||
|
||||
let _bgManagers;
|
||||
let _shellSettings;
|
||||
|
||||
let _enabled;
|
||||
let _resetExtensionIfEnabled;
|
||||
|
@ -53,18 +56,13 @@ let _prevDash;
|
|||
|
||||
let _showingOverviewConId;
|
||||
let _monitorsChangedSigId;
|
||||
let _loadingProfileTimeoutId;
|
||||
let _watchDockSigId;
|
||||
|
||||
let _resetTimeoutId;
|
||||
|
||||
// drop control for app grid sorting modes
|
||||
let _appSystemStateSigId;
|
||||
let _origAppViewItemAcceptDrop;
|
||||
let _origAppViewItemHandleDragOver;
|
||||
let _origAppDisplayAcceptDrop;
|
||||
|
||||
let _enableTimeoutId = 0;
|
||||
|
||||
let _sessionLockActive = false;
|
||||
|
||||
|
||||
function init() {
|
||||
|
@ -77,9 +75,11 @@ function enable() {
|
|||
|
||||
_enableTimeoutId = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
200,
|
||||
400,
|
||||
() => {
|
||||
activate();
|
||||
activateVShell();
|
||||
// unlock after modules update to avoid unnecessary appGrid rebuild
|
||||
_sessionLockActive = Main.sessionMode.isLocked;
|
||||
log(`${Me.metadata.name}: enabled`);
|
||||
_enableTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
|
@ -88,19 +88,21 @@ function enable() {
|
|||
}
|
||||
|
||||
function disable() {
|
||||
_sessionLockActive = Main.sessionMode.isLocked;
|
||||
if (_enableTimeoutId) {
|
||||
GLib.source_remove(_enableTimeoutId);
|
||||
_enableTimeoutId = 0;
|
||||
} else {
|
||||
reset();
|
||||
resetVShell();
|
||||
}
|
||||
|
||||
global.verticalWorkspacesEnabled = undefined;
|
||||
log(`${Me.metadata.name}: disabled`);
|
||||
log(`${Me.metadata.name}: ${_sessionLockActive ? 'suspended' : 'disabled'}`);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
function activate() {
|
||||
function activateVShell() {
|
||||
_enabled = true;
|
||||
|
||||
_bgManagers = [];
|
||||
|
@ -119,12 +121,19 @@ function activate() {
|
|||
_prevDash.dash = dash;
|
||||
_prevDash.position = dash.position;
|
||||
|
||||
_monitorsChangedSigId = Main.layoutManager.connect('monitors-changed', () => _resetExtension(3000));
|
||||
_monitorsChangedSigId = Main.layoutManager.connect('monitors-changed', () => _resetExtension(2000));
|
||||
|
||||
// static bg animations conflict with startup animation
|
||||
// enable it on first hiding from the overview and disconnect the signal
|
||||
_showingOverviewConId = Main.overview.connect('showing', _onShowingOverview);
|
||||
|
||||
// switch PageUp/PageDown workspace switcher shortcuts
|
||||
_switchPageShortcuts();
|
||||
_setStaticBackground();
|
||||
|
||||
// fix for upstream bug - overview always shows workspace 1 instead of the active one after restart
|
||||
Main.overview._overview.controls._workspaceAdjustment.set_value(global.workspace_manager.get_active_workspace_index());
|
||||
|
||||
// if Dash to Dock detected force enable "Fix for DtD" option
|
||||
if (_Util.dashIsDashToDock()) {
|
||||
opt.set('fixUbuntuDock', true);
|
||||
|
@ -132,13 +141,9 @@ function activate() {
|
|||
} else {
|
||||
_fixUbuntuDock(opt.get('fixUbuntuDock'));
|
||||
}
|
||||
|
||||
// switch PageUp/PageDown workspace switcher shortcuts
|
||||
_switchPageShortcuts();
|
||||
_setStaticBackground(!opt.SHOW_BG_IN_OVERVIEW);
|
||||
}
|
||||
|
||||
function reset() {
|
||||
function resetVShell() {
|
||||
_enabled = 0;
|
||||
|
||||
_fixUbuntuDock(false);
|
||||
|
@ -174,6 +179,11 @@ function reset() {
|
|||
_showingOverviewConId = 0;
|
||||
}
|
||||
|
||||
if (_loadingProfileTimeoutId) {
|
||||
GLib.source_remove(_loadingProfileTimeoutId);
|
||||
_loadingProfileTimeoutId = 0;
|
||||
}
|
||||
|
||||
St.Settings.get().slow_down_factor = 1;
|
||||
|
||||
Main.overview.dash._background.set_style('');
|
||||
|
@ -185,14 +195,13 @@ function reset() {
|
|||
function _updateOverrides(reset = false) {
|
||||
WorkspacesViewOverride.update(reset);
|
||||
WorkspaceThumbnailOverride.update(reset);
|
||||
OverviewControlsOverride.update(reset);
|
||||
OverviewOverride.update(reset);
|
||||
OverviewControlsOverride.update(reset);
|
||||
|
||||
WorkspaceOverride.update(reset);
|
||||
WindowPreviewOverride.update(reset);
|
||||
WindowManagerOverride.update(reset);
|
||||
|
||||
AppDisplayOverride.update(reset);
|
||||
LayoutOverride.update(reset);
|
||||
DashOverride.update(reset);
|
||||
PanelOverride.update(reset);
|
||||
|
@ -205,6 +214,19 @@ function _updateOverrides(reset = false) {
|
|||
SearchOverride.update(reset);
|
||||
WindowSearchProvider.update(reset);
|
||||
RecentFilesSearchProvider.update(reset);
|
||||
|
||||
// don't rebuild app grid on every screen lock
|
||||
if (!_sessionLockActive) {
|
||||
// IconGrid needs to be patched before AppDisplay
|
||||
IconGridOverride.update(reset);
|
||||
AppDisplayOverride.update(reset);
|
||||
}
|
||||
|
||||
WindowAttentionHandlerOverride.update(reset);
|
||||
AppFavoritesOverride.update(reset);
|
||||
MessageTrayOverride.update(reset);
|
||||
OsdWindowOverride.update(reset);
|
||||
OverlayKey.update(reset);
|
||||
}
|
||||
|
||||
function _onShowingOverview() {
|
||||
|
@ -214,10 +236,9 @@ function _onShowingOverview() {
|
|||
if (opt.FIX_UBUNTU_DOCK) {
|
||||
// workaround for Ubuntu Dock breaking overview allocations after changing position
|
||||
const dash = Main.overview.dash;
|
||||
if (_prevDash.dash !== dash || _prevDash.position !== dash._position) {
|
||||
if (_prevDash.dash !== dash || _prevDash.position !== dash._position)
|
||||
_resetExtensionIfEnabled(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _resetExtension(timeout = 200) {
|
||||
|
@ -228,18 +249,18 @@ function _resetExtension(timeout = 200) {
|
|||
timeout,
|
||||
() => {
|
||||
if (!_enabled)
|
||||
return;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
|
||||
const dash = Main.overview.dash;
|
||||
if (!timeout && _prevDash.dash && dash !== _prevDash.dash) { // !timeout means DtD workaround callback
|
||||
_prevDash.dash = dash;
|
||||
log(`[${Me.metadata.name}]: Dash has been replaced, resetting extension...`);
|
||||
reset();
|
||||
activate();
|
||||
resetVShell();
|
||||
activateVShell();
|
||||
} else if (timeout) {
|
||||
log(`[${Me.metadata.name}]: resetting extension...`);
|
||||
reset();
|
||||
activate();
|
||||
resetVShell();
|
||||
activateVShell();
|
||||
}
|
||||
_resetTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
|
@ -247,15 +268,12 @@ function _resetExtension(timeout = 200) {
|
|||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
function _fixUbuntuDock(activate = true) {
|
||||
// Workaround for Ubuntu Dock breaking overview allocations after changing monitor configuration and deactivating dock
|
||||
if (_shellSettings && _watchDockSigId) {
|
||||
_shellSettings.disconnect(_watchDockSigId);
|
||||
if (_watchDockSigId) {
|
||||
global.settings.disconnect(_watchDockSigId);
|
||||
_watchDockSigId = 0;
|
||||
}
|
||||
_shellSettings = null;
|
||||
|
||||
if (_resetTimeoutId) {
|
||||
GLib.source_remove(_resetTimeoutId);
|
||||
|
@ -264,16 +282,33 @@ function _fixUbuntuDock(activate = true) {
|
|||
|
||||
_resetExtensionIfEnabled = () => {};
|
||||
|
||||
if (!activate) {
|
||||
if (!activate)
|
||||
return;
|
||||
}
|
||||
|
||||
_shellSettings = ExtensionUtils.getSettings( 'org.gnome.shell');
|
||||
_watchDockSigId = _shellSettings.connect('changed::enabled-extensions', () => _resetExtension());
|
||||
_watchDockSigId = global.settings.connect('changed::enabled-extensions', () => _resetExtension());
|
||||
_resetExtensionIfEnabled = _resetExtension;
|
||||
}
|
||||
|
||||
function _updateSettings(settings, key) {
|
||||
if (key?.includes('profile-data')) {
|
||||
const index = key.replace('profile-data-', '');
|
||||
Main.notify(`${Me.metadata.name}`, `Profile ${index} has been saved`);
|
||||
}
|
||||
// avoid overload while loading profile - update only once
|
||||
// delayed gsettings writes are processed alphabetically
|
||||
if (key === 'aaa-loading-profile') {
|
||||
Main.notify(`${Me.metadata.name}`, 'Profile has been loaded');
|
||||
if (_loadingProfileTimeoutId)
|
||||
GLib.source_remove(_loadingProfileTimeoutId);
|
||||
_loadingProfileTimeoutId = GLib.timeout_add(100, 0, () => {
|
||||
_resetExtension();
|
||||
_loadingProfileTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
if (_loadingProfileTimeoutId)
|
||||
return;
|
||||
|
||||
opt._updateSettings();
|
||||
|
||||
opt.WORKSPACE_MIN_SPACING = Main.overview._overview._controls._thumbnailsBox.get_theme_node().get_length('spacing');
|
||||
|
@ -281,35 +316,43 @@ function _updateSettings(settings, key) {
|
|||
const dash = Main.overview.dash;
|
||||
if (_Util.dashIsDashToDock()) {
|
||||
opt.DASH_POSITION = dash._position;
|
||||
opt.DASH_TOP = DASH_POSITION === 0;
|
||||
opt.DASH_RIGHT = DASH_POSITION === 1;
|
||||
opt.DASH_BOTTOM = DASH_POSITION === 2;
|
||||
opt.DASH_LEFT = DASH_POSITION === 3;
|
||||
opt.DASH_VERTICAL = DASH_LEFT || DASH_RIGHT;
|
||||
opt.DASH_TOP = opt.DASH_POSITION === 0;
|
||||
opt.DASH_RIGHT = opt.DASH_POSITION === 1;
|
||||
opt.DASH_BOTTOM = opt.DASH_POSITION === 2;
|
||||
opt.DASH_LEFT = opt.DASH_POSITION === 3;
|
||||
opt.DASH_VERTICAL = opt.DASH_LEFT || opt.DASH_RIGHT;
|
||||
}
|
||||
|
||||
opt.DASH_VISIBLE = opt.DASH_VISIBLE && !_Util.getEnabledExtensions('dash-to-panel@jderose9.github.com').length;
|
||||
|
||||
opt.MAX_ICON_SIZE = opt.get('dashMaxIconSize', true);
|
||||
if (opt.MAX_ICON_SIZE < 16) {
|
||||
opt.MAX_ICON_SIZE = 64;
|
||||
opt.set('dashMaxIconSize', 64);
|
||||
}
|
||||
|
||||
imports.ui.workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
|
||||
const monitorWidth = global.display.get_monitor_geometry(global.display.get_primary_monitor()).width;
|
||||
if (monitorWidth < 1600) {
|
||||
opt.APP_GRID_ICON_SIZE_DEFAULT = opt.APP_GRID_ACTIVE_PREVIEW ? 128 : 64;
|
||||
opt.APP_GRID_FOLDER_ICON_SIZE_DEFAULT = 64;
|
||||
}
|
||||
|
||||
if (!_Util.dashIsDashToDock()) {// DtD has its own opacity control
|
||||
imports.ui.workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = opt.OVERVIEW_MODE === 1 ? 0.1 : 0.95;
|
||||
|
||||
if (!_Util.dashIsDashToDock()) { // DtD has its own opacity control
|
||||
Main.overview.dash._background.opacity = Math.round(opt.get('dashBgOpacity', true) * 2.5); // conversion % to 0-255
|
||||
const radius = opt.get('dashBgRadius', true);
|
||||
if (radius) {
|
||||
let style;
|
||||
switch (opt.DASH_POSITION) {
|
||||
case 1:
|
||||
style = `border-radius: ${radius}px 0 0 ${radius}px;`
|
||||
style = `border-radius: ${radius}px 0 0 ${radius}px;`;
|
||||
break;
|
||||
case 3:
|
||||
style = `border-radius: 0 ${radius}px ${radius}px 0;`
|
||||
style = `border-radius: 0 ${radius}px ${radius}px 0;`;
|
||||
break;
|
||||
default:
|
||||
style = `border-radius: ${radius}px;`
|
||||
style = `border-radius: ${radius}px;`;
|
||||
}
|
||||
Main.overview.dash._background.set_style(style);
|
||||
} else {
|
||||
|
@ -317,38 +360,80 @@ function _updateSettings(settings, key) {
|
|||
}
|
||||
}
|
||||
|
||||
// adjust search entry style for OM2
|
||||
if (opt.OVERVIEW_MODE2)
|
||||
Main.overview.searchEntry.add_style_class_name('search-entry-om2');
|
||||
else
|
||||
Main.overview.searchEntry.remove_style_class_name('search-entry-om2');
|
||||
|
||||
Main.overview.searchEntry.visible = opt.SHOW_SEARCH_ENTRY;
|
||||
St.Settings.get().slow_down_factor = opt.ANIMATION_TIME_FACTOR;
|
||||
imports.ui.search.MAX_LIST_SEARCH_RESULTS_ROWS = opt.SEARCH_MAX_ROWS;
|
||||
opt.START_Y_OFFSET = (opt.PANEL_MODE === 1 && opt.PANEL_POSITION_TOP) ? Main.panel.height : 0;
|
||||
|
||||
opt.START_Y_OFFSET = (opt.get('panelModule', true) && opt.PANEL_OVERVIEW_ONLY && opt.PANEL_POSITION_TOP) ||
|
||||
// better to add unnecessary space than to have a panel overlapping other objects
|
||||
_Util.getEnabledExtensions('hidetopbar@mathieu.bidon.ca').length
|
||||
? Main.panel.height
|
||||
: 0;
|
||||
|
||||
if (settings)
|
||||
_applySettings(key);
|
||||
}
|
||||
|
||||
function _applySettings(key) {
|
||||
_setStaticBackground(!opt.SHOW_BG_IN_OVERVIEW);
|
||||
if (key?.endsWith('-module')) {
|
||||
_updateOverrides();
|
||||
return;
|
||||
}
|
||||
|
||||
_setStaticBackground();
|
||||
_updateOverviewTranslations();
|
||||
_switchPageShortcuts();
|
||||
|
||||
if (key === 'fix-ubuntu-dock')
|
||||
_fixUbuntuDock(opt.get('fixUbuntuDock', true));
|
||||
if (key === 'ws-thumbnails-position') {
|
||||
OverviewControlsOverride.update();
|
||||
WorkspaceThumbnailOverride.update();
|
||||
WorkspacesViewOverride.update();
|
||||
}
|
||||
if (key?.includes('app-grid')) {
|
||||
AppDisplayOverride.update();
|
||||
return;
|
||||
}
|
||||
if (key?.includes('panel')) {
|
||||
|
||||
if (key?.includes('panel'))
|
||||
PanelOverride.update();
|
||||
}
|
||||
if (key?.includes('dash') || key?.includes('app')) {
|
||||
|
||||
if (key?.includes('dash') || key?.includes('search') || key?.includes('icon'))
|
||||
DashOverride.update();
|
||||
}
|
||||
if (key === 'workspace-animation') {
|
||||
|
||||
if (key?.includes('hot-corner') || key?.includes('dash'))
|
||||
LayoutOverride.update();
|
||||
|
||||
switch (key) {
|
||||
case 'fix-ubuntu-dock':
|
||||
_fixUbuntuDock(opt.get('fixUbuntuDock', true));
|
||||
break;
|
||||
case 'ws-thumbnails-position':
|
||||
_updateOverrides();
|
||||
break;
|
||||
case 'workspace-switcher-animation':
|
||||
WorkspaceAnimationOverride.update();
|
||||
break;
|
||||
case 'search-width-scale':
|
||||
SearchOverride.update();
|
||||
break;
|
||||
case 'favorites-notify':
|
||||
AppFavoritesOverride.update();
|
||||
break;
|
||||
case 'window-attention-mode':
|
||||
WindowAttentionHandlerOverride.update();
|
||||
break;
|
||||
case 'show-ws-preview-bg':
|
||||
PanelOverride.update();
|
||||
break;
|
||||
case 'notification-position':
|
||||
MessageTrayOverride.update();
|
||||
break;
|
||||
case 'osd-position':
|
||||
OsdWindowOverride.update();
|
||||
break;
|
||||
case 'overlay-key':
|
||||
OverlayKey.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,25 +471,41 @@ function _switchPageShortcuts() {
|
|||
let moveDown = settings.get_strv(keyMoveDown);
|
||||
|
||||
if (vertical) {
|
||||
switchLeft.includes(switchPrevSc) && switchLeft.splice(switchLeft.indexOf(switchPrevSc), 1);
|
||||
switchRight.includes(switchNextSc) && switchRight.splice(switchRight.indexOf(switchNextSc), 1);
|
||||
moveLeft.includes(movePrevSc) && moveLeft.splice(moveLeft.indexOf(movePrevSc), 1);
|
||||
moveRight.includes(moveNextSc) && moveRight.splice(moveRight.indexOf(moveNextSc), 1);
|
||||
if (switchLeft.includes(switchPrevSc))
|
||||
switchLeft.splice(switchLeft.indexOf(switchPrevSc), 1);
|
||||
if (switchRight.includes(switchNextSc))
|
||||
switchRight.splice(switchRight.indexOf(switchNextSc), 1);
|
||||
if (moveLeft.includes(movePrevSc))
|
||||
moveLeft.splice(moveLeft.indexOf(movePrevSc), 1);
|
||||
if (moveRight.includes(moveNextSc))
|
||||
moveRight.splice(moveRight.indexOf(moveNextSc), 1);
|
||||
|
||||
switchUp.includes(switchPrevSc) || switchUp.push(switchPrevSc);
|
||||
switchDown.includes(switchNextSc) || switchDown.push(switchNextSc);
|
||||
moveUp.includes(movePrevSc) || moveUp.push(movePrevSc);
|
||||
moveDown.includes(moveNextSc) || moveDown.push(moveNextSc);
|
||||
if (!switchUp.includes(switchPrevSc))
|
||||
switchUp.push(switchPrevSc);
|
||||
if (!switchDown.includes(switchNextSc))
|
||||
switchDown.push(switchNextSc);
|
||||
if (!moveUp.includes(movePrevSc))
|
||||
moveUp.push(movePrevSc);
|
||||
if (!moveDown.includes(moveNextSc))
|
||||
moveDown.push(moveNextSc);
|
||||
} else {
|
||||
switchLeft.includes(switchPrevSc) || switchLeft.push(switchPrevSc);
|
||||
switchRight.includes(switchNextSc) || switchRight.push(switchNextSc);
|
||||
moveLeft.includes(movePrevSc) || moveLeft.push(movePrevSc);
|
||||
moveRight.includes(moveNextSc) || moveRight.push(moveNextSc);
|
||||
if (!switchLeft.includes(switchPrevSc))
|
||||
switchLeft.push(switchPrevSc);
|
||||
if (!switchRight.includes(switchNextSc))
|
||||
switchRight.push(switchNextSc);
|
||||
if (!moveLeft.includes(movePrevSc))
|
||||
moveLeft.push(movePrevSc);
|
||||
if (!moveRight.includes(moveNextSc))
|
||||
moveRight.push(moveNextSc);
|
||||
|
||||
switchUp.includes(switchPrevSc) && switchUp.splice(switchUp.indexOf(switchPrevSc), 1);
|
||||
switchDown.includes(switchNextSc) && switchDown.splice(switchDown.indexOf(switchNextSc), 1);
|
||||
moveUp.includes(movePrevSc) && moveUp.splice(moveUp.indexOf(movePrevSc), 1);
|
||||
moveDown.includes(moveNextSc) && moveDown.splice(moveDown.indexOf(moveNextSc), 1);
|
||||
if (switchUp.includes(switchPrevSc))
|
||||
switchUp.splice(switchUp.indexOf(switchPrevSc), 1);
|
||||
if (switchDown.includes(switchNextSc))
|
||||
switchDown.splice(switchDown.indexOf(switchNextSc), 1);
|
||||
if (moveUp.includes(movePrevSc))
|
||||
moveUp.splice(moveUp.indexOf(movePrevSc), 1);
|
||||
if (moveDown.includes(moveNextSc))
|
||||
moveDown.splice(moveDown.indexOf(moveNextSc), 1);
|
||||
}
|
||||
|
||||
settings.set_strv(keyLeft, switchLeft);
|
||||
|
@ -438,24 +539,24 @@ function _updateOverviewTranslations(dash = null, tmbBox = null, searchEntryBin
|
|||
return;
|
||||
}
|
||||
|
||||
const [tmbTranslation_x, tmbTranslation_y, dashTranslation_x, dashTranslation_y, searchTranslation_y] = _Util.getOverviewTranslations(opt, dash, tmbBox, searchEntryBin);
|
||||
tmbBox.translation_x = tmbTranslation_x;
|
||||
tmbBox.translation_y = tmbTranslation_y;
|
||||
const [tmbTranslationX, tmbTranslationY, dashTranslationX, dashTranslationY, searchTranslationY] = _Util.getOverviewTranslations(opt, dash, tmbBox, searchEntryBin);
|
||||
tmbBox.translation_x = tmbTranslationX;
|
||||
tmbBox.translation_y = tmbTranslationY;
|
||||
if (!_Util.dashNotDefault()) { // only if dash is not dash to dock
|
||||
dash.translation_x = dashTranslation_x;
|
||||
dash.translation_y = dashTranslation_y;
|
||||
dash.translation_x = dashTranslationX;
|
||||
dash.translation_y = dashTranslationY;
|
||||
}
|
||||
searchEntryBin.translation_y = searchTranslation_y;
|
||||
searchEntryBin.translation_y = searchTranslationY;
|
||||
}
|
||||
|
||||
function _setStaticBackground(reset = false) {
|
||||
_bgManagers.forEach((bg)=> {
|
||||
_bgManagers.forEach(bg => {
|
||||
Main.overview._overview._controls._stateAdjustment.disconnect(bg._fadeSignal);
|
||||
bg.destroy();
|
||||
});
|
||||
|
||||
_bgManagers = [];
|
||||
// if (!SHOW_BG_IN_OVERVIEW && SHOW_WS_PREVIEW_BG) the background is used for static transition from wallpaper to empty bg in the overview
|
||||
// if (!SHOW_BG_IN_OVERVIEW && !SHOW_WS_PREVIEW_BG) the background is used for static transition from wallpaper to empty bg in the overview
|
||||
if (reset || (!opt.SHOW_BG_IN_OVERVIEW && opt.SHOW_WS_PREVIEW_BG))
|
||||
return;
|
||||
|
||||
|
@ -470,7 +571,7 @@ function _setStaticBackground(reset = false) {
|
|||
bgManager.backgroundActor.content.brightness = 1;
|
||||
|
||||
|
||||
bgManager._fadeSignal = Main.overview._overview._controls._stateAdjustment.connect('notify::value', (v) => {
|
||||
bgManager._fadeSignal = Main.overview._overview._controls._stateAdjustment.connect('notify::value', v => {
|
||||
_updateStaticBackground(bgManager, v.value, v);
|
||||
});
|
||||
|
||||
|
@ -497,13 +598,12 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
|
|||
bgValue = stateValue;
|
||||
} else {
|
||||
VIGNETTE = 0.2;
|
||||
BRIGHTNESS = 0.95;
|
||||
if (opt.OVERVIEW_MODE2 && stateValue > 1 && !opt.WORKSPACE_MODE) {
|
||||
BRIGHTNESS = opt.OVERVIEW_BG_BRIGHTNESS;
|
||||
if (opt.OVERVIEW_MODE2 && stateValue > 1 && !opt.WORKSPACE_MODE)
|
||||
bgValue = stateValue - 1;
|
||||
} else {
|
||||
else
|
||||
bgValue = stateValue;
|
||||
}
|
||||
}
|
||||
|
||||
let blurEffect = bgManager.backgroundActor.get_effect('blur');
|
||||
if (!blurEffect) {
|
||||
|
@ -511,22 +611,22 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
|
|||
brightness: 1,
|
||||
sigma: 0,
|
||||
mode: Shell.BlurMode.ACTOR,
|
||||
})
|
||||
});
|
||||
bgManager.backgroundActor.add_effect_with_name('blur', blurEffect);
|
||||
}
|
||||
|
||||
bgManager.backgroundActor.content.vignette_sharpness = VIGNETTE;
|
||||
bgManager.backgroundActor.content.brightness = BRIGHTNESS;
|
||||
|
||||
let vignetteInit, brightnessInit, sigmaInit;
|
||||
let vignetteInit, brightnessInit;// , sigmaInit;
|
||||
if (opt.SHOW_BG_IN_OVERVIEW && opt.SHOW_WS_PREVIEW_BG) {
|
||||
vignetteInit = VIGNETTE;
|
||||
brightnessInit = BRIGHTNESS;
|
||||
sigmaInit = opt.OVERVIEW_BG_BLUR_SIGMA;
|
||||
// sigmaInit = opt.OVERVIEW_BG_BLUR_SIGMA;
|
||||
} else {
|
||||
vignetteInit = 0;
|
||||
brightnessInit = 1;
|
||||
sigmaInit = 0
|
||||
// sigmaInit = 0;
|
||||
}
|
||||
|
||||
if (opt.OVERVIEW_MODE2) {
|
||||
|
@ -540,20 +640,19 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
|
|||
if (opt.OVERVIEW_BG_BLUR_SIGMA || opt.APP_GRID_BG_BLUR_SIGMA) {
|
||||
// reduce number of steps of blur transition to improve performance
|
||||
const step = opt.SMOOTH_BLUR_TRANSITIONS ? 0.05 : 0.2;
|
||||
const searchActive = Main.overview._overview.controls._searchController.searchActive;
|
||||
const progress = stateValue - (stateValue % step);
|
||||
if (opt.SHOW_WS_PREVIEW_BG && stateValue < 1) { // no need to animate transition, unless appGrid state is involved, static bg is covered by the ws preview bg
|
||||
if (opt.SHOW_WS_PREVIEW_BG && stateValue < 1 && !searchActive) { // no need to animate transition, unless appGrid state is involved, static bg is covered by the ws preview bg
|
||||
if (blurEffect.sigma !== opt.OVERVIEW_BG_BLUR_SIGMA)
|
||||
blurEffect.sigma = opt.OVERVIEW_BG_BLUR_SIGMA;
|
||||
} else if (stateValue < 1) {
|
||||
} else if (stateValue < 1 && !searchActive) {
|
||||
const sigma = Math.round(Util.lerp(0, opt.OVERVIEW_BG_BLUR_SIGMA, progress));
|
||||
if (sigma !== blurEffect.sigma) {
|
||||
if (sigma !== blurEffect.sigma)
|
||||
blurEffect.sigma = sigma;
|
||||
}
|
||||
} else if (stateValue > 1 && bgManager._primary) {
|
||||
const sigma = Math.round(Util.lerp(opt.OVERVIEW_BG_BLUR_SIGMA, opt.APP_GRID_BG_BLUR_SIGMA, progress - 1));
|
||||
if (sigma !== blurEffect.sigma) {
|
||||
} else if ((stateValue > 1 && bgManager._primary) || searchActive) {
|
||||
const sigma = Math.round(Util.lerp(opt.OVERVIEW_BG_BLUR_SIGMA, opt.APP_GRID_BG_BLUR_SIGMA, progress % 1));
|
||||
if (sigma !== blurEffect.sigma)
|
||||
blurEffect.sigma = sigma;
|
||||
}
|
||||
} else if (stateValue === 1) {
|
||||
blurEffect.sigma = opt.OVERVIEW_BG_BLUR_SIGMA;
|
||||
} else if (stateValue === 0) {
|
||||
|
@ -562,3 +661,4 @@ function _updateStaticBackground(bgManager, stateValue, stateAdjustment = null)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* iconGrid.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// ------------------ IconGrid - override -------------------------------------------------------------------------
|
||||
|
||||
// workaround - silence page -2 error on gnome 43 during cleaning appgrid
|
||||
|
||||
var IconGrid = {
|
||||
getItemsAtPage: function(page) {
|
||||
if (page < 0 || page > this.nPages)
|
||||
return [];
|
||||
//throw new Error(`Page ${page} does not exist at IconGrid`);
|
||||
|
||||
const layoutManager = this.layout_manager;
|
||||
return layoutManager.getItemsAtPage(page);
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* layout.js
|
||||
*
|
||||
* panel barrier should follow panel position
|
||||
* or disable it to not collide with Custom Hot Corners barriers
|
||||
*
|
||||
* @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 Layout = imports.ui.layout;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.util;
|
||||
|
||||
let _overrides;
|
||||
let opt;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('LayoutManager', Layout.LayoutManager.prototype, LayoutManager);
|
||||
|
||||
Main.layoutManager._updatePanelBarrier();
|
||||
}
|
||||
|
||||
var LayoutManager = {
|
||||
_updatePanelBarrier: function() {
|
||||
if (this._rightPanelBarrier) {
|
||||
this._rightPanelBarrier.destroy();
|
||||
this._rightPanelBarrier = null;
|
||||
}
|
||||
|
||||
// disable the barrier
|
||||
return;
|
||||
|
||||
if (!this.primaryMonitor)
|
||||
return;
|
||||
|
||||
if (this.panelBox.height) {
|
||||
let primary = this.primaryMonitor;
|
||||
|
||||
this._rightPanelBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: primary.x + primary.width, y1: opt.PANEL_POSITION_TOP ? primary.y : primary.y + primary.height - this.panelBox.height,
|
||||
x2: primary.x + primary.width, y2: opt.PANEL_POSITION_TOP ? primary.y + this.panelBox.height : primary.y + primary.height,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_X,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
1474
extensions/vertical-workspaces/lib/appDisplay.js
Normal file
61
extensions/vertical-workspaces/lib/appFavorites.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* appFavorites.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Shell } = imports.gi;
|
||||
const AppFavorites = imports.ui.appFavorites;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let opt;
|
||||
let _overrides;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('appFavoritesModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
|
||||
// if notifications are enabled no override is needed
|
||||
if (reset || opt.SHOW_FAV_NOTIFICATION) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
// AppFavorites.AppFavorites is const, first access returns undefined
|
||||
const dummy = AppFavorites.AppFavorites;
|
||||
_overrides.addOverride('AppFavorites', AppFavorites.AppFavorites.prototype, AppFavoritesCommon);
|
||||
}
|
||||
|
||||
const AppFavoritesCommon = {
|
||||
addFavoriteAtPos(appId, pos) {
|
||||
this._addFavorite(appId, pos);
|
||||
},
|
||||
|
||||
removeFavorite(appId) {
|
||||
this._removeFavorite(appId);
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* dash.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -8,7 +8,7 @@
|
|||
* modified dash module of https://github.com/RensAlthuis/vertical-overview extension
|
||||
*/
|
||||
|
||||
const { Clutter, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
||||
const { Clutter, GObject, St, Shell, Meta } = imports.gi;
|
||||
const AppDisplay = imports.ui.appDisplay;
|
||||
const AppFavorites = imports.ui.appFavorites;
|
||||
const DND = imports.ui.dnd;
|
||||
|
@ -16,42 +16,54 @@ const IconGrid = imports.ui.iconGrid;
|
|||
const Main = imports.ui.main;
|
||||
const Overview = imports.ui.overview;
|
||||
const Dash = imports.ui.dash;
|
||||
const { DashIcon, DashItemContainer, getAppFromSource, DragPlaceholderItem } = imports.ui.dash;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const { AppMenu } = imports.ui.appMenu;
|
||||
const BoxPointer = imports.ui.boxpointer;
|
||||
const AltTab = imports.ui.altTab;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Util = Me.imports.util;
|
||||
const _ = Me.imports.settings._;
|
||||
const Util = Me.imports.lib.util;
|
||||
const _ = Me.imports.lib.settings._;
|
||||
|
||||
let verticalOverrides = {};
|
||||
const shellVersion = Util.shellVersion;
|
||||
let _origWorkId;
|
||||
let _newWorkId;
|
||||
let _showAppsIconBtnPressId;
|
||||
|
||||
// added values to achieve better ability to scale down according the available space
|
||||
// added values to achieve a better ability to scale down according to available space
|
||||
var BaseIconSizes = [16, 24, 32, 40, 44, 48, 56, 64, 72, 80, 96, 112, 128];
|
||||
|
||||
const RecentFilesSearchProviderPrefix = Me.imports.recentFilesSearchProvider.prefix;
|
||||
const WindowSearchProviderPrefix = Me.imports.windowSearchProvider.prefix;
|
||||
const RecentFilesSearchProviderPrefix = Me.imports.lib.recentFilesSearchProvider.prefix;
|
||||
const WindowSearchProviderPrefix = Me.imports.lib.windowSearchProvider.prefix;
|
||||
|
||||
let _overrides;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
const DASH_ITEM_LABEL_SHOW_TIME = 150;
|
||||
|
||||
let opt;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
_overrides.removeAll();
|
||||
}
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('dashModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
const dash = Main.overview._overview._controls.layoutManager._dash;
|
||||
|
||||
setToHorizontal();
|
||||
|
||||
dash.remove_style_class_name("vertical-overview");
|
||||
dash.remove_style_class_name("vertical-overview-left");
|
||||
dash.remove_style_class_name("vertical-overview-right");
|
||||
dash.remove_style_class_name('vertical');
|
||||
dash.remove_style_class_name('vertical-left');
|
||||
dash.remove_style_class_name('vertical-right');
|
||||
|
||||
if (reset) {
|
||||
_moveDashAppGridIcon(reset);
|
||||
|
@ -60,6 +72,7 @@ function update(reset = false) {
|
|||
_updateRecentFilesIcon(false);
|
||||
dash.visible = true;
|
||||
dash._background.opacity = 255;
|
||||
dash._background.remove_style_class_name('v-shell-dash-background');
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
|
@ -67,13 +80,15 @@ function update(reset = false) {
|
|||
|
||||
_overrides = new Util.Overrides();
|
||||
|
||||
_overrides.addOverride('DashItemContainer', Dash.DashItemContainer.prototype, DashItemContainerOverride);
|
||||
_overrides.addOverride('DashCommon', Dash.Dash.prototype, DashCommonOverride);
|
||||
_overrides.addOverride('DashItemContainer', Dash.DashItemContainer.prototype, DashItemContainerCommon);
|
||||
_overrides.addOverride('DashCommon', Dash.Dash.prototype, DashCommon);
|
||||
_overrides.addOverride('AppIcon', AppDisplay.AppIcon.prototype, AppIconCommon);
|
||||
_overrides.addOverride('DashIcon', Dash.DashIcon.prototype, DashIconCommon);
|
||||
|
||||
if (opt.DASH_VERTICAL) {
|
||||
_overrides.addOverride('Dash', Dash.Dash.prototype, DashOverride);
|
||||
setToVertical();
|
||||
dash.add_style_class_name("vertical-overview");
|
||||
dash.add_style_class_name('vertical');
|
||||
|
||||
if (!_newWorkId) {
|
||||
_origWorkId = dash._workId;
|
||||
|
@ -93,14 +108,15 @@ function update(reset = false) {
|
|||
_moveDashAppGridIcon();
|
||||
_connectShowAppsIcon();
|
||||
|
||||
if (dash._showWindowsIcon && !dash._showWindowsIconClickedId) {
|
||||
if (dash._showWindowsIcon && !dash._showWindowsIconClickedId)
|
||||
dash._showWindowsIconClickedId = dash._showWindowsIcon.toggleButton.connect('clicked', (a, c) => c && Util.activateSearchProvider(WindowSearchProviderPrefix));
|
||||
}
|
||||
if (dash._recentFilesIcon && !dash._recentFilesIconClickedId) {
|
||||
|
||||
if (dash._recentFilesIcon && !dash._recentFilesIconClickedId)
|
||||
dash._recentFilesIconClickedId = dash._recentFilesIcon.toggleButton.connect('clicked', (a, c) => c && Util.activateSearchProvider(RecentFilesSearchProviderPrefix));
|
||||
}
|
||||
Main.overview.dash._redisplay();
|
||||
Main.overview._overview._controls.layoutManager._dash.visible = opt.DASH_VISIBLE;
|
||||
|
||||
dash.visible = opt.DASH_VISIBLE;
|
||||
dash._background.add_style_class_name('v-shell-dash-background');
|
||||
dash._redisplay();
|
||||
}
|
||||
|
||||
function setToVertical() {
|
||||
|
@ -128,13 +144,13 @@ function setToVertical() {
|
|||
dash._queueRedisplay();
|
||||
dash._adjustIconSize();
|
||||
|
||||
dash.add_style_class_name(opt.DASH_LEFT ? 'vertical-overview-left' : 'vertical-overview-right');
|
||||
dash.add_style_class_name(opt.DASH_LEFT ? 'vertical-left' : 'vertical-right');
|
||||
}
|
||||
|
||||
function setToHorizontal() {
|
||||
let dash = Main.overview._overview._controls.layoutManager._dash;
|
||||
if (_origWorkId)
|
||||
dash._workId = _origWorkId; //pretty sure this is a leak, but there no provided way to disconnect these...
|
||||
dash._workId = _origWorkId; // pretty sure this is a leak, but there no provided way to disconnect these...
|
||||
dash._box.layout_manager.orientation = Clutter.Orientation.HORIZONTAL;
|
||||
dash._dashContainer.layout_manager.orientation = Clutter.Orientation.HORIZONTAL;
|
||||
dash._dashContainer.y_expand = true;
|
||||
|
@ -173,7 +189,7 @@ function _moveDashAppGridIcon(reset = false) {
|
|||
const index = dash._dashContainer.get_children().length - 1;
|
||||
dash._dashContainer.set_child_at_index(dash._showAppsIcon, index);
|
||||
}
|
||||
if (!reset && appIconPosition === 2) {// 2 - hide
|
||||
if (!reset && appIconPosition === 2) { // 2 - hide
|
||||
const style = opt.DASH_VERTICAL ? 'show-apps-icon-vertical-hide' : 'show-apps-icon-horizontal-hide';
|
||||
dash._showAppsIcon.add_style_class_name(style);
|
||||
// for some reason even if the icon height in vertical mode should be set to 0 by the style, it stays visible in full size returning height 1px
|
||||
|
@ -191,29 +207,27 @@ function _connectShowAppsIcon(reset = false) {
|
|||
Main.overview.dash._showAppsIcon.reactive = true;
|
||||
_showAppsIconBtnPressId = Main.overview.dash._showAppsIcon.connect('button-press-event', (actor, event) => {
|
||||
const button = event.get_button();
|
||||
if (button === Clutter.BUTTON_MIDDLE) {
|
||||
if (button === Clutter.BUTTON_MIDDLE)
|
||||
Util.openPreferences();
|
||||
} else if (button === Clutter.BUTTON_SECONDARY) {
|
||||
else if (button === Clutter.BUTTON_SECONDARY)
|
||||
Util.activateSearchProvider(WindowSearchProviderPrefix);
|
||||
} else {
|
||||
else
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
return Clutter.EVENT_STOP;
|
||||
});
|
||||
} else {
|
||||
if (_showAppsIconBtnPressId) {
|
||||
} else if (_showAppsIconBtnPressId) {
|
||||
Main.overview.dash._showAppsIcon.disconnect(_showAppsIconBtnPressId);
|
||||
_showAppsIconBtnPressId = 0;
|
||||
Main.overview.dash._showAppsIcon.reactive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var DashOverride = {
|
||||
handleDragOver: function (source, actor, _x, y, _time) {
|
||||
let app = getAppFromSource(source);
|
||||
const DashOverride = {
|
||||
handleDragOver(source, actor, _x, y, _time) {
|
||||
let app = Dash.getAppFromSource(source);
|
||||
|
||||
// Don't allow favoriting of transient apps
|
||||
if (app == null || app.is_window_backed())
|
||||
if (app === null || app.is_window_backed())
|
||||
return DND.DragMotionResult.NO_DROP;
|
||||
|
||||
if (!global.settings.is_writable('favorite-apps'))
|
||||
|
@ -257,7 +271,7 @@ var DashOverride = {
|
|||
this._dragPlaceholderPos = pos;
|
||||
|
||||
// Don't allow positioning before or after self
|
||||
if (favPos != -1 && (pos == favPos || pos == favPos + 1)) {
|
||||
if (favPos !== -1 && (pos === favPos || pos === favPos + 1)) {
|
||||
this._clearDragPlaceholder();
|
||||
return DND.DragMotionResult.CONTINUE;
|
||||
}
|
||||
|
@ -273,7 +287,7 @@ var DashOverride = {
|
|||
fadeIn = true;
|
||||
}
|
||||
|
||||
this._dragPlaceholder = new DragPlaceholderItem();
|
||||
this._dragPlaceholder = new Dash.DragPlaceholderItem();
|
||||
this._dragPlaceholder.child.set_width(this.iconSize / 2);
|
||||
this._dragPlaceholder.child.set_height(this.iconSize);
|
||||
this._box.insert_child_at_index(this._dragPlaceholder,
|
||||
|
@ -284,7 +298,7 @@ var DashOverride = {
|
|||
if (!this._dragPlaceholder)
|
||||
return DND.DragMotionResult.NO_DROP;
|
||||
|
||||
let srcIsFavorite = favPos != -1;
|
||||
let srcIsFavorite = favPos !== -1;
|
||||
|
||||
if (srcIsFavorite)
|
||||
return DND.DragMotionResult.MOVE_DROP;
|
||||
|
@ -292,7 +306,7 @@ var DashOverride = {
|
|||
return DND.DragMotionResult.COPY_DROP;
|
||||
},
|
||||
|
||||
_redisplay: function () {
|
||||
_redisplay() {
|
||||
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
||||
|
||||
let running = this._appSystem.get_running();
|
||||
|
@ -343,7 +357,7 @@ var DashOverride = {
|
|||
let newApp = newApps.length > newIndex ? newApps[newIndex] : null;
|
||||
|
||||
// No change at oldIndex/newIndex
|
||||
if (oldApp == newApp) {
|
||||
if (oldApp === newApp) {
|
||||
oldIndex++;
|
||||
newIndex++;
|
||||
continue;
|
||||
|
@ -361,7 +375,7 @@ var DashOverride = {
|
|||
addedItems.push({
|
||||
app: newApp,
|
||||
item: this._createAppItem(newApp),
|
||||
pos: newIndex
|
||||
pos: newIndex,
|
||||
});
|
||||
newIndex++;
|
||||
continue;
|
||||
|
@ -370,10 +384,10 @@ var DashOverride = {
|
|||
// App moved
|
||||
let nextApp = newApps.length > newIndex + 1
|
||||
? newApps[newIndex + 1] : null;
|
||||
let insertHere = nextApp && nextApp == oldApp;
|
||||
let insertHere = nextApp && nextApp === oldApp;
|
||||
let alreadyRemoved = removedActors.reduce((result, actor) => {
|
||||
let removedApp = actor.child._delegate.app;
|
||||
return result || removedApp == newApp;
|
||||
return result || removedApp === newApp;
|
||||
}, false);
|
||||
|
||||
if (insertHere || alreadyRemoved) {
|
||||
|
@ -381,7 +395,7 @@ var DashOverride = {
|
|||
addedItems.push({
|
||||
app: newApp,
|
||||
item: newItem,
|
||||
pos: newIndex + removedActors.length
|
||||
pos: newIndex + removedActors.length,
|
||||
});
|
||||
newIndex++;
|
||||
} else {
|
||||
|
@ -439,10 +453,10 @@ var DashOverride = {
|
|||
width: this.iconSize,
|
||||
height: 1,
|
||||
});
|
||||
this._box.add_child(this._separator)
|
||||
this._box.add_child(this._separator);
|
||||
}
|
||||
|
||||
//FIXME: separator placement is broken (also in original dash)
|
||||
// FIXME: separator placement is broken (also in original dash)
|
||||
let pos = nFavorites;
|
||||
if (this._dragPlaceholder)
|
||||
pos++;
|
||||
|
@ -456,8 +470,8 @@ var DashOverride = {
|
|||
this._box.queue_relayout();
|
||||
},
|
||||
|
||||
_createAppItem: function (app) {
|
||||
let appIcon = new DashIcon(app);
|
||||
_createAppItem(app) {
|
||||
let appIcon = new Dash.DashIcon(app);
|
||||
|
||||
let indicator = appIcon._dot;
|
||||
indicator.x_align = opt.DASH_LEFT ? Clutter.ActorAlign.START : Clutter.ActorAlign.END;
|
||||
|
@ -468,7 +482,7 @@ var DashOverride = {
|
|||
this._itemMenuStateChanged(item, opened);
|
||||
});
|
||||
|
||||
let item = new DashItemContainer();
|
||||
let item = new Dash.DashItemContainer();
|
||||
item.setChild(appIcon);
|
||||
|
||||
// Override default AppIcon label_actor, now the
|
||||
|
@ -480,12 +494,12 @@ var DashOverride = {
|
|||
this._hookUpLabel(item, appIcon);
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var DashItemContainerOverride = {
|
||||
const DashItemContainerCommon = {
|
||||
// move labels according dash position
|
||||
showLabel: function() {
|
||||
showLabel() {
|
||||
if (!this._labelText)
|
||||
return;
|
||||
|
||||
|
@ -500,7 +514,7 @@ var DashItemContainerOverride = {
|
|||
|
||||
const labelWidth = this.label.get_width();
|
||||
const labelHeight = this.label.get_height();
|
||||
const xOffset = Math.floor((itemWidth - labelWidth) / 2);
|
||||
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
|
||||
let x = Math.clamp(stageX + xOffset, 0, global.stage.width - labelWidth);
|
||||
|
||||
let node = this.label.get_theme_node();
|
||||
|
@ -509,23 +523,18 @@ var DashItemContainerOverride = {
|
|||
if (opt.DASH_TOP) {
|
||||
const yOffset = itemHeight - labelHeight + 3 * node.get_length('-y-offset');
|
||||
y = stageY + yOffset;
|
||||
|
||||
} else if (opt.DASH_BOTTOM) {
|
||||
const yOffset = node.get_length('-y-offset');
|
||||
y = stageY - this.label.height - yOffset;
|
||||
|
||||
} else if (opt.DASH_RIGHT) {
|
||||
const yOffset = Math.floor((itemHeight - labelHeight) / 2);
|
||||
|
||||
const xOffset = 4;
|
||||
xOffset = 4;
|
||||
|
||||
x = stageX - xOffset - this.label.width;
|
||||
y = Math.clamp(stageY + yOffset, 0, global.stage.height - labelHeight);
|
||||
|
||||
} if (opt.DASH_LEFT) {
|
||||
} else if (opt.DASH_LEFT) {
|
||||
const yOffset = Math.floor((itemHeight - labelHeight) / 2);
|
||||
|
||||
const xOffset = 4;
|
||||
xOffset = 4;
|
||||
|
||||
x = stageX + this.width + xOffset;
|
||||
y = Math.clamp(stageY + yOffset, 0, global.stage.height - labelHeight);
|
||||
|
@ -544,11 +553,17 @@ var DashItemContainerOverride = {
|
|||
duration: DASH_ITEM_LABEL_SHOW_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const DashCommon = {
|
||||
// use custom BaseIconSizes and add support for custom icons
|
||||
_adjustIconSize() {
|
||||
// if a user launches multiple apps at once, this function may be called again before the previous call has finished
|
||||
// as a result, new icons will not reach their full size, or will be missing, if adding a new icon and changing the dash size due to lack of space at the same time
|
||||
if (this._adjustingInProgress)
|
||||
return;
|
||||
|
||||
var DashCommonOverride = {
|
||||
_adjustIconSize: function () {
|
||||
// For the icon size, we only consider children which are "proper"
|
||||
// icons (i.e. ignoring drag placeholders) and which are not
|
||||
// animating out (which means they will be destroyed at the end of
|
||||
|
@ -560,18 +575,19 @@ var DashCommonOverride = {
|
|||
!actor.animatingOut;
|
||||
});
|
||||
|
||||
// add new custom icons into the calculation
|
||||
if (this._showAppsIcon.visible) {
|
||||
// add new custom icons to the list
|
||||
if (this._showAppsIcon.visible)
|
||||
iconChildren.push(this._showAppsIcon);
|
||||
}
|
||||
if (this._showWindowsIcon) {
|
||||
iconChildren.push(this._showWindowsIcon);
|
||||
}
|
||||
if (this._recentFilesIcon) {
|
||||
iconChildren.push(this._recentFilesIcon);
|
||||
}
|
||||
|
||||
if (!iconChildren.length) return;
|
||||
if (this._showWindowsIcon)
|
||||
iconChildren.push(this._showWindowsIcon);
|
||||
|
||||
if (this._recentFilesIcon)
|
||||
iconChildren.push(this._recentFilesIcon);
|
||||
|
||||
|
||||
if (!iconChildren.length)
|
||||
return;
|
||||
|
||||
if (this._maxWidth === -1 || this._maxHeight === -1)
|
||||
return;
|
||||
|
@ -593,12 +609,14 @@ var DashCommonOverride = {
|
|||
let firstButton = iconChildren[0].child;
|
||||
let firstIcon = firstButton._delegate.icon;
|
||||
|
||||
if (!firstIcon.icon) return;
|
||||
if (!firstIcon.icon)
|
||||
return;
|
||||
|
||||
// Enforce valid spacings during the size request
|
||||
firstIcon.icon.ensure_style();
|
||||
const [, , iconWidth, iconHeight] = firstIcon.icon.get_preferred_size();
|
||||
const [, , buttonWidth, buttonHeight] = firstButton.get_preferred_size();
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
|
||||
let availWidth, availHeight, maxIconSize;
|
||||
if (dashHorizontal) {
|
||||
|
@ -614,7 +632,7 @@ var DashCommonOverride = {
|
|||
availHeight -= themeNode.get_vertical_padding();
|
||||
availHeight -= buttonHeight - iconHeight;
|
||||
|
||||
maxIconSize = Math.min(availWidth / iconChildren.length, availHeight, opt.MAX_ICON_SIZE);
|
||||
maxIconSize = Math.min(availWidth / iconChildren.length, availHeight, opt.MAX_ICON_SIZE * scaleFactor);
|
||||
} else {
|
||||
availWidth = this._maxWidth;
|
||||
availWidth -= this._background.get_theme_node().get_horizontal_padding();
|
||||
|
@ -626,10 +644,9 @@ var DashCommonOverride = {
|
|||
(iconChildren.length - 1) * spacing +
|
||||
2 * this._background.get_theme_node().get_vertical_padding();
|
||||
|
||||
maxIconSize = Math.min(availWidth, availHeight / iconChildren.length, opt.MAX_ICON_SIZE);
|
||||
maxIconSize = Math.min(availWidth, availHeight / iconChildren.length, opt.MAX_ICON_SIZE * scaleFactor);
|
||||
}
|
||||
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let iconSizes = BaseIconSizes.map(s => s * scaleFactor);
|
||||
|
||||
let newIconSize = BaseIconSizes[0];
|
||||
|
@ -638,8 +655,11 @@ var DashCommonOverride = {
|
|||
newIconSize = BaseIconSizes[i];
|
||||
}
|
||||
|
||||
/*if (newIconSize == this.iconSize)
|
||||
return;*/
|
||||
if (newIconSize === this.iconSize)
|
||||
return;
|
||||
|
||||
// set the in-progress state here after all the possible cancels
|
||||
this._adjustingInProgress = true;
|
||||
|
||||
let oldIconSize = this.iconSize;
|
||||
this.iconSize = newIconSize;
|
||||
|
@ -683,23 +703,351 @@ var DashCommonOverride = {
|
|||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
|
||||
this._adjustingInProgress = false;
|
||||
},
|
||||
};
|
||||
|
||||
const DashIconCommon = {
|
||||
after__init() {
|
||||
if (opt.DASH_ICON_SCROLL) {
|
||||
this._scrollConId = this.connect('scroll-event', _onScrollEvent.bind(this));
|
||||
this._leaveConId = this.connect('leave-event', _onLeaveEvent.bind(this));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function _onScrollEvent(source, event) {
|
||||
if ((this.app && !opt.DASH_ICON_SCROLL) || (this._isSearchWindowsIcon && !opt.SEARCH_WINDOWS_ICON_SCROLL)) {
|
||||
if (this._scrollConId)
|
||||
this.disconnect(this._scrollConId);
|
||||
if (this._leaveConId)
|
||||
this.disconnect(this._leaveConId);
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
let direction = Util.getScrollDirection(event);
|
||||
if (direction === Clutter.ScrollDirection.UP)
|
||||
direction = 1;
|
||||
else if (direction === Clutter.ScrollDirection.DOWN)
|
||||
direction = -1;
|
||||
else
|
||||
return Clutter.EVENT_STOP;
|
||||
|
||||
// avoid uncontrollable switching if smooth scroll wheel or trackpad is used
|
||||
if (this._lastScroll && Date.now() - this._lastScroll < 160)
|
||||
return Clutter.EVENT_STOP;
|
||||
|
||||
this._lastScroll = Date.now();
|
||||
|
||||
_switchWindow.bind(this)(direction);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
function _onLeaveEvent() {
|
||||
if (!this._selectedMetaWin || this.has_pointer || this.toggleButton?.has_pointer)
|
||||
return;
|
||||
|
||||
this._selectedPreview._activateSelected = false;
|
||||
this._selectedMetaWin = null;
|
||||
this._scrolledWindows = null;
|
||||
_showWindowPreview.bind(this)(null);
|
||||
}
|
||||
|
||||
function _switchWindow(direction) {
|
||||
if (!this._scrolledWindows) {
|
||||
// source is app icon
|
||||
if (this.app) {
|
||||
this._scrolledWindows = this.app.get_windows();
|
||||
const wsList = [];
|
||||
this._scrolledWindows.forEach(w => {
|
||||
const ws = w.get_workspace();
|
||||
if (!wsList.includes(ws))
|
||||
wsList.push(ws);
|
||||
});
|
||||
// sort windows by workspaces in MRU order
|
||||
this._scrolledWindows.sort((a, b) => wsList.indexOf(a.get_workspace()) > wsList.indexOf(b.get_workspace()));
|
||||
// source is Search Windows icon
|
||||
} else if (this._isSearchWindowsIcon) {
|
||||
if (opt.SEARCH_WINDOWS_ICON_SCROLL === 1) // all windows
|
||||
this._scrolledWindows = AltTab.getWindows(null);
|
||||
else
|
||||
this._scrolledWindows = AltTab.getWindows(global.workspace_manager.get_active_workspace());
|
||||
}
|
||||
}
|
||||
|
||||
let windows = this._scrolledWindows;
|
||||
|
||||
if (!windows.length)
|
||||
return;
|
||||
|
||||
// if window selection is in the process, the previewed window must be the current one
|
||||
let currentWin = this._selectedMetaWin ? this._selectedMetaWin : windows[0];
|
||||
|
||||
const currentIdx = windows.indexOf(currentWin);
|
||||
let targetIdx = currentIdx + direction;
|
||||
|
||||
if (targetIdx > windows.length - 1)
|
||||
targetIdx = 0;
|
||||
else if (targetIdx < 0)
|
||||
targetIdx = windows.length - 1;
|
||||
|
||||
const metaWin = windows[targetIdx];
|
||||
_showWindowPreview.bind(this)(metaWin);
|
||||
this._selectedMetaWin = metaWin;
|
||||
}
|
||||
|
||||
function _showWindowPreview(metaWin) {
|
||||
const views = Main.overview._overview.controls._workspacesDisplay._workspacesViews;
|
||||
const viewsIter = [views[0]];
|
||||
// secondary monitors use different structure
|
||||
views.forEach(v => {
|
||||
if (v._workspacesView)
|
||||
viewsIter.push(v._workspacesView);
|
||||
});
|
||||
|
||||
viewsIter.forEach(view => {
|
||||
// if workspaces are on primary monitor only
|
||||
if (!view || !view._workspaces)
|
||||
return;
|
||||
|
||||
view._workspaces.forEach(ws => {
|
||||
ws._windows.forEach(windowPreview => {
|
||||
// metaWin === null resets opacity
|
||||
let opacity = metaWin ? 50 : 255;
|
||||
windowPreview._activateSelected = false;
|
||||
|
||||
// minimized windows are invisible if windows are not exposed (WORKSPACE_MODE === 0)
|
||||
if (!windowPreview.opacity)
|
||||
windowPreview.opacity = 255;
|
||||
|
||||
// app windows set to lower opacity, so they can be recognized
|
||||
if (this._scrolledWindows && this._scrolledWindows.includes(windowPreview.metaWindow)) {
|
||||
if (opt.DASH_ICON_SCROLL === 2)
|
||||
opacity = 254;
|
||||
}
|
||||
if (windowPreview.metaWindow === metaWin) {
|
||||
if (metaWin && metaWin.get_workspace() !== global.workspace_manager.get_active_workspace())
|
||||
Main.wm.actionMoveWorkspace(metaWin.get_workspace());
|
||||
|
||||
windowPreview.get_parent().set_child_above_sibling(windowPreview, null);
|
||||
|
||||
opacity = 255;
|
||||
this._selectedPreview = windowPreview;
|
||||
windowPreview._activateSelected = true;
|
||||
}
|
||||
|
||||
// if windows are exposed, highlight selected using opacity
|
||||
if ((opt.OVERVIEW_MODE && opt.WORKSPACE_MODE) || !opt.OVERVIEW_MODE) {
|
||||
if (metaWin && opacity === 255)
|
||||
windowPreview.showOverlay(true);
|
||||
else
|
||||
windowPreview.hideOverlay(true);
|
||||
windowPreview.ease({
|
||||
duration: 200,
|
||||
opacity,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const AppIconCommon = {
|
||||
activate(button) {
|
||||
const event = Clutter.get_current_event();
|
||||
const state = event ? event.get_state() : 0;
|
||||
const isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
|
||||
const isCtrlPressed = Util.isCtrlPressed(state);
|
||||
const isShiftPressed = Util.isShiftPressed(state);
|
||||
const openNewWindow = (this.app.can_open_new_window() &&
|
||||
this.app.state === Shell.AppState.RUNNING &&
|
||||
(isCtrlPressed || isMiddleButton) && !opt.DASH_CLICK_ACTION === 2) ||
|
||||
(opt.DASH_CLICK_ACTION === 2 && !this._selectedMetaWin && !isMiddleButton);
|
||||
|
||||
const currentWS = global.workspace_manager.get_active_workspace();
|
||||
const appRecentWorkspace = _getAppRecentWorkspace(this.app);
|
||||
// this feature shouldn't affect search results, dash icons don't have labels, so we use them as a condition
|
||||
const showWidowsBeforeActivation = opt.DASH_CLICK_ACTION === 1 && !this.icon.label;
|
||||
|
||||
let targetWindowOnCurrentWs = false;
|
||||
if (opt.DASH_FOLLOW_RECENT_WIN) {
|
||||
targetWindowOnCurrentWs = appRecentWorkspace === currentWS;
|
||||
} else {
|
||||
this.app.get_windows().forEach(
|
||||
w => {
|
||||
targetWindowOnCurrentWs = targetWindowOnCurrentWs || (w.get_workspace() === currentWS);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ((this.app.state === Shell.AppState.STOPPED || openNewWindow) && !isShiftPressed)
|
||||
this.animateLaunch();
|
||||
|
||||
if (openNewWindow) {
|
||||
this.app.open_new_window(-1);
|
||||
// if DASH_CLICK_ACTION == "SHOW_WINS_BEFORE", the app has more than one window and has no window on the current workspace,
|
||||
// don't activate the app immediately, only move the overview to the workspace with the app's recent window
|
||||
} else if (showWidowsBeforeActivation && !isShiftPressed && this.app.get_n_windows() > 1 && !targetWindowOnCurrentWs/* && !(opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE)*/) {
|
||||
// this._scroll = true;
|
||||
// this._scrollTime = Date.now();
|
||||
Main.wm.actionMoveWorkspace(appRecentWorkspace);
|
||||
Main.overview.dash.showAppsButton.checked = false;
|
||||
return;
|
||||
} else if (this._selectedMetaWin) {
|
||||
this._selectedMetaWin.activate(global.get_current_time());
|
||||
} else if (showWidowsBeforeActivation && opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE && !isShiftPressed && this.app.get_n_windows() > 1) {
|
||||
// expose windows
|
||||
Main.overview._overview._controls._thumbnailsBox._activateThumbnailAtPoint(0, 0, global.get_current_time(), true);
|
||||
return;
|
||||
} else if (opt.DASH_SHIFT_CLICK_MV && isShiftPressed && this.app.get_windows().length) {
|
||||
this._moveAppToCurrentWorkspace();
|
||||
return;
|
||||
} else if (isShiftPressed) {
|
||||
return;
|
||||
} else {
|
||||
this.app.activate();
|
||||
}
|
||||
|
||||
Main.overview.hide();
|
||||
},
|
||||
|
||||
_moveAppToCurrentWorkspace() {
|
||||
this.app.get_windows().forEach(w => w.change_workspace(global.workspace_manager.get_active_workspace()));
|
||||
},
|
||||
|
||||
popupMenu(side = St.Side.LEFT) {
|
||||
if (shellVersion >= 42)
|
||||
this.setForcedHighlight(true);
|
||||
this._removeMenuTimeout();
|
||||
this.fake_release();
|
||||
|
||||
if (!this._getWindowsOnCurrentWs) {
|
||||
this._getWindowsOnCurrentWs = function () {
|
||||
const winList = [];
|
||||
this.app.get_windows().forEach(w => {
|
||||
if (w.get_workspace() === global.workspace_manager.get_active_workspace())
|
||||
winList.push(w);
|
||||
});
|
||||
return winList;
|
||||
};
|
||||
|
||||
this._windowsOnOtherWs = function () {
|
||||
return (this.app.get_windows().length - this._getWindowsOnCurrentWs().length) > 0;
|
||||
};
|
||||
}
|
||||
|
||||
if (!this._menu) {
|
||||
this._menu = new AppMenu(this, side, {
|
||||
favoritesSection: true,
|
||||
showSingleWindows: true,
|
||||
});
|
||||
|
||||
this._menu.setApp(this.app);
|
||||
this._openSigId = this._menu.connect('open-state-changed', (menu, isPoppedUp) => {
|
||||
if (!isPoppedUp)
|
||||
this._onMenuPoppedDown();
|
||||
});
|
||||
// Main.overview.connectObject('hiding',
|
||||
this._hidingSigId = Main.overview.connect('hiding',
|
||||
() => this._menu.close(), this);
|
||||
|
||||
Main.uiGroup.add_actor(this._menu.actor);
|
||||
this._menuManager.addMenu(this._menu);
|
||||
}
|
||||
|
||||
// once the menu is created, it stays unchanged and we need to modify our items based on current situation
|
||||
if (this._addedMenuItems && this._addedMenuItems.length)
|
||||
this._addedMenuItems.forEach(i => i.destroy());
|
||||
|
||||
|
||||
const popupItems = [];
|
||||
|
||||
const separator = new PopupMenu.PopupSeparatorMenuItem();
|
||||
this._menu.addMenuItem(separator);
|
||||
|
||||
if (this.app.get_n_windows()) {
|
||||
// if (/* opt.APP_MENU_FORCE_QUIT*/true) {}
|
||||
popupItems.push([_('Force Quit'), () => {
|
||||
this.app.get_windows()[0].kill();
|
||||
}]);
|
||||
|
||||
// if (opt.APP_MENU_CLOSE_WS) {}
|
||||
const nWin = this._getWindowsOnCurrentWs().length;
|
||||
if (nWin) {
|
||||
popupItems.push([_(`Close ${nWin} Windows on Current Workspace`), () => {
|
||||
const windows = this._getWindowsOnCurrentWs();
|
||||
let time = global.get_current_time();
|
||||
for (let win of windows) {
|
||||
// increase time by 1 ms for each window to avoid errors from GS
|
||||
win.delete(time++);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
|
||||
if (/* opt.APP_MENU_MV_TO_WS && */this._windowsOnOtherWs())
|
||||
popupItems.push([_('Move App to Current Workspace ( Shift + Click )'), this._moveAppToCurrentWorkspace]);
|
||||
}
|
||||
|
||||
this._addedMenuItems = [];
|
||||
this._addedMenuItems.push(separator);
|
||||
popupItems.forEach(i => {
|
||||
let item = new PopupMenu.PopupMenuItem(i[0]);
|
||||
this._menu.addMenuItem(item);
|
||||
item.connect('activate', i[1].bind(this));
|
||||
this._addedMenuItems.push(item);
|
||||
});
|
||||
|
||||
this.emit('menu-state-changed', true);
|
||||
|
||||
this._menu.open(BoxPointer.PopupAnimation.FULL);
|
||||
this._menuManager.ignoreRelease();
|
||||
this.emit('sync-tooltip');
|
||||
|
||||
return false;
|
||||
},
|
||||
};
|
||||
|
||||
function _getWindowApp(metaWin) {
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
return tracker.get_window_app(metaWin);
|
||||
}
|
||||
|
||||
function _getAppLastUsedWindow(app) {
|
||||
let recentWin;
|
||||
global.display.get_tab_list(Meta.TabList.NORMAL_ALL, null).forEach(metaWin => {
|
||||
const winApp = _getWindowApp(metaWin);
|
||||
if (!recentWin && winApp === app)
|
||||
recentWin = metaWin;
|
||||
});
|
||||
return recentWin;
|
||||
}
|
||||
|
||||
function _getAppRecentWorkspace(app) {
|
||||
const recentWin = _getAppLastUsedWindow(app);
|
||||
if (recentWin)
|
||||
return recentWin.get_workspace();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function _updateSearchWindowsIcon(show = opt.SHOW_WINDOWS_ICON) {
|
||||
|
||||
const dash = Main.overview._overview._controls.layoutManager._dash;
|
||||
const dashContainer = dash._dashContainer;
|
||||
|
||||
if (dash._showWindowsIcon) {
|
||||
dashContainer.remove_child(dash._showWindowsIcon);
|
||||
dash._showWindowsIconClickedId && dash._showWindowsIcon.toggleButton.disconnect(dash._showWindowsIconClickedId);
|
||||
if (dash._showWindowsIconClickedId)
|
||||
dash._showWindowsIcon.toggleButton.disconnect(dash._showWindowsIconClickedId);
|
||||
dash._showWindowsIconClickedId = undefined;
|
||||
dash._showWindowsIcon && dash._showWindowsIcon.destroy();
|
||||
if (dash._showWindowsIcon)
|
||||
dash._showWindowsIcon.destroy();
|
||||
dash._showWindowsIcon = undefined;
|
||||
}
|
||||
|
||||
if (!show || !opt.WINDOW_SEARCH_PROVIDER_ENABLED) return;
|
||||
if (!show || !opt.WINDOW_SEARCH_PROVIDER_ENABLED)
|
||||
return;
|
||||
|
||||
if (!dash._showWindowsIcon) {
|
||||
dash._showWindowsIcon = new ShowWindowsIcon();
|
||||
|
@ -708,22 +1056,23 @@ function _updateSearchWindowsIcon(show = opt.SHOW_WINDOWS_ICON) {
|
|||
dash._hookUpLabel(dash._showWindowsIcon);
|
||||
}
|
||||
|
||||
dash._showWindowsIcon.icon.setIconSize(opt.MAX_ICON_SIZE);
|
||||
dash._showWindowsIcon.icon.setIconSize(dash.iconSize);
|
||||
if (opt.SHOW_WINDOWS_ICON === 1) {
|
||||
dashContainer.set_child_at_index(dash._showWindowsIcon, 0);
|
||||
} else if (opt.SHOW_WINDOWS_ICON === 2) {
|
||||
index = dashContainer.get_children().length - 1;
|
||||
const index = dashContainer.get_children().length - 1;
|
||||
dashContainer.set_child_at_index(dash._showWindowsIcon, index);
|
||||
}
|
||||
|
||||
Main.overview._overview._controls.layoutManager._dash._adjustIconSize();
|
||||
}
|
||||
|
||||
var ShowWindowsIcon = GObject.registerClass(
|
||||
const ShowWindowsIcon = GObject.registerClass(
|
||||
class ShowWindowsIcon extends Dash.DashItemContainer {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
this._isSearchWindowsIcon = true;
|
||||
this._labelText = _('Search Open Windows (Hotkey: Space)');
|
||||
this.toggleButton = new St.Button({
|
||||
style_class: 'show-apps',
|
||||
|
@ -744,6 +1093,12 @@ class ShowWindowsIcon extends Dash.DashItemContainer {
|
|||
this.toggleButton._delegate = this;
|
||||
|
||||
this.setChild(this.toggleButton);
|
||||
|
||||
if (opt.SEARCH_WINDOWS_ICON_SCROLL) {
|
||||
this.reactive = true;
|
||||
this._scrollConId = this.connect('scroll-event', _onScrollEvent.bind(this));
|
||||
this._leaveConId = this.connect('leave-event', _onLeaveEvent.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
_createIcon(size) {
|
||||
|
@ -758,19 +1113,21 @@ class ShowWindowsIcon extends Dash.DashItemContainer {
|
|||
});
|
||||
|
||||
function _updateRecentFilesIcon(show = opt.SHOW_RECENT_FILES_ICON) {
|
||||
|
||||
const dash = Main.overview._overview._controls.layoutManager._dash;
|
||||
const dashContainer = dash._dashContainer;
|
||||
|
||||
if (dash._recentFilesIcon) {
|
||||
dashContainer.remove_child(dash._recentFilesIcon);
|
||||
dash._recentFilesIconClickedId && dash._recentFilesIcon.toggleButton.disconnect(dash._recentFilesIconClickedId);
|
||||
if (dash._recentFilesIconClickedId)
|
||||
dash._recentFilesIcon.toggleButton.disconnect(dash._recentFilesIconClickedId);
|
||||
dash._recentFilesIconClickedId = undefined;
|
||||
dash._recentFilesIcon && dash._recentFilesIcon.destroy();
|
||||
if (dash._recentFilesIcon)
|
||||
dash._recentFilesIcon.destroy();
|
||||
dash._recentFilesIcon = undefined;
|
||||
}
|
||||
|
||||
if (!show || !opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED) return;
|
||||
if (!show || !opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED)
|
||||
return;
|
||||
|
||||
if (!dash._recentFilesIcon) {
|
||||
dash._recentFilesIcon = new ShowRecentFilesIcon();
|
||||
|
@ -779,18 +1136,18 @@ function _updateRecentFilesIcon(show = opt.SHOW_RECENT_FILES_ICON) {
|
|||
dash._hookUpLabel(dash._recentFilesIcon);
|
||||
}
|
||||
|
||||
dash._recentFilesIcon.icon.setIconSize(opt.MAX_ICON_SIZE);
|
||||
dash._recentFilesIcon.icon.setIconSize(dash.iconSize);
|
||||
if (opt.SHOW_RECENT_FILES_ICON === 1) {
|
||||
dashContainer.set_child_at_index(dash._recentFilesIcon, 0);
|
||||
} else if (opt.SHOW_RECENT_FILES_ICON === 2) {
|
||||
index = dashContainer.get_children().length - 1;
|
||||
const index = dashContainer.get_children().length - 1;
|
||||
dashContainer.set_child_at_index(dash._recentFilesIcon, index);
|
||||
}
|
||||
|
||||
Main.overview._overview._controls.layoutManager._dash._adjustIconSize();
|
||||
}
|
||||
|
||||
var ShowRecentFilesIcon = GObject.registerClass(
|
||||
const ShowRecentFilesIcon = GObject.registerClass(
|
||||
class ShowRecentFilesIcon extends Dash.DashItemContainer {
|
||||
_init() {
|
||||
super._init();
|
314
extensions/vertical-workspaces/lib/iconGrid.js
Normal file
|
@ -0,0 +1,314 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* iconGrid.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const { GLib, St, Meta } = imports.gi;
|
||||
const IconGrid = imports.ui.iconGrid;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
const shellVersion = _Util.shellVersion;
|
||||
|
||||
// added sizes for better scaling
|
||||
const IconSize = {
|
||||
LARGEST: 256,
|
||||
224: 224,
|
||||
208: 208,
|
||||
192: 192,
|
||||
176: 176,
|
||||
160: 160,
|
||||
144: 144,
|
||||
128: 128,
|
||||
112: 112,
|
||||
LARGE: 96,
|
||||
80: 80,
|
||||
64: 64,
|
||||
48: 48,
|
||||
TINY: 32,
|
||||
};
|
||||
|
||||
const PAGE_WIDTH_CORRECTION = 100;
|
||||
|
||||
let opt;
|
||||
let _overrides;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('appDisplayModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
if (shellVersion < 43 && IconGridCommon._findBestModeForSize) {
|
||||
IconGridCommon['findBestModeForSize'] = IconGridCommon._findBestModeForSize;
|
||||
IconGridCommon['_findBestModeForSize'] = undefined;
|
||||
}
|
||||
_overrides.addOverride('IconGrid', IconGrid.IconGrid.prototype, IconGridCommon);
|
||||
_overrides.addOverride('IconGridLayout', IconGrid.IconGridLayout.prototype, IconGridLayoutCommon);
|
||||
}
|
||||
// workaround - silence page -2 error on gnome 43 while cleaning app grid
|
||||
|
||||
const IconGridCommon = {
|
||||
getItemsAtPage(page) {
|
||||
if (page < 0 || page >= this.nPages)
|
||||
return [];
|
||||
// throw new Error(`Page ${page} does not exist at IconGrid`);
|
||||
|
||||
const layoutManager = this.layout_manager;
|
||||
return layoutManager.getItemsAtPage(page);
|
||||
},
|
||||
|
||||
_findBestModeForSize(width, height) {
|
||||
// this function is for main grid only, folder grid calculation is in appDisplay.AppFolderDialog class
|
||||
if (this._currentMode > -1 || this.layoutManager._isFolder)
|
||||
return;
|
||||
const { pagePadding } = this.layout_manager;
|
||||
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||
const iconPadding = 53 * scaleFactor;
|
||||
// provided width is usually about 100px wider in horizontal orientation with prev/next page indicators
|
||||
const pageIndicatorCompensation = opt.ORIENTATION ? 0 : PAGE_WIDTH_CORRECTION;
|
||||
|
||||
width -= pagePadding.left + pagePadding.right + pageIndicatorCompensation;
|
||||
width *= opt.APP_GRID_PAGE_WIDTH_SCALE;
|
||||
height -= pagePadding.top + pagePadding.bottom;
|
||||
|
||||
// store grid max dimensions for icon size algorithm
|
||||
this.layoutManager._gridWidth = width;
|
||||
this.layoutManager._gridHeight = height;
|
||||
|
||||
const spacing = opt.APP_GRID_SPACING;
|
||||
const iconSize = (opt.APP_GRID_ICON_SIZE > 0 ? opt.APP_GRID_ICON_SIZE : opt.APP_GRID_ICON_SIZE_DEFAULT) * scaleFactor;
|
||||
// if this._gridModes.length === 1, custom grid should be used
|
||||
// if (iconSize > 0 && this._gridModes.length > 1) {
|
||||
let columns = opt.APP_GRID_COLUMNS;
|
||||
let rows = opt.APP_GRID_ROWS;
|
||||
// 0 means adaptive size
|
||||
let unusedSpaceH = -1;
|
||||
let unusedSpaceV = -1;
|
||||
if (!columns) {
|
||||
columns = Math.floor(width / (iconSize + iconPadding)) + 1;
|
||||
while (unusedSpaceH < 0) {
|
||||
columns -= 1;
|
||||
unusedSpaceH = width - columns * (iconSize + iconPadding) - (columns - 1) * spacing;
|
||||
}
|
||||
}
|
||||
if (!rows) {
|
||||
rows = Math.floor(height / (iconSize + iconPadding)) + 1;
|
||||
while (unusedSpaceV < 0) {
|
||||
rows -= 1;
|
||||
unusedSpaceV = height - rows * (iconSize + iconPadding) - (rows - 1) * spacing;
|
||||
}
|
||||
}
|
||||
|
||||
this._gridModes = [{ columns, rows }];
|
||||
// }
|
||||
|
||||
this._setGridMode(0);
|
||||
},
|
||||
};
|
||||
|
||||
const IconGridLayoutCommon = {
|
||||
_findBestIconSize() {
|
||||
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||
const nColumns = this.columnsPerPage;
|
||||
const nRows = this.rowsPerPage;
|
||||
const columnSpacingPerPage = opt.APP_GRID_SPACING * (nColumns - 1);
|
||||
const rowSpacingPerPage = opt.APP_GRID_SPACING * (nRows - 1);
|
||||
const iconPadding = 53 * scaleFactor;
|
||||
|
||||
const paddingH = this._isFolder ? this.pagePadding.left + this.pagePadding.right : 0;
|
||||
const paddingV = this._isFolder ? this.pagePadding.top + this.pagePadding.bottom : 0;
|
||||
|
||||
const width = this._gridWidth ? this._gridWidth : this._pageWidth;
|
||||
const height = this._gridHeight ? this._gridHeight : this._pageHeight;
|
||||
if (!width || !height)
|
||||
return opt.APP_GRID_ICON_SIZE_DEFAULT;
|
||||
|
||||
const [firstItem] = this._container;
|
||||
|
||||
if (this.fixedIconSize !== -1)
|
||||
return this.fixedIconSize;
|
||||
|
||||
/* if (opt.APP_GRID_ADAPTIVE && !this._isFolder)
|
||||
return opt.APP_GRID_ICON_SIZE_DEFAULT;*/
|
||||
|
||||
let iconSizes = Object.values(IconSize).sort((a, b) => b - a);
|
||||
|
||||
// limit max icon size for folders, the whole range is for the main grid with active folders
|
||||
if (this._isFolder)
|
||||
iconSizes = iconSizes.slice(iconSizes.indexOf(IconSize.LARGE), -1);
|
||||
|
||||
let sizeInvalid = false;
|
||||
for (const size of iconSizes) {
|
||||
let usedWidth, usedHeight;
|
||||
|
||||
if (firstItem) {
|
||||
firstItem.icon.setIconSize(size);
|
||||
const [firstItemWidth, firstItemHeight] =
|
||||
firstItem.get_preferred_size();
|
||||
|
||||
const itemSize = Math.max(firstItemWidth, firstItemHeight);
|
||||
if (itemSize < size)
|
||||
sizeInvalid = true;
|
||||
|
||||
usedWidth = itemSize * nColumns;
|
||||
usedHeight = itemSize * nRows;
|
||||
}
|
||||
|
||||
if (!firstItem || sizeInvalid) {
|
||||
usedWidth = (size + iconPadding) * nColumns;
|
||||
usedHeight = (size + iconPadding) * nRows;
|
||||
}
|
||||
const emptyHSpace =
|
||||
width - usedWidth - columnSpacingPerPage - paddingH;
|
||||
// this.pagePadding.left - this.pagePadding.right;
|
||||
const emptyVSpace =
|
||||
height - usedHeight - rowSpacingPerPage - paddingV;
|
||||
// this.pagePadding.top - this.pagePadding.bottom;
|
||||
|
||||
if (emptyHSpace >= 0 && emptyVSpace >= 0) {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
return IconSize.TINY;
|
||||
},
|
||||
|
||||
removeItem(item) {
|
||||
if (!this._items.has(item)) {
|
||||
log(`Item ${item} is not part of the IconGridLayout`);
|
||||
return;
|
||||
// throw new Error(`Item ${item} is not part of the IconGridLayout`);
|
||||
}
|
||||
|
||||
if (!this._container)
|
||||
return;
|
||||
|
||||
this._shouldEaseItems = true;
|
||||
|
||||
this._container.remove_child(item);
|
||||
this._removeItemData(item);
|
||||
},
|
||||
|
||||
addItem(item, page = -1, index = -1) {
|
||||
if (this._items.has(item)) {
|
||||
log(`iconGrid: Item ${item} already added to IconGridLayout`);
|
||||
return;
|
||||
// throw new Error(`Item ${item} already added to IconGridLayout`);
|
||||
}
|
||||
|
||||
if (page > this._pages.length) {
|
||||
log(`iconGrid: Cannot add ${item} to page ${page}`);
|
||||
page = -1;
|
||||
index = -1;
|
||||
// throw new Error(`Cannot add ${item} to page ${page}`);
|
||||
}
|
||||
|
||||
if (!this._container)
|
||||
return;
|
||||
|
||||
if (page !== -1 && index === -1)
|
||||
page = this._findBestPageToAppend(page);
|
||||
|
||||
this._shouldEaseItems = true;
|
||||
this._container.add_child(item);
|
||||
this._addItemToPage(item, page, index);
|
||||
},
|
||||
|
||||
moveItem(item, newPage, newPosition) {
|
||||
if (!this._items.has(item)) {
|
||||
log(`iconGrid: Item ${item} is not part of the IconGridLayout`);
|
||||
return;
|
||||
// throw new Error(`Item ${item} is not part of the IconGridLayout`);
|
||||
}
|
||||
|
||||
this._shouldEaseItems = true;
|
||||
|
||||
this._removeItemData(item);
|
||||
|
||||
if (newPage !== -1 && newPosition === -1)
|
||||
newPage = this._findBestPageToAppend(newPage);
|
||||
this._addItemToPage(item, newPage, newPosition);
|
||||
},
|
||||
|
||||
_addItemToPage(item, pageIndex, index) {
|
||||
// Ensure we have at least one page
|
||||
if (this._pages.length === 0)
|
||||
this._appendPage();
|
||||
|
||||
// Append a new page if necessary
|
||||
if (pageIndex === this._pages.length)
|
||||
this._appendPage();
|
||||
|
||||
if (pageIndex >= this._pages.length) {
|
||||
pageIndex = -1;
|
||||
index = -1;
|
||||
}
|
||||
|
||||
if (pageIndex === -1)
|
||||
pageIndex = this._pages.length - 1;
|
||||
|
||||
if (index === -1)
|
||||
index = this._pages[pageIndex].children.length;
|
||||
|
||||
this._items.set(item, {
|
||||
actor: item,
|
||||
pageIndex,
|
||||
destroyId: item.connect('destroy', () => this._removeItemData(item)),
|
||||
visibleId: item.connect('notify::visible', () => {
|
||||
const itemData = this._items.get(item);
|
||||
|
||||
this._updateVisibleChildrenForPage(itemData.pageIndex);
|
||||
|
||||
if (item.visible)
|
||||
this._relocateSurplusItems(itemData.pageIndex);
|
||||
else if (!this.allowIncompletePages)
|
||||
this._fillItemVacancies(itemData.pageIndex);
|
||||
}),
|
||||
queueRelayoutId: item.connect('queue-relayout', () => {
|
||||
this._childrenMaxSize = -1;
|
||||
}),
|
||||
});
|
||||
|
||||
item.icon.setIconSize(this._iconSize);
|
||||
this._pages[pageIndex].children.splice(index, 0, item);
|
||||
this._updateVisibleChildrenForPage(pageIndex);
|
||||
this._relocateSurplusItems(pageIndex);
|
||||
},
|
||||
|
||||
_findBestPageToAppend(startPage) {
|
||||
const itemsPerPage = this.columnsPerPage * this.rowsPerPage;
|
||||
|
||||
for (let i = startPage; i < this._pages.length; i++) {
|
||||
const visibleItems = this._pages[i].visibleChildren;
|
||||
|
||||
if (visibleItems.length < itemsPerPage)
|
||||
return i;
|
||||
}
|
||||
|
||||
return this._pages.length;
|
||||
},
|
||||
};
|
380
extensions/vertical-workspaces/lib/layout.js
Normal file
|
@ -0,0 +1,380 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* layout.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Meta, GLib, Shell, Clutter, GObject } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Layout = imports.ui.layout;
|
||||
const Ripples = imports.ui.ripples;
|
||||
const DND = imports.ui.dnd;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let _overrides;
|
||||
let _timeouts;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
let _originalUpdateHotCorners;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('layoutModule', true);
|
||||
const conflict = _Util.getEnabledExtensions('custom-hot-corners').length ||
|
||||
_Util.getEnabledExtensions('dash-to-panel').length;
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled or in conflict
|
||||
if (_firstRun && (reset || conflict))
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (!_originalUpdateHotCorners)
|
||||
_originalUpdateHotCorners = Layout.LayoutManager.prototype._updateHotCorners;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
if (_timeouts) {
|
||||
Object.values(_timeouts).forEach(t => {
|
||||
if (t)
|
||||
GLib.source_remove(t);
|
||||
});
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
_timeouts = null;
|
||||
Main.layoutManager._updateHotCorners = _originalUpdateHotCorners;
|
||||
Main.layoutManager._updateHotCorners();
|
||||
return;
|
||||
}
|
||||
|
||||
_timeouts = {};
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
_overrides.addOverride('LayoutManager', Layout.LayoutManager.prototype, LayoutManagerCommon);
|
||||
|
||||
Main.layoutManager._updateHotCorners = LayoutManagerCommon._updateHotCorners.bind(Main.layoutManager);
|
||||
|
||||
Main.layoutManager._updatePanelBarrier();
|
||||
Main.layoutManager._updateHotCorners();
|
||||
}
|
||||
|
||||
const LayoutManagerCommon = {
|
||||
_updatePanelBarrier() {
|
||||
if (this._rightPanelBarrier) {
|
||||
this._rightPanelBarrier.destroy();
|
||||
this._rightPanelBarrier = null;
|
||||
}
|
||||
|
||||
if (this._leftPanelBarrier) {
|
||||
this._leftPanelBarrier.destroy();
|
||||
this._leftPanelBarrier = null;
|
||||
}
|
||||
|
||||
if (!this.primaryMonitor || !opt)
|
||||
return;
|
||||
|
||||
if (this.panelBox.height) {
|
||||
let primary = this.primaryMonitor;
|
||||
if ([0, 1, 3].includes(opt.HOT_CORNER_POSITION)) {
|
||||
this._rightPanelBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: primary.x + primary.width, y1: this.panelBox.allocation.y1,
|
||||
x2: primary.x + primary.width, y2: this.panelBox.allocation.y2,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_X,
|
||||
});
|
||||
}
|
||||
|
||||
if ([2, 4].includes(opt.HOT_CORNER_POSITION)) {
|
||||
this._leftPanelBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: primary.x, y1: this.panelBox.allocation.y1,
|
||||
x2: primary.x, y2: this.panelBox.allocation.y2,
|
||||
directions: Meta.BarrierDirection.POSITIVE_X,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_updateHotCorners() {
|
||||
// avoid errors if called from foreign override
|
||||
if (!opt)
|
||||
return;
|
||||
// destroy old hot corners
|
||||
this.hotCorners.forEach(corner => corner?.destroy());
|
||||
this.hotCorners = [];
|
||||
|
||||
if (!this._interfaceSettings.get_boolean('enable-hot-corners')) {
|
||||
this.emit('hot-corners-changed');
|
||||
return;
|
||||
}
|
||||
|
||||
let size = this.panelBox.height;
|
||||
|
||||
// position 0 - default, 1-TL, 2-TR, 3-BL, 4-BR
|
||||
const position = opt.HOT_CORNER_POSITION;
|
||||
|
||||
// build new hot corners
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
let monitor = this.monitors[i];
|
||||
let cornerX, cornerY;
|
||||
|
||||
if (position === 0) {
|
||||
cornerX = this._rtl ? monitor.x + monitor.width : monitor.x;
|
||||
cornerY = monitor.y;
|
||||
} else if (position === 1) {
|
||||
cornerX = monitor.x;
|
||||
cornerY = monitor.y;
|
||||
} else if (position === 2) {
|
||||
cornerX = monitor.x + monitor.width;
|
||||
cornerY = monitor.y;
|
||||
} else if (position === 3) {
|
||||
cornerX = monitor.x;
|
||||
cornerY = monitor.y + monitor.height;
|
||||
} else {
|
||||
cornerX = monitor.x + monitor.width;
|
||||
cornerY = monitor.y + monitor.height;
|
||||
}
|
||||
|
||||
let haveCorner = true;
|
||||
|
||||
if (i !== this.primaryIndex) {
|
||||
// Check if we have a top left (right for RTL) corner.
|
||||
// I.e. if there is no monitor directly above or to the left(right)
|
||||
let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
|
||||
let besideY = cornerY;
|
||||
let aboveX = cornerX;
|
||||
let aboveY = cornerY - 1;
|
||||
|
||||
for (let j = 0; j < this.monitors.length; j++) {
|
||||
if (i === j)
|
||||
continue;
|
||||
let otherMonitor = this.monitors[j];
|
||||
if (besideX >= otherMonitor.x &&
|
||||
besideX < otherMonitor.x + otherMonitor.width &&
|
||||
besideY >= otherMonitor.y &&
|
||||
besideY < otherMonitor.y + otherMonitor.height) {
|
||||
haveCorner = false;
|
||||
break;
|
||||
}
|
||||
if (aboveX >= otherMonitor.x &&
|
||||
aboveX < otherMonitor.x + otherMonitor.width &&
|
||||
aboveY >= otherMonitor.y &&
|
||||
aboveY < otherMonitor.y + otherMonitor.height) {
|
||||
haveCorner = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (haveCorner) {
|
||||
let corner = new HotCorner(this, monitor, cornerX, cornerY);
|
||||
corner.setBarrierSize(size);
|
||||
this.hotCorners.push(corner);
|
||||
} else {
|
||||
this.hotCorners.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
this.emit('hot-corners-changed');
|
||||
},
|
||||
};
|
||||
|
||||
var HotCorner = GObject.registerClass(
|
||||
class HotCorner extends Layout.HotCorner {
|
||||
_init(layoutManager, monitor, x, y) {
|
||||
super._init(layoutManager, monitor, x, y);
|
||||
|
||||
let angle = 0;
|
||||
switch (opt.HOT_CORNER_POSITION) {
|
||||
case 2:
|
||||
angle = 90;
|
||||
break;
|
||||
case 3:
|
||||
angle = 270;
|
||||
break;
|
||||
case 4:
|
||||
angle = 180;
|
||||
break;
|
||||
}
|
||||
|
||||
this._ripples._ripple1.rotation_angle_z = angle;
|
||||
this._ripples._ripple2.rotation_angle_z = angle;
|
||||
this._ripples._ripple3.rotation_angle_z = angle;
|
||||
}
|
||||
|
||||
setBarrierSize(size) {
|
||||
if (this._verticalBarrier) {
|
||||
this._pressureBarrier.removeBarrier(this._verticalBarrier);
|
||||
this._verticalBarrier.destroy();
|
||||
this._verticalBarrier = null;
|
||||
}
|
||||
|
||||
if (this._horizontalBarrier) {
|
||||
this._pressureBarrier.removeBarrier(this._horizontalBarrier);
|
||||
this._horizontalBarrier.destroy();
|
||||
this._horizontalBarrier = null;
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
const primaryMonitor = global.display.get_primary_monitor();
|
||||
const monitor = this._monitor;
|
||||
const extendV = opt && opt.HOT_CORNER_EDGE && opt.DASH_VERTICAL && monitor.index === primaryMonitor;
|
||||
const extendH = opt && opt.HOT_CORNER_EDGE && !opt.DASH_VERTICAL && monitor.index === primaryMonitor;
|
||||
|
||||
if (opt.HOT_CORNER_POSITION <= 1) {
|
||||
this._verticalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x, y1: this._y, y2: this._y + (extendV ? monitor.height : size),
|
||||
directions: Meta.BarrierDirection.POSITIVE_X,
|
||||
});
|
||||
this._horizontalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x + (extendH ? monitor.width : size), y1: this._y, y2: this._y,
|
||||
directions: Meta.BarrierDirection.POSITIVE_Y,
|
||||
});
|
||||
} else if (opt.HOT_CORNER_POSITION === 2) {
|
||||
this._verticalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x, y1: this._y, y2: this._y + (extendV ? monitor.height : size),
|
||||
directions: Meta.BarrierDirection.NEGATIVE_X,
|
||||
});
|
||||
this._horizontalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x - size, x2: this._x, y1: this._y, y2: this._y,
|
||||
directions: Meta.BarrierDirection.POSITIVE_Y,
|
||||
});
|
||||
} else if (opt.HOT_CORNER_POSITION === 3) {
|
||||
this._verticalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x, y1: this._y, y2: this._y - size,
|
||||
directions: Meta.BarrierDirection.POSITIVE_X,
|
||||
});
|
||||
this._horizontalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x + (extendH ? monitor.width : size), y1: this._y, y2: this._y,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_Y,
|
||||
});
|
||||
} else if (opt.HOT_CORNER_POSITION === 4) {
|
||||
this._verticalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x, y1: this._y, y2: this._y - size,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_X,
|
||||
});
|
||||
this._horizontalBarrier = new Meta.Barrier({
|
||||
display: global.display,
|
||||
x1: this._x, x2: this._x - size, y1: this._y, y2: this._y,
|
||||
directions: Meta.BarrierDirection.NEGATIVE_Y,
|
||||
});
|
||||
}
|
||||
|
||||
this._pressureBarrier.addBarrier(this._verticalBarrier);
|
||||
this._pressureBarrier.addBarrier(this._horizontalBarrier);
|
||||
}
|
||||
}
|
||||
|
||||
_toggleOverview() {
|
||||
if (!opt.HOT_CORNER_ACTION || (!opt.HOT_CORNER_FULLSCREEN && this._monitor.inFullscreen && !Main.overview.visible))
|
||||
return;
|
||||
|
||||
if (Main.overview.shouldToggleByCornerOrButton()) {
|
||||
if ((opt.HOT_CORNER_ACTION === 1 && !_Util.isCtrlPressed()) || (opt.HOT_CORNER_ACTION === 2 && _Util.isCtrlPressed()))
|
||||
this._toggleWindowPicker(true);
|
||||
else if ((opt.HOT_CORNER_ACTION === 2 && !_Util.isCtrlPressed()) || (opt.HOT_CORNER_ACTION === 1 && _Util.isCtrlPressed()) || (opt.HOT_CORNER_ACTION === 3 && _Util.isCtrlPressed()))
|
||||
this._toggleApplications(true);
|
||||
else if (opt.HOT_CORNER_ACTION === 3 && !_Util.isCtrlPressed())
|
||||
this._toggleWindowSearchProvider();
|
||||
if (opt.HOT_CORNER_RIPPLES && Main.overview.animationInProgress)
|
||||
this._ripples.playAnimation(this._x, this._y);
|
||||
}
|
||||
}
|
||||
|
||||
_toggleWindowPicker(leaveOverview = false) {
|
||||
if (Main.overview._shown && (leaveOverview || !Main.overview.dash.showAppsButton.checked)) {
|
||||
Main.overview.hide();
|
||||
} else if (Main.overview.dash.showAppsButton.checked) {
|
||||
Main.overview.dash.showAppsButton.checked = false;
|
||||
} else {
|
||||
const focusWindow = global.display.get_focus_window();
|
||||
// at least GS 42 is unable to show overview in X11 session if VirtualBox Machine window grabbed keyboard
|
||||
if (!Meta.is_wayland_compositor() && focusWindow && focusWindow.wm_class.includes('VirtualBox Machine')) {
|
||||
// following should help when windowed VBox Machine has focus.
|
||||
global.stage.set_key_focus(Main.panel);
|
||||
// key focus doesn't take the effect immediately, we must wait for it
|
||||
// still looking for better solution!
|
||||
_timeouts.releaseKeyboardTimeoutId = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
// delay cannot be too short
|
||||
200,
|
||||
() => {
|
||||
Main.overview.show();
|
||||
|
||||
_timeouts.releaseKeyboardTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Main.overview.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_toggleApplications(leaveOverview = false) {
|
||||
if ((leaveOverview && Main.overview._shown) || Main.overview.dash.showAppsButton.checked) {
|
||||
Main.overview.hide();
|
||||
} else {
|
||||
const focusWindow = global.display.get_focus_window();
|
||||
// at least GS 42 is unable to show overview in X11 session if VirtualBox Machine window grabbed keyboard
|
||||
if (!Meta.is_wayland_compositor() && focusWindow && focusWindow.wm_class.includes('VirtualBox Machine')) {
|
||||
// following should help when windowed VBox Machine has focus.
|
||||
global.stage.set_key_focus(Main.panel);
|
||||
// key focus doesn't take the effect immediately, we must wait for it
|
||||
// still looking for better solution!
|
||||
_timeouts.releaseKeyboardTimeoutId = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
// delay cannot be too short
|
||||
200,
|
||||
() => {
|
||||
Main.overview.show(2);
|
||||
|
||||
_timeouts.releaseKeyboardTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
);
|
||||
} else if (Main.overview._shown) {
|
||||
Main.overview.dash.showAppsButton.checked = true;
|
||||
} else {
|
||||
Main.overview.show(2); // 2 for App Grid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_toggleWindowSearchProvider() {
|
||||
if (!Main.overview._overview._controls._searchController._searchActive) {
|
||||
this._toggleWindowPicker();
|
||||
const prefix = 'wq// ';
|
||||
const position = prefix.length;
|
||||
const searchEntry = Main.overview.searchEntry;
|
||||
searchEntry.set_text(prefix);
|
||||
// searchEntry.grab_key_focus();
|
||||
searchEntry.get_first_child().set_cursor_position(position);
|
||||
searchEntry.get_first_child().set_selection(position, position);
|
||||
} else {
|
||||
// Main.overview.searchEntry.text = '';
|
||||
Main.overview.hide();
|
||||
}
|
||||
}
|
||||
});
|
67
extensions/vertical-workspaces/lib/messageTray.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* messageTray.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Clutter } = imports.gi;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Main = imports.ui.main;
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('messageTrayModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (reset) {
|
||||
opt = null;
|
||||
setNotificationPosition(1);
|
||||
return;
|
||||
}
|
||||
|
||||
setNotificationPosition(opt.NOTIFICATION_POSITION);
|
||||
}
|
||||
|
||||
function setNotificationPosition(position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.START;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.START;
|
||||
break;
|
||||
case 1:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.CENTER;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.START;
|
||||
break;
|
||||
case 2:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.END;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.START;
|
||||
break;
|
||||
case 3:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.START;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.END;
|
||||
break;
|
||||
case 4:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.CENTER;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.END;
|
||||
break;
|
||||
case 5:
|
||||
Main.messageTray._bannerBin.x_align = Clutter.ActorAlign.END;
|
||||
Main.messageTray._bannerBin.y_align = Clutter.ActorAlign.END;
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* optionsFactory.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -13,16 +13,25 @@ const { Gtk, Gio, GObject } = imports.gi;
|
|||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Settings = Me.imports.settings;
|
||||
const Settings = Me.imports.lib.settings;
|
||||
|
||||
const shellVersion = Settings.shellVersion;
|
||||
|
||||
// gettext
|
||||
const _ = Settings._;
|
||||
|
||||
const ProfileNames = [
|
||||
_('GNOME 3'),
|
||||
_('GNOME 40+ - Bottom Hot Edge'),
|
||||
_('Hot Corner Centric - Top Left Hot Corner'),
|
||||
_('Dock Overview - Bottom Hot Edge'),
|
||||
];
|
||||
|
||||
// libadwaita is available starting with GNOME Shell 42.
|
||||
let Adw = null;
|
||||
try { Adw = imports.gi.Adw; } catch (e) {}
|
||||
try {
|
||||
Adw = imports.gi.Adw;
|
||||
} catch (e) {}
|
||||
|
||||
function _newImageFromIconName(name) {
|
||||
return Gtk.Image.new_from_icon_name(name);
|
||||
|
@ -35,7 +44,6 @@ var ItemFactory = class ItemFactory {
|
|||
}
|
||||
|
||||
getRowWidget(text, caption, widget, variable, options = []) {
|
||||
|
||||
let item = [];
|
||||
let label;
|
||||
if (widget) {
|
||||
|
@ -55,9 +63,9 @@ var ItemFactory = class ItemFactory {
|
|||
const captionLabel = new Gtk.Label({
|
||||
halign: Gtk.Align.START,
|
||||
wrap: true,
|
||||
/*width_chars: 80,*/
|
||||
xalign: 0
|
||||
})
|
||||
/* width_chars: 80, */
|
||||
xalign: 0,
|
||||
});
|
||||
const context = captionLabel.get_style_context();
|
||||
context.add_class('dim-label');
|
||||
context.add_class('caption');
|
||||
|
@ -79,25 +87,24 @@ var ItemFactory = class ItemFactory {
|
|||
}
|
||||
|
||||
if (widget) {
|
||||
if (widget._is_switch) {
|
||||
if (widget._isSwitch)
|
||||
this._connectSwitch(widget, key, variable);
|
||||
} else if (widget._is_spinbutton || widget._is_scale) {
|
||||
else if (widget._isSpinButton || widget._isScale)
|
||||
this._connectSpinButton(widget, key, variable);
|
||||
} else if (widget._is_combo_box) {
|
||||
else if (widget._isComboBox)
|
||||
this._connectComboBox(widget, key, variable, options);
|
||||
} else if (widget._is_drop_down) {
|
||||
else if (widget._isDropDown)
|
||||
this._connectDropDown(widget, key, variable, options);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
_connectSwitch(widget, key, variable) {
|
||||
_connectSwitch(widget, key /* , variable */) {
|
||||
this._settings.bind(key, widget, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
|
||||
_connectSpinButton(widget, key, variable) {
|
||||
_connectSpinButton(widget, key /* , variable */) {
|
||||
this._settings.bind(key, widget.adjustment, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
|
||||
|
@ -108,9 +115,9 @@ var ItemFactory = class ItemFactory {
|
|||
for (const [label, value] of options) {
|
||||
let iter;
|
||||
model.set(iter = model.append(), [0, 1], [label, value]);
|
||||
if (value === currentValue) {
|
||||
if (value === currentValue)
|
||||
widget.set_active_iter(iter);
|
||||
}
|
||||
|
||||
widget._comboMap[value] = iter;
|
||||
}
|
||||
this._gOptions.connect(`changed::${key}`, () => {
|
||||
|
@ -119,7 +126,8 @@ var ItemFactory = class ItemFactory {
|
|||
widget.connect('changed', () => {
|
||||
const [success, iter] = widget.get_active_iter();
|
||||
|
||||
if (!success) return;
|
||||
if (!success)
|
||||
return;
|
||||
|
||||
this._gOptions.set(variable, model.get_value(iter, 1));
|
||||
});
|
||||
|
@ -132,23 +140,22 @@ var ItemFactory = class ItemFactory {
|
|||
const text = options[i][0];
|
||||
const id = options[i][1];
|
||||
model.append(new DropDownItem({ text, id }));
|
||||
if (id === currentValue) {
|
||||
if (id === currentValue)
|
||||
widget.set_selected(i);
|
||||
}
|
||||
}
|
||||
|
||||
const factory = new Gtk.SignalListItemFactory();
|
||||
factory.connect("setup", (factory, list_item) => {
|
||||
const label = new Gtk.Label({xalign: 0});
|
||||
list_item.set_child(label);
|
||||
factory.connect('setup', (fact, listItem) => {
|
||||
const label = new Gtk.Label({ xalign: 0 });
|
||||
listItem.set_child(label);
|
||||
});
|
||||
factory.connect("bind", (factory, list_item) => {
|
||||
const label = list_item.get_child();
|
||||
const item = list_item.get_item();
|
||||
factory.connect('bind', (fact, listItem) => {
|
||||
const label = listItem.get_child();
|
||||
const item = listItem.get_item();
|
||||
label.set_text(item.text);
|
||||
});
|
||||
|
||||
widget.connect("notify::selected-item", (dropDown) => {
|
||||
widget.connect('notify::selected-item', dropDown => {
|
||||
const item = dropDown.get_selected_item();
|
||||
this._gOptions.set(variable, item.id);
|
||||
});
|
||||
|
@ -157,10 +164,9 @@ var ItemFactory = class ItemFactory {
|
|||
const newId = this._gOptions.get(variable, true);
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
const id = options[i][1];
|
||||
if (id === newId) {
|
||||
if (id === newId)
|
||||
widget.set_selected(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
widget.set_factory(factory);
|
||||
|
@ -172,7 +178,7 @@ var ItemFactory = class ItemFactory {
|
|||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
});
|
||||
sw._is_switch = true;
|
||||
sw._isSwitch = true;
|
||||
return sw;
|
||||
}
|
||||
|
||||
|
@ -185,7 +191,7 @@ var ItemFactory = class ItemFactory {
|
|||
xalign: 0.5,
|
||||
});
|
||||
spinButton.set_adjustment(adjustment);
|
||||
spinButton._is_spinbutton = true;
|
||||
spinButton._isSpinButton = true;
|
||||
return spinButton;
|
||||
}
|
||||
|
||||
|
@ -201,20 +207,20 @@ var ItemFactory = class ItemFactory {
|
|||
const renderer = new Gtk.CellRendererText();
|
||||
comboBox.pack_start(renderer, true);
|
||||
comboBox.add_attribute(renderer, 'text', 0);
|
||||
comboBox._is_combo_box = true;
|
||||
comboBox._isComboBox = true;
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
newDropDown() {
|
||||
const dropDown = new Gtk.DropDown({
|
||||
model: new Gio.ListStore({
|
||||
item_type: DropDownItem
|
||||
item_type: DropDownItem,
|
||||
}),
|
||||
halign: Gtk.Align.END,
|
||||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
});
|
||||
dropDown._is_drop_down = true;
|
||||
dropDown._isDropDown = true;
|
||||
return dropDown;
|
||||
}
|
||||
|
||||
|
@ -232,7 +238,7 @@ var ItemFactory = class ItemFactory {
|
|||
});
|
||||
scale.set_size_request(300, -1);
|
||||
scale.set_adjustment(adjustment);
|
||||
scale._is_scale = true;
|
||||
scale._isScale = true;
|
||||
return scale;
|
||||
}
|
||||
|
||||
|
@ -258,13 +264,95 @@ var ItemFactory = class ItemFactory {
|
|||
return linkBtn;
|
||||
}
|
||||
|
||||
newResetButton(callback) {
|
||||
newButton() {
|
||||
const btn = new Gtk.Button({
|
||||
halign: Gtk.Align.END,
|
||||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
});
|
||||
|
||||
btn._activatable = true;
|
||||
return btn;
|
||||
}
|
||||
|
||||
newPresetButton(opt, profileIndex) {
|
||||
const load = opt.loadProfile.bind(opt);
|
||||
const save = opt.storeProfile.bind(opt);
|
||||
const reset = opt.resetProfile.bind(opt);
|
||||
|
||||
const box = new Gtk.Box({
|
||||
halign: Gtk.Align.END,
|
||||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
spacing: 8,
|
||||
});
|
||||
box.is_profile_box = true;
|
||||
|
||||
const entry = new Gtk.Entry({
|
||||
width_chars: 40,
|
||||
halign: Gtk.Align.END,
|
||||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
xalign: 0,
|
||||
});
|
||||
entry.set_text(opt.get(`profileName${profileIndex}`));
|
||||
entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, 'edit-clear-symbolic');
|
||||
entry.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, true);
|
||||
entry.connect('icon-press', e => e.set_text(''));
|
||||
entry.connect('changed', e => opt.set(`profileName${profileIndex}`, e.get_text()));
|
||||
|
||||
const resetProfile = this.newButton();
|
||||
resetProfile.set({
|
||||
tooltip_text: _('Reset profile to defaults'),
|
||||
icon_name: 'edit-delete-symbolic',
|
||||
hexpand: false,
|
||||
css_classes: ['destructive-action'],
|
||||
icon_name: 'view-refresh-symbolic'
|
||||
});
|
||||
|
||||
function setName() {
|
||||
let name = opt.get(`profileName${profileIndex}`, true);
|
||||
if (!name)
|
||||
name = ProfileNames[profileIndex - 1];
|
||||
entry.set_text(name);
|
||||
}
|
||||
|
||||
setName();
|
||||
resetProfile.connect('clicked', () => {
|
||||
reset(profileIndex);
|
||||
setName();
|
||||
});
|
||||
resetProfile._activatable = false;
|
||||
|
||||
const loadProfile = this.newButton();
|
||||
loadProfile.set({
|
||||
tooltip_text: _('Load profile'),
|
||||
icon_name: 'view-refresh-symbolic',
|
||||
hexpand: false,
|
||||
});
|
||||
loadProfile.connect('clicked', () => load(profileIndex));
|
||||
loadProfile._activatable = false;
|
||||
|
||||
const saveProfile = this.newButton();
|
||||
saveProfile.set({
|
||||
tooltip_text: _('Save current settings into this profile'),
|
||||
icon_name: 'document-save-symbolic',
|
||||
hexpand: false,
|
||||
});
|
||||
saveProfile.connect('clicked', () => save(profileIndex));
|
||||
saveProfile._activatable = false;
|
||||
|
||||
box.append(resetProfile);
|
||||
box.append(entry);
|
||||
box.append(saveProfile);
|
||||
box.append(loadProfile);
|
||||
return box;
|
||||
}
|
||||
|
||||
newResetButton(callback) {
|
||||
const btn = this.newButton();
|
||||
btn.set({
|
||||
css_classes: ['destructive-action'],
|
||||
icon_name: 'edit-delete-symbolic',
|
||||
});
|
||||
|
||||
btn.connect('clicked', callback);
|
||||
|
@ -278,7 +366,7 @@ var ItemFactory = class ItemFactory {
|
|||
valign: Gtk.Align.CENTER,
|
||||
hexpand: true,
|
||||
css_classes: ['destructive-action'],
|
||||
icon_name: 'view-refresh-symbolic'
|
||||
icon_name: 'edit-delete-symbolic',
|
||||
});
|
||||
|
||||
btn.connect('clicked', () => {
|
||||
|
@ -290,7 +378,7 @@ var ItemFactory = class ItemFactory {
|
|||
btn._activatable = false;
|
||||
return btn;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var AdwPrefs = class {
|
||||
constructor(gOptions) {
|
||||
|
@ -300,13 +388,13 @@ var AdwPrefs = class {
|
|||
getFilledWindow(window, pages) {
|
||||
for (let page of pages) {
|
||||
const title = page.title;
|
||||
const icon_name = page.iconName;
|
||||
const iconName = page.iconName;
|
||||
const optionList = page.optionList;
|
||||
|
||||
window.add(
|
||||
this._getAdwPage(optionList, {
|
||||
title,
|
||||
icon_name
|
||||
icon_name: iconName,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -326,13 +414,13 @@ var AdwPrefs = class {
|
|||
const option = item[0];
|
||||
const widget = item[1];
|
||||
if (!widget) {
|
||||
if (group) {
|
||||
if (group)
|
||||
page.add(group);
|
||||
}
|
||||
|
||||
group = new Adw.PreferencesGroup({
|
||||
title: option,
|
||||
hexpand: true,
|
||||
width_request: 700
|
||||
width_request: 700,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
@ -349,25 +437,25 @@ var AdwPrefs = class {
|
|||
margin_top: 8,
|
||||
margin_bottom: 8,
|
||||
hexpand: true,
|
||||
})
|
||||
/*for (let i of item) {
|
||||
});
|
||||
/* for (let i of item) {
|
||||
box.append(i);*/
|
||||
grid.attach(option, 0, 0, 1, 1);
|
||||
if (widget) {
|
||||
if (widget)
|
||||
grid.attach(widget, 1, 0, 1, 1);
|
||||
}
|
||||
|
||||
row.set_child(grid);
|
||||
if (widget._activatable === false) {
|
||||
if (widget._activatable === false)
|
||||
row.activatable = false;
|
||||
} else {
|
||||
else
|
||||
row.activatable_widget = widget;
|
||||
}
|
||||
|
||||
group.add(row);
|
||||
}
|
||||
page.add(group);
|
||||
return page;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var LegacyPrefs = class {
|
||||
constructor(gOptions) {
|
||||
|
@ -376,14 +464,14 @@ var LegacyPrefs = class {
|
|||
|
||||
getPrefsWidget(pages) {
|
||||
const prefsWidget = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
});
|
||||
const stack = new Gtk.Stack({
|
||||
hexpand: true
|
||||
hexpand: true,
|
||||
});
|
||||
const stackSwitcher = new Gtk.StackSwitcher({
|
||||
halign: Gtk.Align.CENTER,
|
||||
hexpand: true
|
||||
hexpand: true,
|
||||
});
|
||||
|
||||
const context = stackSwitcher.get_style_context();
|
||||
|
@ -398,7 +486,7 @@ var LegacyPrefs = class {
|
|||
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
|
||||
vexpand: true,
|
||||
hexpand: true,
|
||||
visible: true
|
||||
visible: true,
|
||||
};
|
||||
|
||||
const pagesBtns = [];
|
||||
|
@ -411,13 +499,13 @@ var LegacyPrefs = class {
|
|||
|
||||
stack.add_named(this._getLegacyPage(optionList, pageProperties), name);
|
||||
pagesBtns.push(
|
||||
[new Gtk.Label({ label: title}), _newImageFromIconName(iconName, Gtk.IconSize.BUTTON)]
|
||||
[new Gtk.Label({ label: title }), _newImageFromIconName(iconName, Gtk.IconSize.BUTTON)]
|
||||
);
|
||||
}
|
||||
|
||||
let stBtn = stackSwitcher.get_first_child ? stackSwitcher.get_first_child() : null;
|
||||
for (let i = 0; i < pagesBtns.length; i++) {
|
||||
const box = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL, spacing: 6, visible: true});
|
||||
const box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, spacing: 6, visible: true });
|
||||
const icon = pagesBtns[i][1];
|
||||
icon.margin_start = 30;
|
||||
icon.margin_end = 30;
|
||||
|
@ -433,12 +521,15 @@ var LegacyPrefs = class {
|
|||
}
|
||||
}
|
||||
|
||||
stack.show_all && stack.show_all();
|
||||
stackSwitcher.show_all && stackSwitcher.show_all();
|
||||
if (stack.show_all)
|
||||
stack.show_all();
|
||||
if (stackSwitcher.show_all)
|
||||
stackSwitcher.show_all();
|
||||
|
||||
prefsWidget.append(stack);
|
||||
|
||||
prefsWidget.show_all && prefsWidget.show_all();
|
||||
if (prefsWidget.show_all)
|
||||
prefsWidget.show_all();
|
||||
|
||||
prefsWidget._stackSwitcher = stackSwitcher;
|
||||
|
||||
|
@ -457,7 +548,7 @@ var LegacyPrefs = class {
|
|||
margin_bottom: 12,
|
||||
});
|
||||
|
||||
const context = page.get_style_context();
|
||||
let context = page.get_style_context();
|
||||
context.add_class('background');
|
||||
|
||||
let frame;
|
||||
|
@ -472,20 +563,20 @@ var LegacyPrefs = class {
|
|||
const lbl = new Gtk.Label({
|
||||
label: option,
|
||||
xalign: 0,
|
||||
margin_bottom: 4
|
||||
margin_bottom: 4,
|
||||
});
|
||||
|
||||
const context = lbl.get_style_context();
|
||||
context = lbl.get_style_context();
|
||||
context.add_class('heading');
|
||||
|
||||
mainBox.append(lbl);
|
||||
|
||||
frame = new Gtk.Frame({
|
||||
margin_bottom: 16
|
||||
margin_bottom: 16,
|
||||
});
|
||||
|
||||
frameBox = new Gtk.ListBox({
|
||||
selection_mode: null
|
||||
selection_mode: null,
|
||||
});
|
||||
|
||||
mainBox.append(frame);
|
||||
|
@ -500,21 +591,21 @@ var LegacyPrefs = class {
|
|||
margin_end: 8,
|
||||
margin_top: 8,
|
||||
margin_bottom: 8,
|
||||
hexpand: true
|
||||
})
|
||||
hexpand: true,
|
||||
});
|
||||
|
||||
grid.attach(option, 0, 0, 5, 1);
|
||||
|
||||
if (widget) {
|
||||
if (widget)
|
||||
grid.attach(widget, 5, 0, 2, 1);
|
||||
}
|
||||
|
||||
frameBox.append(grid);
|
||||
}
|
||||
page.set_child(mainBox);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const DropDownItem = GObject.registerClass({
|
||||
GTypeName: 'DropdownItem',
|
||||
|
@ -538,6 +629,7 @@ const DropDownItem = GObject.registerClass({
|
|||
get text() {
|
||||
return this._text;
|
||||
}
|
||||
|
||||
set text(text) {
|
||||
this._text = text;
|
||||
}
|
||||
|
@ -545,6 +637,7 @@ const DropDownItem = GObject.registerClass({
|
|||
get id() {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
set id(id) {
|
||||
this._id = id;
|
||||
}
|
93
extensions/vertical-workspaces/lib/osdWindow.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* osdWindow.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Clutter } = imports.gi;
|
||||
const Main = imports.ui.main;
|
||||
const OsdWindow = imports.ui.osdWindow;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
const OsdPositions = {
|
||||
1: {
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.START,
|
||||
},
|
||||
2: {
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
y_align: Clutter.ActorAlign.START,
|
||||
},
|
||||
3: {
|
||||
x_align: Clutter.ActorAlign.END,
|
||||
y_align: Clutter.ActorAlign.START,
|
||||
},
|
||||
4: {
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
},
|
||||
5: {
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.END,
|
||||
},
|
||||
6: {
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
y_align: Clutter.ActorAlign.END,
|
||||
},
|
||||
7: {
|
||||
x_align: Clutter.ActorAlign.END,
|
||||
y_align: Clutter.ActorAlign.END,
|
||||
},
|
||||
};
|
||||
|
||||
let _overrides;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('osdWindowModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
if (reset || !moduleEnabled) {
|
||||
updateExistingOsdWindows(6);
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
_overrides.addOverride('osdWindow', OsdWindow.OsdWindow.prototype, OsdWindowCommon);
|
||||
}
|
||||
|
||||
function updateExistingOsdWindows(position) {
|
||||
position = position ? position : opt.OSD_POSITION;
|
||||
Main.osdWindowManager._osdWindows.forEach(osd => {
|
||||
osd.set(OsdPositions[position]);
|
||||
});
|
||||
}
|
||||
|
||||
const OsdWindowCommon = {
|
||||
after_show() {
|
||||
if (!opt.OSD_POSITION)
|
||||
this.opacity = 0;
|
||||
this.set(OsdPositions[opt.OSD_POSITION]);
|
||||
},
|
||||
};
|
108
extensions/vertical-workspaces/lib/overlayKey.js
Normal file
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* overlayKey.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const { GObject, Gio, GLib, Meta, St } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Overview = imports.ui.overview;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
const _ = Me.imports.lib.settings._;
|
||||
const shellVersion = _Util.shellVersion;
|
||||
const WIN_SEARCH_PREFIX = Me.imports.lib.windowSearchProvider.prefix;
|
||||
const RECENT_FILES_PREFIX = Me.imports.lib.recentFilesSearchProvider.prefix;
|
||||
const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
let _originalOverlayKeyHandlerId;
|
||||
let _overlayKeyHandlerId;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('overlayKeyModule', true);
|
||||
reset = reset || (!_firstRun && !moduleEnabled);
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && !moduleEnabled)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (reset) {
|
||||
_updateOverlayKey(reset);
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_updateOverlayKey();
|
||||
}
|
||||
|
||||
function _updateOverlayKey(reset = false) {
|
||||
if (reset) {
|
||||
_restoreOverlayKeyHandler();
|
||||
} else if (!_originalOverlayKeyHandlerId) {
|
||||
_originalOverlayKeyHandlerId = GObject.signal_handler_find(global.display, { signalId: 'overlay-key' });
|
||||
if (_originalOverlayKeyHandlerId !== null)
|
||||
global.display.block_signal_handler(_originalOverlayKeyHandlerId);
|
||||
_connectOverlayKey.bind(Main.overview._overview.controls)();
|
||||
}
|
||||
}
|
||||
|
||||
function _restoreOverlayKeyHandler() {
|
||||
// Disconnect modified overlay key handler
|
||||
if (_overlayKeyHandlerId !== null) {
|
||||
global.display.disconnect(_overlayKeyHandlerId);
|
||||
_overlayKeyHandlerId = null;
|
||||
}
|
||||
|
||||
// Unblock original overlay key handler
|
||||
if (_originalOverlayKeyHandlerId !== null) {
|
||||
global.display.unblock_signal_handler(_originalOverlayKeyHandlerId);
|
||||
_originalOverlayKeyHandlerId = null;
|
||||
}
|
||||
}
|
||||
|
||||
function _connectOverlayKey() {
|
||||
this._a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
|
||||
|
||||
this._lastOverlayKeyTime = 0;
|
||||
_overlayKeyHandlerId = global.display.connect('overlay-key', () => {
|
||||
if (this._a11ySettings.get_boolean('stickykeys-enable'))
|
||||
return;
|
||||
|
||||
const { initialState, finalState, transitioning } =
|
||||
this._stateAdjustment.getStateTransitionParams();
|
||||
|
||||
const time = GLib.get_monotonic_time() / 1000;
|
||||
const timeDiff = time - this._lastOverlayKeyTime;
|
||||
this._lastOverlayKeyTime = time;
|
||||
|
||||
const shouldShift = St.Settings.get().enable_animations
|
||||
? transitioning && finalState > initialState
|
||||
: Main.overview.visible && timeDiff < Overview.ANIMATION_TIME;
|
||||
|
||||
const mode = opt.OVERLAY_KEY_SECONDARY;
|
||||
if (shouldShift) {
|
||||
if (mode === 1)
|
||||
this._shiftState(Meta.MotionDirection.UP);
|
||||
else if (mode === 2)
|
||||
_Util.activateSearchProvider(WIN_SEARCH_PREFIX);
|
||||
else if (mode === 3)
|
||||
_Util.activateSearchProvider(RECENT_FILES_PREFIX);
|
||||
} else {
|
||||
Main.overview.toggle();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* overview.js
|
||||
*
|
||||
* panel barrier should follow panel position
|
||||
* or disable it to not collide with Custom Hot Corners barriers
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
|
@ -13,21 +10,18 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { Meta, Clutter } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Overview = imports.ui.overview;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let _overrides;
|
||||
let opt;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
|
@ -35,16 +29,14 @@ function update(reset = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('Overview', Overview.Overview.prototype, OverviewCommon);
|
||||
}
|
||||
|
||||
|
||||
const OverviewCommon = {
|
||||
_showDone: function() {
|
||||
_showDone() {
|
||||
this._animationInProgress = false;
|
||||
this._coverPane.hide();
|
||||
|
||||
|
@ -58,11 +50,10 @@ const OverviewCommon = {
|
|||
// if user activates overview during startup animation, transition needs to be shifted to the state 2 here
|
||||
const controls = this._overview._controls;
|
||||
if (controls._searchController._searchActive && controls._stateAdjustment.value === 1) {
|
||||
if (opt.SEARCH_VIEW_ANIMATION) {
|
||||
if (opt.SEARCH_VIEW_ANIMATION)
|
||||
controls._onSearchChanged();
|
||||
} else {
|
||||
else if (!opt.OVERVIEW_MODE2)
|
||||
controls._stateAdjustment.value = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* panel.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -10,85 +10,118 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GLib } = imports.gi;
|
||||
const Main = imports.ui.main;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
const ANIMATION_TIME = imports.ui.overview.ANIMATION_TIME;
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
let _showingOverviewConId;
|
||||
let _hidingOverviewConId;
|
||||
let _styleChangedConId;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.settings.opt;
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('panelModule', true);
|
||||
// Avoid conflict with other extensions
|
||||
const conflict = _Util.getEnabledExtensions('dash-to-panel').length ||
|
||||
_Util.getEnabledExtensions('hidetopbar').length;
|
||||
reset = reset || (!_firstRun && !moduleEnabled);
|
||||
|
||||
// don't even touch this module if disabled or in potential conflict
|
||||
if (_firstRun && (reset || conflict))
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
const panelBox = Main.layoutManager.panelBox;
|
||||
const panelHeight = Main.panel.height; // panelBox height can be 0 after shell start
|
||||
|
||||
const geometry = global.display.get_monitor_geometry(global.display.get_primary_monitor());
|
||||
if (reset || opt.PANEL_POSITION_TOP) {
|
||||
panelBox.set_position(geometry.x, geometry.y);
|
||||
} else {
|
||||
panelBox.set_position(geometry.x, geometry.y + geometry.height - panelHeight);
|
||||
}
|
||||
|
||||
if (!_styleChangedConId) {
|
||||
Main.panel.connect('style-changed', ()=> Main.panel.remove_style_pseudo_class('overview'));
|
||||
}
|
||||
|
||||
if (reset || opt.PANEL_MODE === 0) {
|
||||
//_disconnectPanel();
|
||||
_disconnectOverview()
|
||||
if (reset || !moduleEnabled) {
|
||||
// _disconnectPanel();
|
||||
reset = true;
|
||||
_setPanelPosition(reset);
|
||||
_updateOverviewConnection(reset);
|
||||
_reparentPanel(false);
|
||||
_showPanel();
|
||||
|
||||
if (_styleChangedConId) {
|
||||
Main.panel.disconnect(_styleChangedConId);
|
||||
_styleChangedConId = 0;
|
||||
}
|
||||
_updateStyleChangedConnection(reset);
|
||||
|
||||
panelBox.translation_y = 0;
|
||||
panelBox.opacity = 255;
|
||||
Main.panel.opacity = 255;
|
||||
_setPanelStructs(true);
|
||||
return;
|
||||
}
|
||||
|
||||
_setPanelPosition();
|
||||
_updateStyleChangedConnection();
|
||||
|
||||
if (opt.PANEL_MODE === 0) {
|
||||
_updateOverviewConnection(true);
|
||||
_reparentPanel(false);
|
||||
panelBox.translation_y = 0;
|
||||
Main.panel.opacity = 255;
|
||||
_setPanelStructs(true);
|
||||
} else if (opt.PANEL_MODE === 1) {
|
||||
if (opt.SHOW_WS_PREVIEW_BG) {
|
||||
_reparentPanel(true);
|
||||
if (opt.OVERVIEW_MODE2) {
|
||||
// in OM2 if the panel has been moved to the overviewGroup move panel above all
|
||||
Main.layoutManager.overviewGroup.set_child_above_sibling(panelBox, null);
|
||||
_updateOverviewConnection();
|
||||
} else {
|
||||
// otherwise move the panel below overviewGroup so it can get below workspacesDisplay
|
||||
Main.layoutManager.overviewGroup.set_child_below_sibling(panelBox, Main.overview._overview);
|
||||
_updateOverviewConnection(true);
|
||||
}
|
||||
_showPanel(true);
|
||||
} else {
|
||||
// if ws preview bg is disabled, panel can stay in uiGroup
|
||||
_reparentPanel(false);
|
||||
_showPanel(false);
|
||||
if (!_hidingOverviewConId)
|
||||
_hidingOverviewConId = Main.overview.connect('hiding', () => {
|
||||
if ((!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2)) {
|
||||
_showPanel(false);
|
||||
_updateOverviewConnection();
|
||||
}
|
||||
});
|
||||
if (!_showingOverviewConId)
|
||||
_showingOverviewConId = Main.overview.connect('showing', () => {
|
||||
if ((!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2)) {
|
||||
_showPanel(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_connectPanel();
|
||||
// _connectPanel();
|
||||
} else if (opt.PANEL_MODE === 2) {
|
||||
_disconnectOverview();
|
||||
_updateOverviewConnection(true);
|
||||
_reparentPanel(false);
|
||||
_showPanel(false);
|
||||
_connectPanel();
|
||||
// _connectPanel();
|
||||
}
|
||||
_setPanelStructs(reset || opt.PANEL_MODE === 0);
|
||||
_setPanelStructs(opt.PANEL_MODE === 0);
|
||||
Main.layoutManager._updateHotCorners();
|
||||
}
|
||||
|
||||
function _disconnectOverview() {
|
||||
function _setPanelPosition(reset = false) {
|
||||
const geometry = global.display.get_monitor_geometry(global.display.get_primary_monitor());
|
||||
const panelBox = Main.layoutManager.panelBox;
|
||||
const panelHeight = Main.panel.height; // panelBox height can be 0 after shell start
|
||||
|
||||
if (opt.PANEL_POSITION_TOP || reset)
|
||||
panelBox.set_position(geometry.x, geometry.y);
|
||||
else
|
||||
panelBox.set_position(geometry.x, geometry.y + geometry.height - panelHeight);
|
||||
}
|
||||
|
||||
function _updateStyleChangedConnection(reset = false) {
|
||||
if (reset) {
|
||||
if (_styleChangedConId) {
|
||||
Main.panel.disconnect(_styleChangedConId);
|
||||
_styleChangedConId = 0;
|
||||
}
|
||||
} else if (!_styleChangedConId) {
|
||||
Main.panel.connect('style-changed', () => {
|
||||
if (opt.PANEL_MODE === 1)
|
||||
Main.panel.add_style_pseudo_class('overview');
|
||||
else if (opt.OVERVIEW_MODE2)
|
||||
Main.panel.remove_style_pseudo_class('overview');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function _updateOverviewConnection(reset = false) {
|
||||
if (reset) {
|
||||
if (_hidingOverviewConId) {
|
||||
Main.overview.disconnect(_hidingOverviewConId);
|
||||
_hidingOverviewConId = 0;
|
||||
|
@ -97,6 +130,20 @@ function _disconnectOverview() {
|
|||
Main.overview.disconnect(_showingOverviewConId);
|
||||
_showingOverviewConId = 0;
|
||||
}
|
||||
} else {
|
||||
if (!_hidingOverviewConId) {
|
||||
_hidingOverviewConId = Main.overview.connect('hiding', () => {
|
||||
if (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2)
|
||||
_showPanel(false);
|
||||
});
|
||||
}
|
||||
if (!_showingOverviewConId) {
|
||||
_showingOverviewConId = Main.overview.connect('showing', () => {
|
||||
if (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2 || Main.layoutManager.panelBox.translation_y)
|
||||
_showPanel(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _reparentPanel(reparent = false) {
|
||||
|
@ -106,7 +153,7 @@ function _reparentPanel(reparent = false) {
|
|||
Main.layoutManager.overviewGroup.add_child(panel);
|
||||
} else if (!reparent && panel.get_parent() === Main.layoutManager.overviewGroup) {
|
||||
Main.layoutManager.overviewGroup.remove_child(panel);
|
||||
// return the panel at default position, pane shouldn't cover objects that should be above
|
||||
// return the panel at default position, panel shouldn't cover objects that should be above
|
||||
Main.layoutManager.uiGroup.insert_child_at_index(panel, 4);
|
||||
}
|
||||
}
|
||||
|
@ -120,10 +167,10 @@ function _setPanelStructs(state) {
|
|||
// workaround to force maximized windows to resize after removing affectsStruts
|
||||
// simulation of minimal swipe gesture to the opposite direction
|
||||
// todo - needs better solution!!!!!!!!!!!
|
||||
/*const direction = _getAppGridAnimationDirection() === 2 ? 1 : -1;
|
||||
Main.overview._swipeTracker._beginTouchSwipe(null, global.get_current_time(), 1, 1);
|
||||
Main.overview._swipeTracker._updateGesture(null, global.get_current_time(), direction, 1);
|
||||
GLib.timeout_add(0, 50, () => Main.overview._swipeTracker._endGesture(global.get_current_time(), 1, true));*/
|
||||
// const direction = _getAppGridAnimationDirection() === 2 ? 1 : -1;
|
||||
// Main.overview._swipeTracker._beginTouchSwipe(null, global.get_current_time(), 1, 1);
|
||||
// Main.overview._swipeTracker._updateGesture(null, global.get_current_time(), direction, 1);
|
||||
// GLib.timeout_add(0, 50, () => Main.overview._swipeTracker._endGesture(global.get_current_time(), 1, true));*/
|
||||
}
|
||||
|
||||
function _showPanel(show = true) {
|
||||
|
@ -134,9 +181,8 @@ function _showPanel(show = true) {
|
|||
translation_y: 0,
|
||||
onComplete: () => {
|
||||
_setPanelStructs(opt.PANEL_MODE === 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
} else {
|
||||
const panelHeight = Main.panel.height;
|
||||
Main.layoutManager.panelBox.ease({
|
||||
|
@ -145,34 +191,7 @@ function _showPanel(show = true) {
|
|||
onComplete: () => {
|
||||
Main.panel.opacity = 0;
|
||||
_setPanelStructs(opt.PANEL_MODE === 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function _connectPanel() {
|
||||
// not reliable, disabled for now
|
||||
/*if (!_panelEnterSigId) {
|
||||
_panelEnterSigId = Main.panel.connect('enter-event', () => {
|
||||
if (!Main.overview._shown)
|
||||
_showPanel(true);
|
||||
});
|
||||
}
|
||||
if (!_panelLeaveSigId) {
|
||||
_panelLeaveSigId = Main.panel.connect('leave-event', () => {
|
||||
if (!Main.overview._shown)
|
||||
_showPanel(false);
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
function _disconnectPanel() {
|
||||
/*if (_panelEnterSigId) {
|
||||
Main.panel.disconnect(_panelEnterSigId);
|
||||
_panelEnterSigId = 0;
|
||||
}
|
||||
if (_panelLeaveSigId) {
|
||||
Main.panel.disconnect(_panelLeaveSigId);
|
||||
_panelLeaveSigId = 0;
|
||||
}*/
|
||||
}
|
|
@ -9,13 +9,16 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GLib, GObject, Gio, Gtk, Meta, St, Shell } = imports.gi;
|
||||
const { GLib, Gio, Meta, St, Shell, Gtk } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Settings = Me.imports.settings;
|
||||
const _ = Me.imports.settings._;
|
||||
const Settings = Me.imports.lib.settings;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
// gettext
|
||||
const _ = Settings._;
|
||||
|
||||
const shellVersion = Settings.shellVersion;
|
||||
|
||||
|
@ -31,24 +34,13 @@ var prefix = 'fq//';
|
|||
|
||||
var opt;
|
||||
|
||||
const Action = {
|
||||
NONE: 0,
|
||||
CLOSE: 1,
|
||||
CLOSE_ALL: 2,
|
||||
MOVE_TO_WS: 3,
|
||||
MOVE_ALL_TO_WS: 4
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
|
||||
function getOverviewSearchResult() {
|
||||
return Main.overview._overview.controls._searchController._searchResults;
|
||||
}
|
||||
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.settings.opt;
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
if (!reset && opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED && !recentFilesSearchProvider) {
|
||||
enable();
|
||||
} else if (reset || !opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED) {
|
||||
|
@ -63,7 +55,7 @@ function enable() {
|
|||
GLib.PRIORITY_DEFAULT,
|
||||
2000,
|
||||
() => {
|
||||
if (recentFilesSearchProvider == null) {
|
||||
if (!recentFilesSearchProvider) {
|
||||
recentFilesSearchProvider = new RecentFilesSearchProvider(opt);
|
||||
getOverviewSearchResult()._registerProvider(recentFilesSearchProvider);
|
||||
}
|
||||
|
@ -84,58 +76,6 @@ function disable() {
|
|||
}
|
||||
}
|
||||
|
||||
function fuzzyMatch(term, text) {
|
||||
let pos = -1;
|
||||
const matches = [];
|
||||
// convert all accented chars to their basic form and to lower case
|
||||
const _text = text;//.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
const _term = term.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
|
||||
// if term matches the substring exactly, gains the highest weight
|
||||
if (_text.includes(_term)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (let i = 0; i < _term.length; i++) {
|
||||
let c = _term[i];
|
||||
let p;
|
||||
if (pos > 0)
|
||||
p = _term[i - 1];
|
||||
while (true) {
|
||||
pos += 1;
|
||||
if (pos >= _text.length) {
|
||||
return -1;
|
||||
}
|
||||
if (_text[pos] == c) {
|
||||
matches.push(pos);
|
||||
break;
|
||||
} else if (_text[pos] == p) {
|
||||
matches.pop();
|
||||
matches.push(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add all position to get a weight of the result
|
||||
// results closer to the beginning of the text and term characters closer to each other will gain more weight.
|
||||
return matches.reduce((r, p) => r + p) - matches.length * matches[0] + matches[0];
|
||||
}
|
||||
|
||||
function strictMatch(term, text) {
|
||||
// remove diacritics and accents from letters
|
||||
let s = text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
let p = term.toLowerCase();
|
||||
let ps = p.split(/ +/);
|
||||
|
||||
// allows to use multiple exact patterns separated by a space in arbitrary order
|
||||
for (let w of ps) { // escape regex control chars
|
||||
if (!s.match(w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function makeResult(window, i) {
|
||||
const app = Shell.WindowTracker.get_default().get_window_app(window);
|
||||
const appName = app ? app.get_name() : 'Unknown';
|
||||
|
@ -146,10 +86,10 @@ function makeResult(window, i) {
|
|||
'id': i,
|
||||
// convert all accented chars to their basic form and lower case for search
|
||||
'name': `${wsIndex + 1}: ${windowTitle} ${appName}`.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase(),
|
||||
'appName': appName,
|
||||
'windowTitle': windowTitle,
|
||||
'window': window
|
||||
}
|
||||
appName,
|
||||
windowTitle,
|
||||
window,
|
||||
};
|
||||
}
|
||||
|
||||
const closeSelectedRegex = /^\/x!$/;
|
||||
|
@ -157,22 +97,22 @@ const closeAllResultsRegex = /^\/xa!$/;
|
|||
const moveToWsRegex = /^\/m[0-9]+$/;
|
||||
const moveAllToWsRegex = /^\/ma[0-9]+$/;
|
||||
|
||||
var RecentFilesSearchProvider = class RecentFilesSearchProvider {
|
||||
constructor(gOptions) {
|
||||
this._gOptions = gOptions;
|
||||
const RecentFilesSearchProvider = class RecentFilesSearchProvider {
|
||||
constructor() {
|
||||
this.id = 'org.gnome.Nautilus.desktop';
|
||||
this.appInfo = Gio.AppInfo.create_from_commandline('/usr/bin/nautilus -ws recent:///', 'Recent Files', null);
|
||||
//this.appInfo = Shell.AppSystem.get_default().lookup_app('org.gnome.Nautilus.desktop').appInfo;
|
||||
// this.appInfo = Shell.AppSystem.get_default().lookup_app('org.gnome.Nautilus.desktop').appInfo;
|
||||
this.appInfo.get_description = () => _('Search recent files');
|
||||
this.appInfo.get_name = () => _('Recent Files');
|
||||
this.appInfo.get_id = () => 'org.gnome.Nautilus.desktop';
|
||||
this.appInfo.get_id = () => this.id;
|
||||
this.appInfo.get_icon = () => Gio.icon_new_for_string('document-open-recent-symbolic');
|
||||
this.appInfo.should_show = () => true;
|
||||
this.title = _('Recent Files Search Provider'),
|
||||
|
||||
this.canLaunchSearch = true;
|
||||
this.isRemoteProvider = false;
|
||||
}
|
||||
|
||||
_getResultSet (terms) {
|
||||
_getResultSet(terms) {
|
||||
if (!terms[0].startsWith(prefix))
|
||||
return [];
|
||||
// do not modify original terms
|
||||
|
@ -182,54 +122,53 @@ var RecentFilesSearchProvider = class RecentFilesSearchProvider {
|
|||
|
||||
const candidates = this.files;
|
||||
const _terms = [].concat(termsCopy);
|
||||
let match;
|
||||
// let match;
|
||||
|
||||
const term = _terms.join(' ');
|
||||
match = (s) => {
|
||||
/* match = s => {
|
||||
return fuzzyMatch(term, s);
|
||||
}
|
||||
}; */
|
||||
|
||||
const results = [];
|
||||
let m;
|
||||
for (let id in candidates) {
|
||||
const file = this.files[id];
|
||||
const name = `${file.get_age()}d: ${file.get_display_name()} ${file.get_uri_display().replace(`\/${file.get_display_name()}`, '')}`;
|
||||
if (this._gOptions.get('searchFuzzy')) {
|
||||
m = fuzzyMatch(term, name);
|
||||
} else {
|
||||
m = strictMatch(term, name);
|
||||
}
|
||||
if (m !== -1) {
|
||||
results.push({ weight: m, id: id});
|
||||
}
|
||||
const name = `${file.get_age()}d: ${file.get_display_name()} ${file.get_uri_display().replace(`/${file.get_display_name()}`, '')}`;
|
||||
if (opt.SEARCH_FUZZY)
|
||||
m = _Util.fuzzyMatch(term, name);
|
||||
else
|
||||
m = _Util.strictMatch(term, name);
|
||||
|
||||
if (m !== -1)
|
||||
results.push({ weight: m, id });
|
||||
}
|
||||
|
||||
results.sort((a, b) => this.files[a.id].get_visited() < this.files[b.id].get_visited());
|
||||
|
||||
this.resultIds = results.map((item) => item.id);
|
||||
this.resultIds = results.map(item => item.id);
|
||||
return this.resultIds;
|
||||
}
|
||||
|
||||
getResultMetas (resultIds, callback = null) {
|
||||
const metas = resultIds.map((id) => this.getResultMeta(id));
|
||||
if (shellVersion >= 43) {
|
||||
getResultMetas(resultIds, callback = null) {
|
||||
const metas = resultIds.map(id => this.getResultMeta(id));
|
||||
if (shellVersion >= 43)
|
||||
return new Promise(resolve => resolve(metas));
|
||||
} else {
|
||||
else if (callback)
|
||||
callback(metas);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getResultMeta (resultId) {
|
||||
getResultMeta(resultId) {
|
||||
const result = this.files[resultId];
|
||||
return {
|
||||
'id': resultId,
|
||||
'name': `${result.get_age()}: ${result.get_display_name()}`,
|
||||
'description': `${result.get_uri_display().replace(`\/${result.get_display_name()}`, '')}`,
|
||||
'createIcon': (size) => {
|
||||
'description': `${result.get_uri_display().replace(`/${result.get_display_name()}`, '')}`,
|
||||
'createIcon': size => {
|
||||
let icon = this.getIcon(result, size);
|
||||
return icon;
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getIcon(result, size) {
|
||||
|
@ -249,17 +188,17 @@ var RecentFilesSearchProvider = class RecentFilesSearchProvider {
|
|||
gicon = appInfo.get_icon();
|
||||
}
|
||||
|
||||
if (gicon) {
|
||||
if (gicon)
|
||||
icon = new St.Icon({ gicon, icon_size: size });
|
||||
} else {
|
||||
else
|
||||
icon = new St.Icon({ icon_name: 'icon-missing', icon_size: size });
|
||||
}
|
||||
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
launchSearch(terms, timeStamp) {
|
||||
this._openNautilus('recent:///')
|
||||
launchSearch(/* terms, timeStamp */) {
|
||||
this._openNautilus('recent:///');
|
||||
}
|
||||
|
||||
_openNautilus(uri) {
|
||||
|
@ -270,55 +209,52 @@ var RecentFilesSearchProvider = class RecentFilesSearchProvider {
|
|||
}
|
||||
}
|
||||
|
||||
activateResult (resultId, terms, timeStamp) {
|
||||
activateResult(resultId /* , terms, timeStamp */) {
|
||||
const file = this.files[resultId];
|
||||
|
||||
const [,,state] = global.get_pointer();
|
||||
//const isCtrlPressed = (state & ModifierType.CONTROL_MASK) != 0;
|
||||
const isShiftPressed = (state & ModifierType.SHIFT_MASK) != 0;
|
||||
|
||||
if (isShiftPressed) {
|
||||
if (_Util.isShiftPressed()) {
|
||||
Main.overview.toggle();
|
||||
this._openNautilus(file.get_uri());
|
||||
} else {
|
||||
const appInfo = Gio.AppInfo.get_default_for_type(file.get_mime_type(), false);
|
||||
if (!(appInfo && appInfo.launch_uris([file.get_uri()], null))) {
|
||||
if (!(appInfo && appInfo.launch_uris([file.get_uri()], null)))
|
||||
this._openNautilus(file.get_uri());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getInitialResultSet (terms, callback, cancellable = null) {
|
||||
if (shellVersion >=43) {
|
||||
cancellable = callback;
|
||||
}
|
||||
getInitialResultSet(terms, callback /* , cancellable = null*/) {
|
||||
// In GS 43 callback arg has been removed
|
||||
/* if (shellVersion >= 43)
|
||||
cancellable = callback; */
|
||||
|
||||
const filesDict = {};
|
||||
const files = Gtk.RecentManager.get_default().get_items().filter((f)=> f.exists());
|
||||
const files = Gtk.RecentManager.get_default().get_items().filter(f => f.exists());
|
||||
|
||||
for (let file of files) {
|
||||
for (let file of files)
|
||||
filesDict[file.get_uri()] = file;
|
||||
}
|
||||
|
||||
|
||||
this.files = filesDict;
|
||||
|
||||
if (shellVersion >= 43) {
|
||||
if (shellVersion >= 43)
|
||||
return new Promise(resolve => resolve(this._getResultSet(terms)));
|
||||
} else {
|
||||
else
|
||||
callback(this._getResultSet(terms));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
filterResults (results, maxResults) {
|
||||
return results.slice(0, maxResults);
|
||||
filterResults(results, maxResults) {
|
||||
return results.slice(0, 20);
|
||||
// return results.slice(0, maxResults);
|
||||
}
|
||||
|
||||
getSubsearchResultSet (previousResults, terms, callback, cancellable) {
|
||||
getSubsearchResultSet(previousResults, terms, callback /* , cancellable*/) {
|
||||
// if we return previous results, quick typers get non-actual results
|
||||
callback(this._getResultSet(terms));
|
||||
}
|
||||
|
||||
createResultOjbect(resultMeta) {
|
||||
/* createResultObject(resultMeta) {
|
||||
return this.files[resultMeta.id];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
};
|
206
extensions/vertical-workspaces/lib/search.js
Normal file
|
@ -0,0 +1,206 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* search.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const { Shell, Gio, St, Clutter } = imports.gi;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const AppDisplay = imports.ui.appDisplay;
|
||||
const Search = imports.ui.search;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
const _ = Me.imports.lib.settings._;
|
||||
const shellVersion = _Util.shellVersion;
|
||||
|
||||
let opt;
|
||||
let _overrides;
|
||||
let _firstRun = true;
|
||||
|
||||
let SEARCH_MAX_WIDTH;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('searchModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
_updateSearchViewWidth(reset);
|
||||
|
||||
if (reset) {
|
||||
Main.overview._overview._controls.layoutManager._searchController.y_align = Clutter.ActorAlign.FILL;
|
||||
opt = null;
|
||||
_overrides = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('AppSearchProvider', AppDisplay.AppSearchProvider.prototype, AppSearchProvider);
|
||||
_overrides.addOverride('SearchResult', Search.SearchResult.prototype, SearchResult);
|
||||
_overrides.addOverride('SearchResultsView', Search.SearchResultsView.prototype, SearchResultsView);
|
||||
|
||||
// Don't expand the search view vertically and align it to the top
|
||||
// this is important in the static workspace mode when the search view bg is not transparent
|
||||
// also the "Searching..." and "No Results" notifications will be closer to the search entry, with the distance given by margin-top in the stylesheet
|
||||
Main.overview._overview._controls.layoutManager._searchController.y_align = Clutter.ActorAlign.START;
|
||||
}
|
||||
|
||||
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;`);
|
||||
}
|
||||
}
|
||||
|
||||
// AppDisplay.AppSearchProvider
|
||||
const AppSearchProvider = {
|
||||
getInitialResultSet(terms, callback, _cancellable) {
|
||||
// Defer until the parental controls manager is initialized, so the
|
||||
// results can be filtered correctly.
|
||||
if (!this._parentalControlsManager.initialized) {
|
||||
let initializedId = this._parentalControlsManager.connect('app-filter-changed', () => {
|
||||
if (this._parentalControlsManager.initialized) {
|
||||
this._parentalControlsManager.disconnect(initializedId);
|
||||
this.getInitialResultSet(terms, callback, _cancellable);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const pattern = terms.join(' ');
|
||||
let appInfoList = Shell.AppSystem.get_default().get_installed();
|
||||
|
||||
let weightList = {};
|
||||
appInfoList = appInfoList.filter(appInfo => {
|
||||
try {
|
||||
appInfo.get_id(); // catch invalid file encodings
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let string = '';
|
||||
let name;
|
||||
let shouldShow = false;
|
||||
if (appInfo.get_display_name) {
|
||||
// show only launchers that should be visible in this DE
|
||||
shouldShow = appInfo.should_show() && this._parentalControlsManager.shouldShowApp(appInfo);
|
||||
|
||||
if (shouldShow) {
|
||||
let dispName = appInfo.get_display_name() || '';
|
||||
let gName = appInfo.get_generic_name() || '';
|
||||
let description = appInfo.get_description() || '';
|
||||
let categories = appInfo.get_string('Categories') || '';
|
||||
let keywords = appInfo.get_string('Keywords') || '';
|
||||
name = dispName;
|
||||
string = `${dispName} ${gName} ${description} ${categories} ${keywords}`;
|
||||
}
|
||||
}
|
||||
|
||||
let m = -1;
|
||||
if (shouldShow && opt.SEARCH_FUZZY) {
|
||||
m = _Util.fuzzyMatch(pattern, name);
|
||||
m = (m + _Util.strictMatch(pattern, string)) / 2;
|
||||
} else if (shouldShow) {
|
||||
m = _Util.strictMatch(pattern, string);
|
||||
}
|
||||
|
||||
if (m !== -1)
|
||||
weightList[appInfo.get_id()] = m;
|
||||
|
||||
return shouldShow && (m !== -1);
|
||||
});
|
||||
|
||||
appInfoList.sort((a, b) => weightList[a.get_id()] > weightList[b.get_id()]);
|
||||
|
||||
const usage = Shell.AppUsage.get_default();
|
||||
// sort apps by usage list
|
||||
appInfoList.sort((a, b) => usage.compare(a.get_id(), b.get_id()));
|
||||
// prefer apps where any word in their name starts with the pattern
|
||||
appInfoList.sort((a, b) => _Util.isMoreRelevant(a.get_display_name(), b.get_display_name(), pattern));
|
||||
|
||||
let results = appInfoList.map(app => app.get_id());
|
||||
|
||||
results = results.concat(this._systemActions.getMatchingActions(terms));
|
||||
|
||||
if (shellVersion < 43)
|
||||
callback(results);
|
||||
else
|
||||
return new Promise(resolve => resolve(results));
|
||||
},
|
||||
|
||||
// App search result size
|
||||
createResultObject(resultMeta) {
|
||||
if (resultMeta.id.endsWith('.desktop')) {
|
||||
const icon = new AppDisplay.AppIcon(this._appSys.lookup_app(resultMeta['id']), {
|
||||
expandTitleOnHover: false,
|
||||
});
|
||||
icon.icon.setIconSize(opt.SEARCH_ICON_SIZE);
|
||||
return icon;
|
||||
} else {
|
||||
const icon = new AppDisplay.SystemActionIcon(this, resultMeta);
|
||||
icon.icon._setSizeManually = true;
|
||||
icon.icon.setIconSize(opt.SEARCH_ICON_SIZE);
|
||||
return icon;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const SearchResult = {
|
||||
activate() {
|
||||
this.provider.activateResult(this.metaInfo.id, this._resultsView.terms);
|
||||
|
||||
if (this.metaInfo.clipboardText) {
|
||||
St.Clipboard.get_default().set_text(
|
||||
St.ClipboardType.CLIPBOARD, this.metaInfo.clipboardText);
|
||||
}
|
||||
// don't close overview if Shift key is pressed - Shift moves windows to the workspace
|
||||
if (!_Util.isShiftPressed())
|
||||
Main.overview.toggle();
|
||||
},
|
||||
};
|
||||
|
||||
const SearchResultsView = {
|
||||
_updateSearchProgress() {
|
||||
let haveResults = this._providers.some(provider => {
|
||||
let display = provider.display;
|
||||
return display.getFirstResult() !== null;
|
||||
});
|
||||
|
||||
this._scrollView.visible = haveResults;
|
||||
this._statusBin.visible = !haveResults;
|
||||
|
||||
if (!haveResults) {
|
||||
if (this.searchInProgress)
|
||||
this._statusText.set_text(_('Searching…'));
|
||||
else
|
||||
this._statusText.set_text(_('No results.'));
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* settings.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -11,10 +11,11 @@
|
|||
|
||||
const { GLib } = imports.gi;
|
||||
|
||||
const Config = imports.misc.config;
|
||||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
const Config = imports.misc.config;
|
||||
var shellVersion = parseFloat(Config.PACKAGE_VERSION);
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
|
||||
|
@ -24,7 +25,6 @@ const _schema = Me.metadata['settings-schema'];
|
|||
// common instance of Options accessible from all modules
|
||||
var opt;
|
||||
|
||||
|
||||
var Options = class Options {
|
||||
constructor() {
|
||||
this._gsettings = ExtensionUtils.getSettings(_schema);
|
||||
|
@ -37,7 +37,7 @@ var Options = class Options {
|
|||
|
||||
this._writeTimeoutId = GLib.timeout_add(
|
||||
GLib.PRIORITY_DEFAULT,
|
||||
100,
|
||||
400,
|
||||
() => {
|
||||
this._gsettings.apply();
|
||||
this._updateCachedSettings();
|
||||
|
@ -50,20 +50,25 @@ var Options = class Options {
|
|||
workspaceThumbnailsPosition: ['int', 'ws-thumbnails-position'],
|
||||
wsMaxSpacing: ['int', 'ws-max-spacing'],
|
||||
wsPreviewScale: ['int', 'ws-preview-scale'],
|
||||
WsThumbnailsFull: ['bool', 'ws-thumbnails-full'],
|
||||
secondaryWsThumbnailsPosition: ['int', 'secondary-ws-thumbnails-position'],
|
||||
secWsPreviewScale: ['int', 'secondary-ws-preview-scale'],
|
||||
secWsPreviewShift: ['bool', 'secondary-ws-preview-shift'],
|
||||
wsThumbnailsFull: ['bool', 'ws-thumbnails-full'],
|
||||
secWsThumbnailsPosition: ['int', 'secondary-ws-thumbnails-position'],
|
||||
dashPosition: ['int', 'dash-position'],
|
||||
dashPositionAdjust: ['int', 'dash-position-adjust'],
|
||||
wsTmbPositionAdjust: ['int', 'wst-position-adjust'],
|
||||
showWsTmbLabels: ['int', 'show-wst-labels'],
|
||||
showWsTmbLabelsOnHover: ['boolean', 'show-wst-labels-on-hover'],
|
||||
SecWsTmbPositionAdjust: ['int', 'sec-wst-position-adjust'],
|
||||
closeWsButtonMode: ['int', 'close-ws-button-mode'],
|
||||
secWsTmbPositionAdjust: ['int', 'sec-wst-position-adjust'],
|
||||
dashMaxIconSize: ['int', 'dash-max-icon-size'],
|
||||
dashShowWindowsIcon: ['int', 'dash-show-windows-icon'],
|
||||
dashShowRecentFilesIcon: ['int', 'dash-show-recent-files-icon'],
|
||||
centerDashToWs: ['boolean', 'center-dash-to-ws'],
|
||||
showAppsIconPosition: ['int', 'show-app-icon-position'],
|
||||
wsThumbnailScale: ['int', 'ws-thumbnail-scale'],
|
||||
wsThumbnailScaleAppGrid: ['int', 'ws-thumbnail-scale-appgrid'],
|
||||
secWsThumbnailScale: ['int', 'secondary-ws-thumbnail-scale'],
|
||||
showSearchEntry: ['boolean', 'show-search-entry'],
|
||||
centerSearch: ['boolean', 'center-search'],
|
||||
centerAppGrid: ['boolean', 'center-app-grid'],
|
||||
|
@ -72,7 +77,9 @@ var Options = class Options {
|
|||
enablePageShortcuts: ['boolean', 'enable-page-shortcuts'],
|
||||
showWsSwitcherBg: ['boolean', 'show-ws-switcher-bg'],
|
||||
showWsPreviewBg: ['boolean', 'show-ws-preview-bg'],
|
||||
wsPreviewBgRadius: ['int', 'ws-preview-bg-radius'],
|
||||
showBgInOverview: ['boolean', 'show-bg-in-overview'],
|
||||
overviewBgBrightness: ['int', 'overview-bg-brightness'],
|
||||
overviewBgBlurSigma: ['int', 'overview-bg-blur-sigma'],
|
||||
appGridBgBlurSigma: ['int', 'app-grid-bg-blur-sigma'],
|
||||
smoothBlurTransitions: ['boolean', 'smooth-blur-transitions'],
|
||||
|
@ -82,33 +89,78 @@ var Options = class Options {
|
|||
animationSpeedFactor: ['int', 'animation-speed-factor'],
|
||||
fixUbuntuDock: ['boolean', 'fix-ubuntu-dock'],
|
||||
winPreviewIconSize: ['int', 'win-preview-icon-size'],
|
||||
alwaysShowWinTitles: ['int', 'always-show-win-titles'],
|
||||
alwaysShowWinTitles: ['boolean', 'always-show-win-titles'],
|
||||
startupState: ['int', 'startup-state'],
|
||||
overviewMode: ['int', 'overview-mode'],
|
||||
workspaceSwitcherAnimation: ['int', 'workspace-switcher-animation'],
|
||||
searchIconSize: ['int', 'search-icon-size'],
|
||||
searchViewScale: ['int', 'search-width-scale'],
|
||||
appGridAllowCustom: ['int', 'app-grid-allow-custom'],
|
||||
appGridIconSize: ['int', 'app-grid-icon-size'],
|
||||
appGridColumns: ['int', 'app-grid-columns'],
|
||||
appGridRows: ['int', 'app-grid-rows'],
|
||||
appGridFolderIconSize: ['int', 'app-grid-folder-icon-size'],
|
||||
appGridFolderColumns: ['int', 'app-grid-folder-columns'],
|
||||
appGridFolderRows: ['int', 'app-grid-folder-rows'],
|
||||
appGridIncludeDash: ['int', 'app-grid-include-dash'],
|
||||
appGridFolderIconGrid: ['int', 'app-grid-folder-icon-grid'],
|
||||
appGridContent: ['int', 'app-grid-content'],
|
||||
appGridIncompletePages: ['boolean', 'app-grid-incomplete-pages'],
|
||||
appGridOrder: ['int', 'app-grid-order'],
|
||||
appGridNamesMode: ['int', 'app-grid-names'],
|
||||
appGridActivePreview: ['boolean', 'app-grid-active-preview'],
|
||||
appGridFolderCenter: ['boolean', 'app-grid-folder-center'],
|
||||
appGridPageWidthScale: ['int', 'app-grid-page-width-scale'],
|
||||
appGridSpacing: ['int', 'app-grid-spacing'],
|
||||
searchWindowsEnable: ['boolean', 'search-windows-enable'],
|
||||
searchRecentFilesEnable: ['boolean', 'search-recent-files-enable'],
|
||||
searchFuzzy: ['boolean', 'search-fuzzy'],
|
||||
searchMaxResultsRows: ['int', 'search-max-results-rows'],
|
||||
dashShowWindowsBeforeActivation: ['int', 'dash-show-windows-before-activation'],
|
||||
dashIconScroll: ['int', 'dash-icon-scroll'],
|
||||
searchWindowsIconScroll: ['int', 'search-windows-icon-scroll'],
|
||||
panelVisibility: ['int', 'panel-visibility'],
|
||||
panelPosition: ['int', 'panel-position'],
|
||||
}
|
||||
windowAttentionMode: ['int', 'window-attention-mode'],
|
||||
wsSwPopupHPosition: ['int', 'ws-sw-popup-h-position'],
|
||||
wsSwPopupVPosition: ['int', 'ws-sw-popup-v-position'],
|
||||
wsSwPopupMode: ['int', 'ws-sw-popup-mode'],
|
||||
favoritesNotify: ['int', 'favorites-notify'],
|
||||
notificationPosition: ['int', 'notification-position'],
|
||||
osdPosition: ['int', 'osd-position'],
|
||||
hotCornerAction: ['int', 'hot-corner-action'],
|
||||
hotCornerPosition: ['int', 'hot-corner-position'],
|
||||
hotCornerFullscreen: ['boolean', 'hot-corner-fullscreen'],
|
||||
hotCornerRipples: ['boolean', 'hot-corner-ripples'],
|
||||
alwaysActivateSelectedWindow: ['boolean', 'always-activate-selected-window'],
|
||||
windowIconClickSearch: ['boolean', 'window-icon-click-search'],
|
||||
overlayKeySecondary: ['int', 'overlay-key-secondary'],
|
||||
|
||||
workspaceThumbnailsModule: ['boolean', 'workspace-thumbnails-module'],
|
||||
workspaceSwitcherPopupModule: ['boolean', 'workspace-switcher-popup-module'],
|
||||
workspaceAnimationModule: ['boolean', 'workspace-animation-module'],
|
||||
workspaceModule: ['boolean', 'workspace-module'],
|
||||
windowManagerModule: ['boolean', 'window-manager-module'],
|
||||
windowPreviewModule: ['boolean', 'window-preview-module'],
|
||||
winAttentionHandlerModule: ['boolean', 'win-attention-handler-module'],
|
||||
swipeTrackerModule: ['boolean', 'swipe-tracker-module'],
|
||||
searchModule: ['boolean', 'search-module'],
|
||||
panelModule: ['boolean', 'panel-module'],
|
||||
overlayKeyModule: ['boolean', 'overlay-key-module'],
|
||||
osdWindowModule: ['boolean', 'osd-window-module'],
|
||||
messageTrayModule: ['boolean', 'message-tray-module'],
|
||||
layoutModule: ['boolean', 'layout-module'],
|
||||
dashModule: ['boolean', 'dash-module'],
|
||||
appFavoritesModule: ['boolean', 'app-favorites-module'],
|
||||
appDisplayModule: ['boolean', 'app-display-module'],
|
||||
|
||||
profileName1: ['string', 'profile-name-1'],
|
||||
profileName2: ['string', 'profile-name-2'],
|
||||
profileName3: ['string', 'profile-name-3'],
|
||||
profileName4: ['string', 'profile-name-4'],
|
||||
};
|
||||
this.cachedOptions = {};
|
||||
|
||||
this.shellVersion = shellVersion;
|
||||
// this.storeProfile(0);
|
||||
}
|
||||
|
||||
connect(name, callback) {
|
||||
|
@ -125,24 +177,24 @@ var Options = class Options {
|
|||
}
|
||||
}
|
||||
|
||||
_updateCachedSettings(settings, key) {
|
||||
_updateCachedSettings() {
|
||||
Object.keys(this.options).forEach(v => this.get(v, true));
|
||||
}
|
||||
|
||||
get(option, updateCache = false) {
|
||||
if (!this.options[option]) {
|
||||
log(`[${Me.metadata.name}] Error: Option ${option} is undefined.`);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (updateCache || this.cachedOptions[option] === undefined) {
|
||||
const [format, key, settings] = this.options[option];
|
||||
const [, key, settings] = this.options[option];
|
||||
let gSettings;
|
||||
if (settings !== undefined) {
|
||||
if (settings !== undefined)
|
||||
gSettings = settings();
|
||||
} else {
|
||||
else
|
||||
gSettings = this._gsettings;
|
||||
}
|
||||
|
||||
|
||||
this.cachedOptions[option] = gSettings.get_value(key).deep_unpack();
|
||||
}
|
||||
|
@ -155,9 +207,9 @@ var Options = class Options {
|
|||
|
||||
let gSettings = this._gsettings;
|
||||
|
||||
if (settings !== undefined) {
|
||||
if (settings !== undefined)
|
||||
gSettings = settings();
|
||||
}
|
||||
|
||||
|
||||
switch (format) {
|
||||
case 'boolean':
|
||||
|
@ -176,18 +228,53 @@ var Options = class Options {
|
|||
}
|
||||
|
||||
getDefault(option) {
|
||||
const [format, key, settings] = this.options[option];
|
||||
const [, key, settings] = this.options[option];
|
||||
|
||||
let gSettings = this._gsettings;
|
||||
|
||||
if (settings !== undefined) {
|
||||
if (settings !== undefined)
|
||||
gSettings = settings();
|
||||
}
|
||||
|
||||
|
||||
return gSettings.get_default_value(key).deep_unpack();
|
||||
}
|
||||
|
||||
_updateSettings(settings, key) {
|
||||
storeProfile(index) {
|
||||
const profile = {};
|
||||
Object.keys(this.options).forEach(v => {
|
||||
profile[v] = this.get(v).toString();
|
||||
});
|
||||
|
||||
this._gsettings.set_value(`profile-data-${index}`, new GLib.Variant('a{ss}', profile));
|
||||
}
|
||||
|
||||
loadProfile(index) {
|
||||
const options = this._gsettings.get_value(`profile-data-${index}`).deep_unpack();
|
||||
this._gsettings.set_boolean('aaa-loading-profile', !this._gsettings.get_boolean('aaa-loading-profile'));
|
||||
for (let o of Object.keys(options)) {
|
||||
const [type] = this.options[o];
|
||||
let value = options[o];
|
||||
switch (type) {
|
||||
case 'string':
|
||||
break;
|
||||
case 'boolean':
|
||||
value = value === 'true';
|
||||
break;
|
||||
case 'int':
|
||||
value = parseInt(value);
|
||||
break;
|
||||
}
|
||||
|
||||
this.set(o, value);
|
||||
}
|
||||
}
|
||||
|
||||
resetProfile(index) {
|
||||
this._gsettings.reset(`profile-data-${index}`);
|
||||
this._gsettings.reset(`profile-name-${index}`);
|
||||
}
|
||||
|
||||
_updateSettings() {
|
||||
this.DASH_POSITION = this.get('dashPosition', true);
|
||||
this.DASH_TOP = this.DASH_POSITION === 0;
|
||||
this.DASH_RIGHT = this.DASH_POSITION === 1;
|
||||
|
@ -197,6 +284,12 @@ var Options = class Options {
|
|||
this.DASH_VISIBLE = this.DASH_POSITION !== 4; // 4 - disable
|
||||
this.DASH_FOLLOW_RECENT_WIN = false;
|
||||
|
||||
this.DASH_CLICK_ACTION = this.get('dashShowWindowsBeforeActivation', true);
|
||||
this.DASH_ICON_SCROLL = this.get('dashIconScroll', true);
|
||||
this.DASH_SHIFT_CLICK_MV = true;
|
||||
|
||||
this.SEARCH_WINDOWS_ICON_SCROLL = this.get('searchWindowsIconScroll', true);
|
||||
|
||||
this.DASH_POSITION_ADJUSTMENT = this.get('dashPositionAdjust', true);
|
||||
this.DASH_POSITION_ADJUSTMENT = this.DASH_POSITION_ADJUSTMENT * -1 / 100; // range 1 to -1
|
||||
this.CENTER_DASH_WS = this.get('centerDashToWs', true);
|
||||
|
@ -208,34 +301,44 @@ var Options = class Options {
|
|||
this.WS_TMB_POSITION = this.get('workspaceThumbnailsPosition', true);
|
||||
this.ORIENTATION = this.WS_TMB_POSITION > 4 ? 0 : 1;
|
||||
this.WORKSPACE_MAX_SPACING = this.get('wsMaxSpacing', true);
|
||||
//ORIENTATION || DASH_LEFT || DASH_RIGHT ? 350 : 80;
|
||||
// ORIENTATION || DASH_LEFT || DASH_RIGHT ? 350 : 80;
|
||||
this.SHOW_WS_TMB = ![4, 9].includes(this.WS_TMB_POSITION); // 4, 9 - disable
|
||||
this.WS_TMB_FULL = this.get('WsThumbnailsFull', true);
|
||||
this.WS_TMB_FULL = this.get('wsThumbnailsFull', true);
|
||||
// translate ws tmb position to 0 top, 1 right, 2 bottom, 3 left
|
||||
//0L 1R, 2LF, 3RF, 4DV, 5T, 6B, 7TF, 8BF, 9DH
|
||||
// 0L 1R, 2LF, 3RF, 4DV, 5T, 6B, 7TF, 8BF, 9DH
|
||||
this.WS_TMB_POSITION = [3, 1, 3, 1, 4, 0, 2, 0, 2, 8][this.WS_TMB_POSITION];
|
||||
this.WS_TMB_TOP = this.WS_TMB_POSITION === 0;
|
||||
this.WS_TMB_RIGHT = this.WS_TMB_POSITION === 1;
|
||||
this.WS_TMB_BOTTOM = this.WS_TMB_POSITION === 2;
|
||||
this.WS_TMB_LEFT = this.WS_TMB_POSITION === 3;
|
||||
this.WS_TMB_POSITION_ADJUSTMENT = this.get('wsTmbPositionAdjust', true) * -1 / 100; // range 1 to -1
|
||||
this.SEC_WS_TMB_POSITION = this.get('secondaryWsThumbnailsPosition', true);
|
||||
this.SEC_WS_TMB_POSITION = this.get('secWsThumbnailsPosition', true);
|
||||
this.SHOW_SEC_WS_TMB = this.SEC_WS_TMB_POSITION !== 3 && this.SHOW_WS_TMB;
|
||||
this.SEC_WS_TMB_TOP = (this.SEC_WS_TMB_POSITION === 0 && !this.ORIENTATION) || (this.SEC_WS_TMB_POSITION === 2 && this.WS_TMB_TOP);
|
||||
this.SEC_WS_TMB_RIGHT = (this.SEC_WS_TMB_POSITION === 1 && this.ORIENTATION) || (this.SEC_WS_TMB_POSITION === 2 && this.WS_TMB_RIGHT);
|
||||
this.SEC_WS_TMB_BOTTOM = (this.SEC_WS_TMB_POSITION === 1 && !this.ORIENTATION) || (this.SEC_WS_TMB_POSITION === 2 && this.WS_TMB_BOTTOM);
|
||||
this.SEC_WS_TMB_LEFT = (this.SEC_WS_TMB_POSITION === 0 && this.ORIENTATION) || (this.SEC_WS_TMB_POSITION === 2 && this.WS_TMB_LEFT);
|
||||
|
||||
this.SEC_WS_TMB_POSITION_ADJUSTMENT = this.get('SecWsTmbPositionAdjust', true) * -1 / 100; // range 1 to -1
|
||||
this.SEC_WS_TMB_POSITION_ADJUSTMENT = this.get('secWsTmbPositionAdjust', true) * -1 / 100; // range 1 to -1
|
||||
this.SEC_WS_PREVIEW_SHIFT = this.get('secWsPreviewShift', true);
|
||||
this.SHOW_WST_LABELS = this.get('showWsTmbLabels', true);
|
||||
this.SHOW_WST_LABELS_ON_HOVER = this.get('showWsTmbLabelsOnHover', true);
|
||||
this.CLOSE_WS_BUTTON_MODE = this.get('closeWsButtonMode', true);
|
||||
|
||||
this.MAX_THUMBNAIL_SCALE = this.get('wsThumbnailScale', true) / 100;
|
||||
this.MAX_THUMBNAIL_SCALE_APPGRID = this.get('wsThumbnailScaleAppGrid', true) / 100;
|
||||
if (this.MAX_THUMBNAIL_SCALE_APPGRID === 0)
|
||||
this.MAX_THUMBNAIL_SCALE_APPGRID = this.MAX_THUMBNAIL_SCALE;
|
||||
this.MAX_THUMBNAIL_SCALE_STABLE = this.MAX_THUMBNAIL_SCALE === this.MAX_THUMBNAIL_SCALE_APPGRID;
|
||||
this.SEC_MAX_THUMBNAIL_SCALE = this.get('secWsThumbnailScale', true) / 100;
|
||||
|
||||
this.WS_PREVIEW_SCALE = this.get('wsPreviewScale', true) / 100;
|
||||
this.SEC_WS_PREVIEW_SCALE = this.get('secWsPreviewScale', true) / 100;
|
||||
// calculate number of possibly visible neighbor previews according to ws scale
|
||||
this.NUMBER_OF_VISIBLE_NEIGHBORS = Math.round(1 + (100 - this.WS_PREVIEW_SCALE) / 40);
|
||||
this.NUMBER_OF_VISIBLE_NEIGHBORS = Math.round(1 + (1 - this.WS_PREVIEW_SCALE) / 4);
|
||||
|
||||
this.SHOW_WS_TMB_BG = this.get('showWsSwitcherBg', true) && this.SHOW_WS_TMB;
|
||||
this.WS_PREVIEW_BG_RADIUS = this.get('wsPreviewBgRadius', true);
|
||||
this.SHOW_WS_PREVIEW_BG = this.get('showWsPreviewBg', true);
|
||||
|
||||
this.CENTER_APP_GRID = this.get('centerAppGrid', true);
|
||||
|
@ -243,13 +346,13 @@ var Options = class Options {
|
|||
this.SHOW_SEARCH_ENTRY = this.get('showSearchEntry', true);
|
||||
this.CENTER_SEARCH_VIEW = this.get('centerSearch', true);
|
||||
this.APP_GRID_ANIMATION = this.get('appGridAnimation', true);
|
||||
if (this.APP_GRID_ANIMATION === 4) {
|
||||
if (this.APP_GRID_ANIMATION === 4)
|
||||
this.APP_GRID_ANIMATION = this._getAnimationDirection();
|
||||
}
|
||||
|
||||
this.SEARCH_VIEW_ANIMATION = this.get('searchViewAnimation', true);
|
||||
if (this.SEARCH_VIEW_ANIMATION === 4) {
|
||||
if (this.SEARCH_VIEW_ANIMATION === 4)
|
||||
this.SEARCH_VIEW_ANIMATION = 3;
|
||||
}
|
||||
|
||||
this.WS_ANIMATION = this.get('workspaceAnimation', true);
|
||||
|
||||
this.WIN_PREVIEW_ICON_SIZE = [64, 48, 32, 22, 8][this.get('winPreviewIconSize', true)];
|
||||
|
@ -257,6 +360,7 @@ var Options = class Options {
|
|||
|
||||
this.STARTUP_STATE = this.get('startupState', true);
|
||||
this.SHOW_BG_IN_OVERVIEW = this.get('showBgInOverview', true);
|
||||
this.OVERVIEW_BG_BRIGHTNESS = this.get('overviewBgBrightness', true) / 100;
|
||||
this.OVERVIEW_BG_BLUR_SIGMA = this.get('overviewBgBlurSigma', true);
|
||||
this.APP_GRID_BG_BLUR_SIGMA = this.get('appGridBgBlurSigma', true);
|
||||
this.SMOOTH_BLUR_TRANSITIONS = this.get('smoothBlurTransitions', true);
|
||||
|
@ -264,47 +368,102 @@ var Options = class Options {
|
|||
this.OVERVIEW_MODE = this.get('overviewMode', true);
|
||||
this.OVERVIEW_MODE2 = this.OVERVIEW_MODE === 2;
|
||||
this.WORKSPACE_MODE = this.OVERVIEW_MODE ? 0 : 1;
|
||||
//Workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
|
||||
|
||||
this.STATIC_WS_SWITCHER_BG = this.get('workspaceSwitcherAnimation', true);
|
||||
|
||||
this.ANIMATION_TIME_FACTOR = this.get('animationSpeedFactor', true) / 100;
|
||||
//St.Settings.get().slow_down_factor = this.ANIMATION_TIME_FACTOR;
|
||||
|
||||
this.SEARCH_ICON_SIZE = this.get('searchIconSize', true);
|
||||
this.SEARCH_VIEW_SCALE = this.get('searchViewScale', true) / 100;
|
||||
this.SEARCH_MAX_ROWS = this.get('searchMaxResultsRows', true);
|
||||
//imports.ui.search.MAX_LIST_SEARCH_RESULTS_ROWS = this.SEARCH_MAX_ROWS;
|
||||
this.SEARCH_FUZZY = this.get('searchFuzzy', true);
|
||||
|
||||
this.APP_GRID_ALLOW_INCOMPLETE_PAGES = false;
|
||||
this.APP_GRID_ALLOW_CUSTOM = this.get('appGridAllowCustom', true);
|
||||
this.APP_GRID_ALLOW_INCOMPLETE_PAGES = this.get('appGridIncompletePages', true);
|
||||
this.APP_GRID_ICON_SIZE = this.get('appGridIconSize', true);
|
||||
this.APP_GRID_COLUMNS = this.get('appGridColumns', true);
|
||||
this.APP_GRID_ROWS = this.get('appGridRows', true);
|
||||
this.APP_GRID_ADAPTIVE = !this.APP_GRID_COLUMNS && !this.APP_GRID_ROWS;
|
||||
this.APP_GRID_ORDER = this.get('appGridOrder', true);
|
||||
this.APP_GRID_INCLUDE_DASH = this.get('appGridIncludeDash', true);
|
||||
|
||||
this.APP_GRID_INCLUDE_DASH = this.get('appGridContent', true);
|
||||
/* APP_GRID_INCLUDE_DASH
|
||||
0 - Include All
|
||||
1 - Include All - Favorites and Runnings First
|
||||
2 - Exclude Favorites (Default)
|
||||
3 - Exclude Running
|
||||
4 - Exclude Favorites and Running
|
||||
*/
|
||||
this.APP_GRID_EXCLUDE_FAVORITES = this.APP_GRID_INCLUDE_DASH === 2 || this.APP_GRID_INCLUDE_DASH === 4;
|
||||
this.APP_GRID_EXCLUDE_RUNNING = this.APP_GRID_INCLUDE_DASH === 3 || this.APP_GRID_INCLUDE_DASH === 4;
|
||||
this.APP_GRID_DASH_FIRST = this.APP_GRID_INCLUDE_DASH === 1;
|
||||
|
||||
this.APP_GRID_NAMES_MODE = this.get('appGridNamesMode', true);
|
||||
|
||||
this.APP_GRID_FOLDER_ICON_SIZE = this.get('appGridFolderIconSize', true);
|
||||
this.APP_GRID_FOLDER_ICON_GRID = this.get('appGridFolderIconGrid', true);
|
||||
this.APP_GRID_FOLDER_COLUMNS = this.get('appGridFolderColumns', true);
|
||||
this.APP_GRID_FOLDER_ROWS = this.get('appGridFolderRows', true);
|
||||
this.APP_GRID_SPACING = this.get('appGridSpacing', true);
|
||||
this.APP_GRID_FOLDER_DEFAULT = this.APP_GRID_FOLDER_ROWS === 3 && this.APP_GRID_FOLDER_COLUMNS === 3;
|
||||
this.APP_GRID_ACTIVE_PREVIEW = this.get('appGridActivePreview', true);
|
||||
this.APP_GRID_FOLDER_CENTER = this.get('appGridFolderCenter', true);
|
||||
this.APP_GRID_PAGE_WIDTH_SCALE = this.get('appGridPageWidthScale', true) / 100;
|
||||
|
||||
this.DASH_SHOW_WINS_BEFORE = this.get('dashShowWindowsBeforeActivation', true);
|
||||
this.DASH_SHIFT_CLICK_MV = true;
|
||||
this.APP_GRID_ICON_SIZE_DEFAULT = this.APP_GRID_ACTIVE_PREVIEW && !this.APP_GRID_ORDER ? 176 : 96;
|
||||
this.APP_GRID_FOLDER_ICON_SIZE_DEFAULT = 96;
|
||||
|
||||
this.WINDOW_SEARCH_PROVIDER_ENABLED = this.get('searchWindowsEnable', true);
|
||||
this.RECENT_FILES_SEARCH_PROVIDER_ENABLED = this.get('searchRecentFilesEnable', true);
|
||||
|
||||
this.PANEL_POSITION_TOP = this.get('panelPosition', true) === 0;
|
||||
this.PANEL_MODE = this.get('panelVisibility', true);
|
||||
this.PANEL_DISABLED = this.PANEL_MODE === 2;
|
||||
this.PANEL_OVERVIEW_ONLY = this.PANEL_MODE === 1;
|
||||
this.START_Y_OFFSET = 0; // set from main module
|
||||
this.FIX_UBUNTU_DOCK = this.get('fixUbuntuDock', true);
|
||||
|
||||
this.WINDOW_ATTENTION_MODE = this.get('windowAttentionMode', true);
|
||||
this.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS = this.WINDOW_ATTENTION_MODE === 1;
|
||||
this.WINDOW_ATTENTION_FOCUS_IMMEDIATELY = this.WINDOW_ATTENTION_MODE === 2;
|
||||
|
||||
this.WS_SW_POPUP_H_POSITION = this.get('wsSwPopupHPosition', true) / 100;
|
||||
this.WS_SW_POPUP_V_POSITION = this.get('wsSwPopupVPosition', true) / 100;
|
||||
this.WS_SW_POPUP_MODE = this.get('wsSwPopupMode', true);
|
||||
|
||||
this.SHOW_FAV_NOTIFICATION = this.get('favoritesNotify', true);
|
||||
this.NOTIFICATION_POSITION = this.get('notificationPosition', true);
|
||||
|
||||
this.OSD_POSITION = this.get('osdPosition', true);
|
||||
|
||||
this.HOT_CORNER_ACTION = this.get('hotCornerAction', true);
|
||||
this.HOT_CORNER_POSITION = this.get('hotCornerPosition', true);
|
||||
if (this.HOT_CORNER_POSITION === 6 && this.DASH_VISIBLE)
|
||||
this.HOT_CORNER_EDGE = true;
|
||||
else
|
||||
this.HOT_CORNER_EDGE = false;
|
||||
if ([5, 6].includes(this.HOT_CORNER_POSITION)) {
|
||||
if (this.DASH_TOP || this.DASH_LEFT)
|
||||
this.HOT_CORNER_POSITION = 1;
|
||||
else if (this.DASH_RIGHT)
|
||||
this.HOT_CORNER_POSITION = 2;
|
||||
else if (this.DASH_BOTTOM)
|
||||
this.HOT_CORNER_POSITION = 3;
|
||||
else
|
||||
this.HOT_CORNER_POSITION = 0;
|
||||
}
|
||||
this.HOT_CORNER_FULLSCREEN = this.get('hotCornerFullscreen', true);
|
||||
this.HOT_CORNER_RIPPLES = this.get('hotCornerRipples', true);
|
||||
|
||||
this.ALWAYS_ACTIVATE_SELECTED_WINDOW = this.get('alwaysActivateSelectedWindow', true);
|
||||
this.WINDOW_ICON_CLICK_SEARCH = this.get('windowIconClickSearch', true);
|
||||
|
||||
this.OVERLAY_KEY_SECONDARY = this.get('overlayKeySecondary', true);
|
||||
}
|
||||
|
||||
_getAnimationDirection() {
|
||||
if (this.ORIENTATION) {
|
||||
return (this.WS_TMB_LEFT || !this.SHOW_WS_TMB) ? 1 : 2; // 1 right, 2 left
|
||||
} else {
|
||||
return (this.WS_TMB_TOP || !this.SHOW_WS_TMB) ? 3 : 5; // 3 bottom, 5 top
|
||||
if (this.ORIENTATION)
|
||||
return this.WS_TMB_LEFT || !this.SHOW_WS_TMB ? 1 : 2; // 1 right, 2 left
|
||||
else
|
||||
return this.WS_TMB_TOP || !this.SHOW_WS_TMB ? 3 : 5; // 3 bottom, 5 top
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* swipeTracker.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -15,13 +15,23 @@ const Main = imports.ui.main;
|
|||
const SwipeTracker = imports.ui.swipeTracker;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
let _vwGestureUpdateId;
|
||||
let _originalGestureUpdateId;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.settings.opt;
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('swipeTrackerModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (reset || !opt.ORIENTATION) { // 1-VERTICAL, 0-HORIZONTAL
|
||||
// original swipeTrackers' orientation and updateGesture function
|
||||
|
@ -56,11 +66,9 @@ function update(reset = false) {
|
|||
}
|
||||
}
|
||||
|
||||
//---- SwipeTracker -----------------------------------------------------------------------------------
|
||||
// switch overview's state gesture direction
|
||||
var SwipeTrackerVertical = {
|
||||
_updateGesture: function(gesture, time, delta, distance) {
|
||||
if (this._state !== 1) //State.SCROLLING)
|
||||
const SwipeTrackerVertical = {
|
||||
_updateGesture(gesture, time, delta, distance) {
|
||||
if (this._state !== 1) // State.SCROLLING)
|
||||
return;
|
||||
|
||||
if ((this._allowedModes & Main.actionMode) === 0 || !this.enabled) {
|
||||
|
@ -75,5 +83,5 @@ var SwipeTrackerVertical = {
|
|||
|
||||
this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress));
|
||||
this.emit('update', this._progress);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
364
extensions/vertical-workspaces/lib/util.js
Normal file
|
@ -0,0 +1,364 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* util.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gi = imports._gi;
|
||||
const { Shell, Meta, Clutter } = imports.gi;
|
||||
|
||||
const Config = imports.misc.config;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
var shellVersion = parseFloat(Config.PACKAGE_VERSION);
|
||||
|
||||
var Overrides = class {
|
||||
constructor() {
|
||||
this._overrides = {};
|
||||
}
|
||||
|
||||
addOverride(name, prototype, overrideList) {
|
||||
this._overrides[name] = {
|
||||
originals: this.overrideProto(prototype, overrideList),
|
||||
prototype,
|
||||
};
|
||||
}
|
||||
|
||||
removeOverride(name) {
|
||||
const override = this._overrides[name];
|
||||
if (!override)
|
||||
return false;
|
||||
|
||||
this.overrideProto(override.prototype, override.originals);
|
||||
this._overrides[name] = undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
removeAll() {
|
||||
for (let name in this._overrides) {
|
||||
this.removeOverride(name);
|
||||
this._overrides[name] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
hookVfunc(proto, symbol, func) {
|
||||
proto[Gi.hook_up_vfunc_symbol](symbol, func);
|
||||
}
|
||||
|
||||
overrideProto(proto, overrides) {
|
||||
const backup = {};
|
||||
|
||||
for (let symbol in overrides) {
|
||||
if (symbol.startsWith('after_')) {
|
||||
const actualSymbol = symbol.slice('after_'.length);
|
||||
const fn = proto[actualSymbol];
|
||||
const afterFn = overrides[symbol];
|
||||
proto[actualSymbol] = function (...args) {
|
||||
args = Array.prototype.slice.call(args);
|
||||
const res = fn.apply(this, args);
|
||||
afterFn.apply(this, args);
|
||||
return res;
|
||||
};
|
||||
backup[actualSymbol] = fn;
|
||||
} else {
|
||||
backup[symbol] = proto[symbol];
|
||||
if (symbol.startsWith('vfunc')) {
|
||||
if (shellVersion < 42)
|
||||
this.hookVfunc(proto, symbol.slice(6), overrides[symbol]);
|
||||
else
|
||||
this.hookVfunc(proto[Gi.gobject_prototype_symbol], symbol.slice(6), overrides[symbol]);
|
||||
} else {
|
||||
proto[symbol] = overrides[symbol];
|
||||
}
|
||||
}
|
||||
}
|
||||
return backup;
|
||||
}
|
||||
};
|
||||
|
||||
function getOverviewTranslations(opt, dash, tmbBox, searchEntryBin) {
|
||||
// const tmbBox = Main.overview._overview._controls._thumbnailsBox;
|
||||
let searchTranslationY = 0;
|
||||
if (searchEntryBin.visible) {
|
||||
const offset = (dash.visible && (!opt.DASH_VERTICAL ? dash.height + 12 : 0)) +
|
||||
(opt.WS_TMB_TOP ? tmbBox.height + 12 : 0);
|
||||
searchTranslationY = -searchEntryBin.height - offset - 30;
|
||||
}
|
||||
|
||||
let tmbTranslationX = 0;
|
||||
let tmbTranslationY = 0;
|
||||
let offset;
|
||||
if (tmbBox.visible) {
|
||||
switch (opt.WS_TMB_POSITION) {
|
||||
case 3: // left
|
||||
offset = 10 + (dash?.visible && opt.DASH_LEFT ? dash.width : 0);
|
||||
tmbTranslationX = -tmbBox.width - offset;
|
||||
tmbTranslationY = 0;
|
||||
break;
|
||||
case 1: // right
|
||||
offset = 10 + (dash?.visible && opt.DASH_RIGHT ? dash.width : 0);
|
||||
tmbTranslationX = tmbBox.width + offset;
|
||||
tmbTranslationY = 0;
|
||||
break;
|
||||
case 0: // top
|
||||
offset = 10 + (dash?.visible && opt.DASH_TOP ? dash.height : 0) + Main.panel.height;
|
||||
tmbTranslationX = 0;
|
||||
tmbTranslationY = -tmbBox.height - offset;
|
||||
break;
|
||||
case 2: // bottom
|
||||
offset = 10 + (dash?.visible && opt.DASH_BOTTOM ? dash.height : 0) + Main.panel.height; // just for case the panel is at bottom
|
||||
tmbTranslationX = 0;
|
||||
tmbTranslationY = tmbBox.height + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let dashTranslationX = 0;
|
||||
let dashTranslationY = 0;
|
||||
let position = opt.DASH_POSITION;
|
||||
// if DtD replaced the original Dash, read its position
|
||||
if (dashIsDashToDock())
|
||||
position = dash._position;
|
||||
|
||||
if (dash?.visible) {
|
||||
switch (position) {
|
||||
case 0: // top
|
||||
dashTranslationX = 0;
|
||||
dashTranslationY = -dash.height - dash.margin_bottom - Main.panel.height;
|
||||
break;
|
||||
case 1: // right
|
||||
dashTranslationX = dash.width;
|
||||
dashTranslationY = 0;
|
||||
break;
|
||||
case 2: // bottom
|
||||
dashTranslationX = 0;
|
||||
dashTranslationY = dash.height + dash.margin_bottom + Main.panel.height;
|
||||
break;
|
||||
case 3: // left
|
||||
dashTranslationX = -dash.width;
|
||||
dashTranslationY = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return [tmbTranslationX, tmbTranslationY, dashTranslationX, dashTranslationY, searchTranslationY];
|
||||
}
|
||||
|
||||
function openPreferences() {
|
||||
const windows = global.display.get_tab_list(Meta.TabList.NORMAL_ALL, null);
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
let metaWin, isVW = null;
|
||||
|
||||
for (let win of windows) {
|
||||
const app = tracker.get_window_app(win);
|
||||
if (win.get_title().includes(Me.metadata.name) && app.get_name() === 'Extensions') {
|
||||
// this is our existing window
|
||||
metaWin = win;
|
||||
isVW = true;
|
||||
break;
|
||||
} else if (win.wm_class.includes('org.gnome.Shell.Extensions')) {
|
||||
// this is prefs window of another extension
|
||||
metaWin = win;
|
||||
isVW = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (metaWin && !isVW) {
|
||||
// other prefs window blocks opening another prefs window, so close it
|
||||
metaWin.delete(global.get_current_time());
|
||||
} else if (metaWin && isVW) {
|
||||
// if prefs window already exist, move it to the current WS and activate it
|
||||
metaWin.change_workspace(global.workspace_manager.get_active_workspace());
|
||||
metaWin.activate(global.get_current_time());
|
||||
}
|
||||
|
||||
if (!metaWin || (metaWin && !isVW)) {
|
||||
try {
|
||||
Main.extensionManager.openExtensionPrefs(Me.metadata.uuid, '', {});
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function activateSearchProvider(prefix = '') {
|
||||
const searchEntry = Main.overview.searchEntry;
|
||||
if (!searchEntry.get_text() || !searchEntry.get_text().startsWith(prefix)) {
|
||||
prefix = `${prefix} `;
|
||||
const position = prefix.length;
|
||||
searchEntry.set_text(prefix);
|
||||
searchEntry.get_first_child().set_cursor_position(position);
|
||||
searchEntry.get_first_child().set_selection(position, position);
|
||||
} else {
|
||||
searchEntry.set_text('');
|
||||
}
|
||||
}
|
||||
|
||||
function dashNotDefault() {
|
||||
return Main.overview.dash !== Main.overview._overview._controls.layoutManager._dash;
|
||||
}
|
||||
|
||||
function dashIsDashToDock() {
|
||||
return Main.overview.dash._isHorizontal !== undefined;
|
||||
}
|
||||
|
||||
// Reorder Workspaces - callback for Dash and workspacesDisplay
|
||||
function reorderWorkspace(direction = 0) {
|
||||
let activeWs = global.workspace_manager.get_active_workspace();
|
||||
let activeWsIdx = activeWs.index();
|
||||
let targetIdx = activeWsIdx + direction;
|
||||
if (targetIdx > -1 && targetIdx < global.workspace_manager.get_n_workspaces())
|
||||
global.workspace_manager.reorder_workspace(activeWs, targetIdx);
|
||||
}
|
||||
|
||||
function exposeWindows(adjustment, activateKeyboard) {
|
||||
// expose windows for static overview modes
|
||||
if (!adjustment.value && !Main.overview._animationInProgress) {
|
||||
if (adjustment.value === 0) {
|
||||
adjustment.value = 0;
|
||||
adjustment.ease(1, {
|
||||
duration: 200,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => {
|
||||
if (activateKeyboard) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Windows')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isShiftPressed(state = null) {
|
||||
if (state === null)
|
||||
[,, state] = global.get_pointer();
|
||||
return (state & Clutter.ModifierType.SHIFT_MASK) !== 0;
|
||||
}
|
||||
|
||||
function isCtrlPressed(state = null) {
|
||||
if (state === null)
|
||||
[,, state] = global.get_pointer();
|
||||
return (state & Clutter.ModifierType.CONTROL_MASK) !== 0;
|
||||
}
|
||||
|
||||
function isAltPressed(state = null) {
|
||||
if (state === null)
|
||||
[,, state] = global.get_pointer();
|
||||
return (state & Clutter.ModifierType.MOD1_MASK) !== 0;
|
||||
}
|
||||
|
||||
function fuzzyMatch(term, text) {
|
||||
let pos = -1;
|
||||
const matches = [];
|
||||
// convert all accented chars to their basic form and to lower case
|
||||
const _text = text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
const _term = term.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
|
||||
// if term matches the substring exactly, gains the highest weight
|
||||
if (_text.includes(_term))
|
||||
return 0;
|
||||
|
||||
for (let i = 0; i < _term.length; i++) {
|
||||
let c = _term[i];
|
||||
let p;
|
||||
if (pos > 0)
|
||||
p = _term[i - 1];
|
||||
while (true) {
|
||||
pos += 1;
|
||||
if (pos >= _text.length)
|
||||
return -1;
|
||||
|
||||
if (_text[pos] === c) {
|
||||
matches.push(pos);
|
||||
break;
|
||||
} else if (_text[pos] === p) {
|
||||
matches.pop();
|
||||
matches.push(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add all position to get a weight of the result
|
||||
// results closer to the beginning of the text and term characters closer to each other will gain more weight.
|
||||
return matches.reduce((r, p) => r + p) - matches.length * matches[0] + matches[0];
|
||||
}
|
||||
|
||||
function strictMatch(term, text) {
|
||||
// remove diacritics and accents from letters
|
||||
let s = text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
let p = term.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
let ps = p.split(/ +/);
|
||||
|
||||
// allows to use multiple exact patterns separated by a space in arbitrary order
|
||||
for (let w of ps) { // escape regex control chars
|
||||
if (!s.match(w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')))
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function isMoreRelevant(stringA, stringB, pattern) {
|
||||
let regex = /[^a-zA-Z\d]/;
|
||||
let strSplitA = stringA.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().split(regex);
|
||||
let strSplitB = stringB.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().split(regex);
|
||||
let aAny = false;
|
||||
strSplitA.forEach(w => {
|
||||
aAny = aAny || w.startsWith(pattern);
|
||||
});
|
||||
let bAny = false;
|
||||
strSplitB.forEach(w => {
|
||||
bAny = bAny || w.startsWith(pattern);
|
||||
});
|
||||
|
||||
// if both strings contain a word that starts with the pattern
|
||||
// prefer the one whose first word starts with the pattern
|
||||
if (aAny && bAny)
|
||||
return !strSplitA[0].startsWith(pattern) && strSplitB[0].startsWith(pattern);
|
||||
else
|
||||
return !aAny && bAny;
|
||||
}
|
||||
|
||||
function getEnabledExtensions(uuid = '') {
|
||||
let extensions = [];
|
||||
Main.extensionManager._extensions.forEach(e => {
|
||||
if (e.state === 1 && e.uuid.includes(uuid))
|
||||
extensions.push(e);
|
||||
});
|
||||
return extensions;
|
||||
}
|
||||
|
||||
function getScrollDirection(event) {
|
||||
// scroll wheel provides two types of direction information:
|
||||
// 1. Clutter.ScrollDirection.DOWN / Clutter.ScrollDirection.UP
|
||||
// 2. Clutter.ScrollDirection.SMOOTH + event.get_scroll_delta()
|
||||
// first SMOOTH event returns 0 delta,
|
||||
// so we need to always read event.direction
|
||||
// since mouse without smooth scrolling provides exactly one SMOOTH event on one wheel rotation click
|
||||
// on the other hand, under X11, one wheel rotation click sometimes doesn't send direction event, only several SMOOTH events
|
||||
// so we also need to convert the delta to direction
|
||||
let direction = event.get_scroll_direction();
|
||||
|
||||
if (direction !== Clutter.ScrollDirection.SMOOTH)
|
||||
return direction;
|
||||
|
||||
let [, delta] = event.get_scroll_delta();
|
||||
|
||||
if (!delta)
|
||||
return null;
|
||||
|
||||
direction = delta > 0 ? Clutter.ScrollDirection.DOWN : Clutter.ScrollDirection.UP;
|
||||
|
||||
return direction;
|
||||
}
|
90
extensions/vertical-workspaces/lib/windowAttentionHandler.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* windowAttentionHandler.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const WindowAttentionHandler = imports.ui.windowAttentionHandler;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let opt;
|
||||
let _firstRun = false;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('winAttentionHandlerModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
if (reset) {
|
||||
reset = true;
|
||||
_updateConnections(reset);
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_updateConnections();
|
||||
}
|
||||
|
||||
function _updateConnections(reset) {
|
||||
global.display.disconnectObject(Main.windowAttentionHandler);
|
||||
|
||||
const handlerFnc = reset
|
||||
? Main.windowAttentionHandler._onWindowDemandsAttention
|
||||
: WindowAttentionHandlerCommon._onWindowDemandsAttention;
|
||||
|
||||
global.display.connectObject(
|
||||
'window-demands-attention', handlerFnc.bind(Main.windowAttentionHandler),
|
||||
'window-marked-urgent', handlerFnc.bind(Main.windowAttentionHandler),
|
||||
Main.windowAttentionHandler);
|
||||
}
|
||||
|
||||
const WindowAttentionHandlerCommon = {
|
||||
_onWindowDemandsAttention(display, window) {
|
||||
// Deny attention notifications if the App Grid is open, to avoid notification spree when opening a folder
|
||||
if (Main.overview._shown && Main.overview.dash.showAppsButton.checked) {
|
||||
return;
|
||||
} else if (opt.WINDOW_ATTENTION_FOCUS_IMMEDIATELY) {
|
||||
if (!Main.overview._shown)
|
||||
Main.activateWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this._tracker.get_window_app(window);
|
||||
const source = new WindowAttentionHandler.WindowAttentionSource(app, window);
|
||||
Main.messageTray.add(source);
|
||||
|
||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||
|
||||
const notification = new MessageTray.Notification(source, title, banner);
|
||||
notification.connect('activated', () => {
|
||||
source.open();
|
||||
});
|
||||
notification.setForFeedback(true);
|
||||
|
||||
if (opt.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS)
|
||||
// just push the notification to the message tray without showing notification
|
||||
source.pushNotification(notification);
|
||||
else
|
||||
source.showNotification(notification);
|
||||
|
||||
window.connectObject('notify::title', () => {
|
||||
[title, banner] = this._getTitleAndBanner(app, window);
|
||||
notification.update(title, banner);
|
||||
}, source);
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* windowManager.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -10,40 +10,50 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GObject, Clutter, Meta, Shell } = imports.gi;
|
||||
const { GObject, Clutter, Meta } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
let _overrides;
|
||||
|
||||
const MINIMIZE_WINDOW_ANIMATION_TIME = WindowManager.MINIMIZE_WINDOW_ANIMATION_TIME;
|
||||
const MINIMIZE_WINDOW_ANIMATION_MODE = WindowManager.MINIMIZE_WINDOW_ANIMATION_MODE;
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('windowManagerModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
|
||||
_replaceMinimizeFunction(reset);
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('WindowManager', WindowManager.WindowManager.prototype, WindowManagerCommon);
|
||||
}
|
||||
|
||||
//------------- Fix and adapt minimize/unminimize animations --------------------------------------
|
||||
// ------------- Fix and adapt minimize/unminimize animations --------------------------------------
|
||||
|
||||
let _originalMinimizeSigId;
|
||||
let _minimizeSigId;
|
||||
|
@ -61,7 +71,6 @@ function _replaceMinimizeFunction(reset = false) {
|
|||
_unminimizeSigId = 0;
|
||||
Main.wm._shellwm.unblock_signal_handler(_originalUnminimizeSigId);
|
||||
_originalUnminimizeSigId = 0;
|
||||
|
||||
} else if (!_minimizeSigId) {
|
||||
_originalMinimizeSigId = GObject.signal_handler_find(Main.wm._shellwm, { signalId: 'minimize' });
|
||||
if (_originalMinimizeSigId) {
|
||||
|
@ -82,7 +91,7 @@ function _replaceMinimizeFunction(reset = false) {
|
|||
// anyway, animation is better, even if the Activities button is not visible...
|
||||
// and also add support for bottom position of the panel
|
||||
const WindowManagerCommon = {
|
||||
_minimizeWindow: function(shellwm, actor) {
|
||||
_minimizeWindow(shellwm, actor) {
|
||||
const types = [
|
||||
Meta.WindowType.NORMAL,
|
||||
Meta.WindowType.MODAL_DIALOG,
|
||||
|
@ -97,14 +106,14 @@ const WindowManagerCommon = {
|
|||
|
||||
this._minimizing.add(actor);
|
||||
|
||||
if (false/*actor.meta_window.is_monitor_sized()*/) {
|
||||
/* if (actor.meta_window.is_monitor_sized()) {
|
||||
actor.get_first_child().ease({
|
||||
opacity: 0,
|
||||
duration: MINIMIZE_WINDOW_ANIMATION_TIME,
|
||||
mode: MINIMIZE_WINDOW_ANIMATION_MODE,
|
||||
onStopped: () => this._minimizeWindowDone(shellwm, actor),
|
||||
});
|
||||
} else {
|
||||
} else { */
|
||||
let xDest, yDest, xScale, yScale;
|
||||
let [success, geom] = actor.meta_window.get_icon_geometry();
|
||||
if (success) {
|
||||
|
@ -120,7 +129,7 @@ const WindowManagerCommon = {
|
|||
}
|
||||
xDest = monitor.x;
|
||||
yDest = opt.PANEL_POSITION_TOP ? monitor.y : monitor.y + monitor.height;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
||||
xDest += monitor.width;
|
||||
xScale = 0;
|
||||
yScale = 0;
|
||||
|
@ -135,10 +144,10 @@ const WindowManagerCommon = {
|
|||
mode: MINIMIZE_WINDOW_ANIMATION_MODE,
|
||||
onStopped: () => this._minimizeWindowDone(shellwm, actor),
|
||||
});
|
||||
}
|
||||
// }
|
||||
},
|
||||
|
||||
_minimizeWindowDone: function(shellwm, actor) {
|
||||
_minimizeWindowDone(shellwm, actor) {
|
||||
if (this._minimizing.delete(actor)) {
|
||||
actor.remove_all_transitions();
|
||||
actor.set_scale(1.0, 1.0);
|
||||
|
@ -149,7 +158,7 @@ const WindowManagerCommon = {
|
|||
}
|
||||
},
|
||||
|
||||
_unminimizeWindow: function(shellwm, actor) {
|
||||
_unminimizeWindow(shellwm, actor) {
|
||||
const types = [
|
||||
Meta.WindowType.NORMAL,
|
||||
Meta.WindowType.MODAL_DIALOG,
|
||||
|
@ -162,7 +171,7 @@ const WindowManagerCommon = {
|
|||
|
||||
this._unminimizing.add(actor);
|
||||
|
||||
if (false/*actor.meta_window.is_monitor_sized()*/) {
|
||||
/* if (false/* actor.meta_window.is_monitor_sized()) {
|
||||
actor.opacity = 0;
|
||||
actor.set_scale(1.0, 1.0);
|
||||
actor.ease({
|
||||
|
@ -171,7 +180,7 @@ const WindowManagerCommon = {
|
|||
mode: MINIMIZE_WINDOW_ANIMATION_MODE,
|
||||
onStopped: () => this._unminimizeWindowDone(shellwm, actor),
|
||||
});
|
||||
} else {
|
||||
} else { */
|
||||
let [success, geom] = actor.meta_window.get_icon_geometry();
|
||||
if (success) {
|
||||
actor.set_position(geom.x, geom.y);
|
||||
|
@ -185,7 +194,7 @@ const WindowManagerCommon = {
|
|||
return;
|
||||
}
|
||||
actor.set_position(monitor.x, opt.PANEL_POSITION_TOP ? monitor.y : monitor.y + monitor.height);
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
||||
actor.x += monitor.width;
|
||||
actor.set_scale(0, 0);
|
||||
}
|
||||
|
@ -203,6 +212,6 @@ const WindowManagerCommon = {
|
|||
mode: MINIMIZE_WINDOW_ANIMATION_MODE,
|
||||
onStopped: () => this._unminimizeWindowDone(shellwm, actor),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* windowPreview.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { Clutter, GLib, Graphene, Meta, Shell, St } = imports.gi;
|
||||
const { Clutter, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const WindowPreview = imports.ui.windowPreview;
|
||||
|
@ -18,40 +18,54 @@ const WindowPreview = imports.ui.windowPreview;
|
|||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
const shellVersion = _Util.shellVersion;
|
||||
|
||||
let _overrides;
|
||||
|
||||
const WINDOW_SCALE_TIME = imports.ui.windowPreview.WINDOW_SCALE_TIME;
|
||||
const WINDOW_ACTIVE_SIZE_INC = imports.ui.windowPreview.WINDOW_ACTIVE_SIZE_INC;
|
||||
const WINDOW_OVERLAY_FADE_TIME = imports.ui.windowPreview.WINDOW_OVERLAY_FADE_TIME;
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.windowSearchProvider.prefix;
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.lib.windowSearchProvider.prefix;
|
||||
|
||||
const ControlsState = imports.ui.overviewControls.ControlsState;
|
||||
|
||||
var opt = null;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('windowPreviewModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
WindowPreview.WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 750;
|
||||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('WindowPreview', WindowPreview.WindowPreview.prototype, WindowPreviewCommon);
|
||||
// move titles into window previews
|
||||
_overrides.addInjection('WindowPreview', WindowPreview.WindowPreview.prototype, WindowPreviewInjections);
|
||||
// A shorter timeout allows user to quickly cancel the selection by leaving the preview with the mouse pointer
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
WindowPreview.WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 150;
|
||||
}
|
||||
|
||||
//----- WindowPreview ------------------------------------------------------------------
|
||||
var WindowPreviewInjections = {
|
||||
_init: function() {
|
||||
const WindowPreviewCommon = {
|
||||
// injection to _init()
|
||||
after__init() {
|
||||
const ICON_OVERLAP = 0.7;
|
||||
|
||||
if (opt.WIN_PREVIEW_ICON_SIZE < 64) {
|
||||
|
@ -91,7 +105,7 @@ var WindowPreviewInjections = {
|
|||
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||
const iconOverlap = opt.WIN_PREVIEW_ICON_SIZE * ICON_OVERLAP;
|
||||
// we cannot get proper title height before it gets to the stage, so 35 is estimated height + spacing
|
||||
this._title.get_constraints()[1].offset = scaleFactor * (- iconOverlap - 35);
|
||||
this._title.get_constraints()[1].offset = scaleFactor * (-iconOverlap - 35);
|
||||
this.set_child_above_sibling(this._title, null);
|
||||
// if window is created while the overview is shown, icon and title should be visible immediately
|
||||
if (Main.overview._overview._controls._stateAdjustment.value < 1) {
|
||||
|
@ -100,34 +114,23 @@ var WindowPreviewInjections = {
|
|||
this._title.opacity = 0;
|
||||
}
|
||||
|
||||
if (opt.ALWAYS_SHOW_WIN_TITLES) {
|
||||
if (opt.ALWAYS_SHOW_WIN_TITLES)
|
||||
this._title.show();
|
||||
this._stateConId = this._workspace._background._stateAdjustment.connect('notify::value', (adj) => {
|
||||
this._title.opacity = Math.floor(adj.value) * 255;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (opt.OVERVIEW_MODE === 1) {
|
||||
// spread windows on hover
|
||||
this._wsStateConId = this.connect('enter-event', () => {
|
||||
// don't spread windows if user don't use pointer device at this moment
|
||||
if (global.get_pointer()[0] === opt.showingPointerX)
|
||||
if (global.get_pointer()[0] === opt.showingPointerX || Main.overview._overview._controls._stateAdjustment.value < 1)
|
||||
return;
|
||||
|
||||
const adjustment = this._workspace._background._stateAdjustment;
|
||||
if (!adjustment.value && !Main.overview._animationInProgress) {
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
if (adjustment.value === 0) {
|
||||
adjustment.value = 0;
|
||||
adjustment.ease(1, {
|
||||
duration: 200,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD
|
||||
});
|
||||
}
|
||||
}
|
||||
_Util.exposeWindows(adjustment, false);
|
||||
this.disconnect(this._wsStateConId);
|
||||
});
|
||||
}
|
||||
|
||||
if (opt.OVERVIEW_MODE) {
|
||||
// show window icon and title on ws windows spread
|
||||
this._stateAdjustmentSigId = this._workspace.stateAdjustment.connect('notify::value', this._updateIconScale.bind(this));
|
||||
|
@ -135,37 +138,52 @@ var WindowPreviewInjections = {
|
|||
|
||||
// replace click action with custom one
|
||||
const action = this.get_actions()[0];
|
||||
this.remove_action(action);
|
||||
|
||||
const clickAction = new Clutter.ClickAction();
|
||||
clickAction.connect('clicked', (action) => {
|
||||
const button = action.get_button();
|
||||
const handlerId = GObject.signal_handler_find(action, { signalId: 'clicked' });
|
||||
if (handlerId)
|
||||
action.disconnect(handlerId);
|
||||
|
||||
action.connect('clicked', act => {
|
||||
const button = act.get_button();
|
||||
if (button === Clutter.BUTTON_PRIMARY) {
|
||||
this._activate();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (button === Clutter.BUTTON_SECONDARY) {
|
||||
// this action cancels long-press event and the 'long-press-cancel' event is used by the Shell to actually initiate DnD
|
||||
// so the dnd initiation needs to be removed
|
||||
if (this._longPressLater) {
|
||||
if (shellVersion >= 44) {
|
||||
const laters = global.compositor.get_laters();
|
||||
laters.remove(this._longPressLater);
|
||||
} else {
|
||||
Meta.later_remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
}
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const appName = tracker.get_window_app(this.metaWindow).get_name();
|
||||
_Util.activateSearchProvider(`${SEARCH_WINDOWS_PREFIX} ${appName}`);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
clickAction.connect('long-press', this._onLongPress.bind(this));
|
||||
this.add_action(clickAction);
|
||||
|
||||
this.connect('destroy', () => this._workspace.stateAdjustment.disconnect(this._stateConId));
|
||||
if (opt.WINDOW_ICON_CLICK_SEARCH) {
|
||||
const iconClickAction = new Clutter.ClickAction();
|
||||
iconClickAction.connect('clicked', act => {
|
||||
if (act.get_button() === Clutter.BUTTON_PRIMARY) {
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const appName = tracker.get_window_app(this.metaWindow).get_name();
|
||||
_Util.activateSearchProvider(`${SEARCH_WINDOWS_PREFIX} ${appName}`);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
this._icon.add_action(iconClickAction);
|
||||
}
|
||||
},
|
||||
|
||||
// WindowPreview
|
||||
var WindowPreviewCommon = {
|
||||
_updateIconScale: function() {
|
||||
_updateIconScale() {
|
||||
let { currentState, initialState, finalState } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
||||
|
@ -173,46 +191,60 @@ var WindowPreviewCommon = {
|
|||
const primaryMonitor = this.metaWindow.get_monitor() === global.display.get_primary_monitor();
|
||||
|
||||
const visible =
|
||||
(initialState > ControlsState.HIDDEN || finalState > ControlsState.HIDDEN)
|
||||
&& !(finalState === ControlsState.APP_GRID && primaryMonitor);
|
||||
(initialState > ControlsState.HIDDEN || finalState > ControlsState.HIDDEN) &&
|
||||
!(finalState === ControlsState.APP_GRID && primaryMonitor);
|
||||
|
||||
let scale = visible
|
||||
? (currentState >= 1 ? 1 : currentState % 1) : 0;
|
||||
if (!primaryMonitor &&
|
||||
let scale = 0;
|
||||
if (visible)
|
||||
scale = currentState >= 1 ? 1 : currentState % 1;
|
||||
|
||||
if (!primaryMonitor && opt.WORKSPACE_MODE &&
|
||||
((initialState === ControlsState.WINDOW_PICKER && finalState === ControlsState.APP_GRID) ||
|
||||
(initialState === ControlsState.APP_GRID && finalState === ControlsState.WINDOW_PICKER))
|
||||
) {
|
||||
)
|
||||
scale = 1;
|
||||
/*} else if (primaryMonitor && ((initialState === ControlsState.WINDOW_PICKER && finalState === ControlsState.APP_GRID) ||
|
||||
initialState === ControlsState.APP_GRID && finalState === ControlsState.HIDDEN)) {*/
|
||||
} else if (primaryMonitor && currentState > ControlsState.WINDOW_PICKER) {
|
||||
else if (!primaryMonitor && opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE)
|
||||
scale = 0;
|
||||
/* } else if (primaryMonitor && ((initialState === ControlsState.WINDOW_PICKER && finalState === ControlsState.APP_GRID) ||
|
||||
initialState === ControlsState.APP_GRID && finalState === ControlsState.HIDDEN)) {*/
|
||||
else if (primaryMonitor && currentState > ControlsState.WINDOW_PICKER)
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
// in static workspace mode show icon and title on ws windows spread
|
||||
|
||||
// in static workspace mode show icon and title on windows expose
|
||||
if (opt.OVERVIEW_MODE) {
|
||||
const windowsSpread = this._workspace.stateAdjustment.value;
|
||||
if (currentState === 1) {
|
||||
scale = windowsSpread;
|
||||
} else if (finalState === 1 || (finalState === 0 && !windowsSpread)) {
|
||||
if (currentState === 1)
|
||||
scale = opt.WORKSPACE_MODE;
|
||||
else if (finalState === 1 || (finalState === 0 && !opt.WORKSPACE_MODE))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this._icon.set({
|
||||
if (scale === 1) {
|
||||
this._icon.ease({
|
||||
duration: 50,
|
||||
scale_x: scale,
|
||||
scale_y: scale,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
this._title.ease({
|
||||
duration: 100,
|
||||
opacity: 255,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
} else if (this._icon.scale_x !== 0) {
|
||||
this._icon.set({
|
||||
scale_x: 0,
|
||||
scale_y: 0,
|
||||
});
|
||||
this._title.opacity = 0;
|
||||
}
|
||||
|
||||
// if titles are in 'always show' mode, we need to add transition between visible/invisible state
|
||||
// but the transition is quite expensive,
|
||||
// showing the titles at the end of the transition is good enough and workspace preview transition is much smoother
|
||||
this._title.set({
|
||||
opacity: Math.floor(scale) * 255,
|
||||
});
|
||||
},
|
||||
|
||||
showOverlay: function(animate) {
|
||||
showOverlay(animate) {
|
||||
if (!this._overlayEnabled)
|
||||
return;
|
||||
|
||||
|
@ -220,7 +252,8 @@ var WindowPreviewCommon = {
|
|||
return;
|
||||
|
||||
this._overlayShown = true;
|
||||
//this._restack();
|
||||
if (!opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
this._restack();
|
||||
|
||||
// If we're supposed to animate and an animation in our direction
|
||||
// is already happening, let that one continue
|
||||
|
@ -234,9 +267,9 @@ var WindowPreviewCommon = {
|
|||
? [this._closeButton]
|
||||
: [];
|
||||
|
||||
if (!opt.ALWAYS_SHOW_WIN_TITLES) {
|
||||
if (!opt.ALWAYS_SHOW_WIN_TITLES)
|
||||
toShow.push(this._title);
|
||||
}
|
||||
|
||||
|
||||
toShow.forEach(a => {
|
||||
a.opacity = 0;
|
||||
|
@ -264,11 +297,17 @@ var WindowPreviewCommon = {
|
|||
this.emit('show-chrome');
|
||||
},
|
||||
|
||||
hideOverlay: function(animate) {
|
||||
hideOverlay(animate) {
|
||||
if (!this._overlayShown)
|
||||
return;
|
||||
this._overlayShown = false;
|
||||
//this._restack();
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW && Main.overview._overview.controls._stateAdjustment.value < 1) {
|
||||
this.get_parent()?.set_child_above_sibling(this, null);
|
||||
this._activateSelected = true;
|
||||
}
|
||||
|
||||
if (!opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
this._restack();
|
||||
|
||||
// If we're supposed to animate and an animation in our direction
|
||||
// is already happening, let that one continue
|
||||
|
@ -280,9 +319,9 @@ var WindowPreviewCommon = {
|
|||
|
||||
const toHide = [this._closeButton];
|
||||
|
||||
if (!opt.ALWAYS_SHOW_WIN_TITLES) {
|
||||
if (!opt.ALWAYS_SHOW_WIN_TITLES)
|
||||
toHide.push(this._title);
|
||||
}
|
||||
|
||||
toHide.forEach(a => {
|
||||
a.opacity = 255;
|
||||
a.ease({
|
||||
|
@ -304,19 +343,25 @@ var WindowPreviewCommon = {
|
|||
},
|
||||
|
||||
_onDestroy() {
|
||||
// fix for upstream bug - hideOverlay is called after windowPreview is destroyed, from the leave event callback
|
||||
// but it still throws:
|
||||
// clutter_actor_get_preferred_width: assertion 'CLUTTER_IS_ACTOR (self)' failed
|
||||
// clutter_actor_get_preferred_height: assertion 'CLUTTER_IS_ACTOR (self)' failed
|
||||
this.hideOverlay(false);
|
||||
// workaround for upstream bug - hideOverlay is called after windowPreview is destroyed, from the leave event callback
|
||||
// hiding the preview now avoids firing the post-mortem leave event
|
||||
this.hide();
|
||||
if (this._activateSelected)
|
||||
this._activate();
|
||||
|
||||
this.metaWindow._delegate = null;
|
||||
this._delegate = null;
|
||||
|
||||
if (this._longPressLater) {
|
||||
if (shellVersion >= 44) {
|
||||
const laters = global.compositor.get_laters();
|
||||
laters.remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
} else {
|
||||
Meta.later_remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
}
|
||||
|
||||
if (this._idleHideOverlayId > 0) {
|
||||
GLib.source_remove(this._idleHideOverlayId);
|
||||
|
@ -328,8 +373,7 @@ var WindowPreviewCommon = {
|
|||
this.inDrag = false;
|
||||
}
|
||||
|
||||
if (this._stateAdjustmentSigId) {
|
||||
if (this._stateAdjustmentSigId)
|
||||
this._workspace.stateAdjustment.disconnect(this._stateAdjustmentSigId);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* windowSearchProvider.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -9,13 +9,16 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { GLib, GObject, Gio, Gtk, Meta, St, Shell } = imports.gi;
|
||||
const { GLib, Gio, Meta, St, Shell } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Settings = Me.imports.settings;
|
||||
const _ = Me.imports.settings._;
|
||||
const Settings = Me.imports.lib.settings;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
// gettext
|
||||
const _ = Settings._;
|
||||
|
||||
const shellVersion = Settings.shellVersion;
|
||||
|
||||
|
@ -36,18 +39,15 @@ const Action = {
|
|||
CLOSE: 1,
|
||||
CLOSE_ALL: 2,
|
||||
MOVE_TO_WS: 3,
|
||||
MOVE_ALL_TO_WS: 4
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
MOVE_ALL_TO_WS: 4,
|
||||
};
|
||||
|
||||
function getOverviewSearchResult() {
|
||||
return Main.overview._overview.controls._searchController._searchResults;
|
||||
}
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.settings.opt;
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
if (!reset && opt.WINDOW_SEARCH_PROVIDER_ENABLED && !windowSearchProvider) {
|
||||
enable();
|
||||
} else if (reset || !opt.WINDOW_SEARCH_PROVIDER_ENABLED) {
|
||||
|
@ -62,7 +62,7 @@ function enable() {
|
|||
GLib.PRIORITY_DEFAULT,
|
||||
2000,
|
||||
() => {
|
||||
if (windowSearchProvider == null) {
|
||||
if (!windowSearchProvider) {
|
||||
windowSearchProvider = new WindowSearchProvider(opt);
|
||||
getOverviewSearchResult()._registerProvider(
|
||||
windowSearchProvider
|
||||
|
@ -87,58 +87,6 @@ function disable() {
|
|||
}
|
||||
}
|
||||
|
||||
function fuzzyMatch(term, text) {
|
||||
let pos = -1;
|
||||
const matches = [];
|
||||
// convert all accented chars to their basic form and to lower case
|
||||
const _text = text;//.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
const _term = term.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
|
||||
// if term matches the substring exactly, gains the highest weight
|
||||
if (_text.includes(_term)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (let i = 0; i < _term.length; i++) {
|
||||
let c = _term[i];
|
||||
let p;
|
||||
if (pos > 0)
|
||||
p = _term[i - 1];
|
||||
while (true) {
|
||||
pos += 1;
|
||||
if (pos >= _text.length) {
|
||||
return -1;
|
||||
}
|
||||
if (_text[pos] == c) {
|
||||
matches.push(pos);
|
||||
break;
|
||||
} else if (_text[pos] == p) {
|
||||
matches.pop();
|
||||
matches.push(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add all position to get a weight of the result
|
||||
// results closer to the beginning of the text and term characters closer to each other will gain more weight.
|
||||
return matches.reduce((r, p) => r + p) - matches.length * matches[0] + matches[0];
|
||||
}
|
||||
|
||||
function strictMatch(term, text) {
|
||||
// remove diacritics and accents from letters
|
||||
let s = text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
|
||||
let p = term.toLowerCase();
|
||||
let ps = p.split(/ +/);
|
||||
|
||||
// allows to use multiple exact patterns separated by a space in arbitrary order
|
||||
for (let w of ps) { // escape regex control chars
|
||||
if (!s.match(w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function makeResult(window, i) {
|
||||
const app = Shell.WindowTracker.get_default().get_window_app(window);
|
||||
const appName = app ? app.get_name() : 'Unknown';
|
||||
|
@ -149,10 +97,10 @@ function makeResult(window, i) {
|
|||
'id': i,
|
||||
// convert all accented chars to their basic form and lower case for search
|
||||
'name': `${wsIndex + 1}: ${windowTitle} ${appName}`.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase(),
|
||||
'appName': appName,
|
||||
'windowTitle': windowTitle,
|
||||
'window': window
|
||||
}
|
||||
appName,
|
||||
windowTitle,
|
||||
window,
|
||||
};
|
||||
}
|
||||
|
||||
const closeSelectedRegex = /^\/x!$/;
|
||||
|
@ -160,29 +108,29 @@ const closeAllResultsRegex = /^\/xa!$/;
|
|||
const moveToWsRegex = /^\/m[0-9]+$/;
|
||||
const moveAllToWsRegex = /^\/ma[0-9]+$/;
|
||||
|
||||
var WindowSearchProvider = class WindowSearchProvider {
|
||||
constructor(gOptions) {
|
||||
this._gOptions = gOptions;
|
||||
this.appInfo = Gio.AppInfo.create_from_commandline('true', 'Open Windows', null);
|
||||
this.appInfo.get_description = () => 'List of open windows';
|
||||
this.appInfo.get_name = () => 'Open Windows';
|
||||
this.appInfo.get_id = () => `${Me.metadata.uuid} ${this.title}`;
|
||||
const WindowSearchProvider = class WindowSearchProvider {
|
||||
constructor() {
|
||||
this.id = `open-windows@${Me.metadata.uuid}`;
|
||||
this.appInfo = Gio.AppInfo.create_from_commandline('true', _('Open Windows'), null);
|
||||
this.appInfo.get_description = () => _('List of open windows');
|
||||
this.appInfo.get_name = () => _('Open Windows');
|
||||
this.appInfo.get_id = () => this.id;
|
||||
this.appInfo.get_icon = () => Gio.icon_new_for_string('focus-windows-symbolic');
|
||||
this.appInfo.should_show = () => true;
|
||||
this.title = 'Window Search Provider',
|
||||
|
||||
this.canLaunchSearch = true;
|
||||
this.isRemoteProvider = false;
|
||||
|
||||
this.action = 0;
|
||||
}
|
||||
|
||||
_getResultSet (terms) {
|
||||
_getResultSet(terms) {
|
||||
// do not modify original terms
|
||||
let termsCopy = [...terms];
|
||||
// search for terms without prefix
|
||||
termsCopy[0] = termsCopy[0].replace(prefix, '');
|
||||
|
||||
/*if (gOptions.get('searchWindowsCommands')) {
|
||||
/* if (gOptions.get('searchWindowsCommands')) {
|
||||
this.action = 0;
|
||||
this.targetWs = 0;
|
||||
|
||||
|
@ -208,46 +156,45 @@ var WindowSearchProvider = class WindowSearchProvider {
|
|||
|
||||
const candidates = this.windows;
|
||||
const _terms = [].concat(termsCopy);
|
||||
let match;
|
||||
// let match;
|
||||
|
||||
const term = _terms.join(' ');
|
||||
match = (s) => {
|
||||
/* match = s => {
|
||||
return fuzzyMatch(term, s);
|
||||
}
|
||||
}; */
|
||||
|
||||
const results = [];
|
||||
let m;
|
||||
for (let key in candidates) {
|
||||
if (this._gOptions.get('searchFuzzy')) {
|
||||
m = fuzzyMatch(term, candidates[key].name);
|
||||
} else {
|
||||
m = strictMatch(term, candidates[key].name);
|
||||
}
|
||||
if (m !== -1) {
|
||||
if (opt.SEARCH_FUZZY)
|
||||
m = _Util.fuzzyMatch(term, candidates[key].name);
|
||||
else
|
||||
m = _Util.strictMatch(term, candidates[key].name);
|
||||
|
||||
if (m !== -1)
|
||||
results.push({ weight: m, id: key });
|
||||
}
|
||||
}
|
||||
|
||||
results.sort((a, b) => a.weight > b.weight);
|
||||
const currentWs = global.workspace_manager.get_active_workspace_index();
|
||||
// prefer current workspace
|
||||
results.sort((a, b) => (this.windows[a.id].window.get_workspace().index() !== currentWs) && (this.windows[b.id].window.get_workspace().index() === currentWs));
|
||||
results.sort((a, b) => ((_terms != ' ') && (a.weight > 0 && b.weight === 0)));
|
||||
results.sort((a, b) => (_terms !== ' ') && (a.weight > 0 && b.weight === 0));
|
||||
|
||||
this.resultIds = results.map((item) => item.id);
|
||||
this.resultIds = results.map(item => item.id);
|
||||
return this.resultIds;
|
||||
}
|
||||
|
||||
getResultMetas (resultIds, callback = null) {
|
||||
const metas = resultIds.map((id) => this.getResultMeta(id));
|
||||
if (shellVersion >= 43) {
|
||||
getResultMetas(resultIds, callback = null) {
|
||||
const metas = resultIds.map(id => this.getResultMeta(id));
|
||||
if (shellVersion >= 43)
|
||||
return new Promise(resolve => resolve(metas));
|
||||
} else {
|
||||
else
|
||||
callback(metas);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getResultMeta (resultId) {
|
||||
getResultMeta(resultId) {
|
||||
const result = this.windows[resultId];
|
||||
const wsIndex = result.window.get_workspace().index();
|
||||
const app = Shell.WindowTracker.get_default().get_window_app(result.window);
|
||||
|
@ -255,32 +202,30 @@ var WindowSearchProvider = class WindowSearchProvider {
|
|||
'id': resultId,
|
||||
'name': `${wsIndex + 1}: ${result.windowTitle}`,
|
||||
'description': result.appName,
|
||||
'createIcon': (size) => {
|
||||
'createIcon': size => {
|
||||
return app
|
||||
? app.create_icon_texture(size)
|
||||
: new St.Icon({ icon_name: 'icon-missing', icon_size: size });
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
launchSearch(terms, timeStamp) {
|
||||
launchSearch(/* terms, timeStamp*/) {
|
||||
}
|
||||
|
||||
activateResult (resultId, terms, timeStamp) {
|
||||
const [,,state] = global.get_pointer();
|
||||
|
||||
const isCtrlPressed = (state & ModifierType.CONTROL_MASK) != 0;
|
||||
const isShiftPressed = (state & ModifierType.SHIFT_MASK) != 0;
|
||||
activateResult(resultId/* , terms, timeStamp*/) {
|
||||
const isCtrlPressed = _Util.isCtrlPressed();
|
||||
const isShiftPressed = _Util.isShiftPressed();
|
||||
|
||||
this.action = 0;
|
||||
this.targetWs = 0;
|
||||
|
||||
this.targetWs = global.workspaceManager.get_active_workspace().index() + 1;
|
||||
if (isShiftPressed && !isCtrlPressed) {
|
||||
if (isShiftPressed && !isCtrlPressed)
|
||||
this.action = Action.MOVE_TO_WS;
|
||||
} else if (isShiftPressed && isCtrlPressed) {
|
||||
else if (isShiftPressed && isCtrlPressed)
|
||||
this.action = Action.MOVE_ALL_TO_WS;
|
||||
}
|
||||
|
||||
|
||||
if (!this.action) {
|
||||
const result = this.windows[resultId];
|
||||
|
@ -306,53 +251,55 @@ var WindowSearchProvider = class WindowSearchProvider {
|
|||
|
||||
_closeWindows(ids) {
|
||||
let time = global.get_current_time();
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
for (let i = 0; i < ids.length; i++)
|
||||
this.windows[ids[i]].window.delete(time + i);
|
||||
}
|
||||
|
||||
Main.notify('Window Search Provider', `Closed ${ids.length} windows.`);
|
||||
}
|
||||
|
||||
_moveWindowsToWs(selectedId, resultIds) {
|
||||
const workspace = global.workspaceManager.get_active_workspace();
|
||||
|
||||
for (let i = 0; i < resultIds.length; i++) {
|
||||
for (let i = 0; i < resultIds.length; i++)
|
||||
this.windows[resultIds[i]].window.change_workspace(workspace);
|
||||
}
|
||||
|
||||
const selectedWin = this.windows[selectedId].window;
|
||||
selectedWin.activate_with_workspace(global.get_current_time(), workspace);
|
||||
}
|
||||
|
||||
getInitialResultSet (terms, callback, cancellable = null) {
|
||||
if (shellVersion >=43) {
|
||||
cancellable = callback;
|
||||
}
|
||||
getInitialResultSet(terms, callback/* , cancellable = null*/) {
|
||||
// In GS 43 callback arg has been removed
|
||||
/* if (shellVersion >= 43)
|
||||
cancellable = callback;*/
|
||||
|
||||
let windows;
|
||||
this.windows = windows = {};
|
||||
global.display.get_tab_list(Meta.TabList.NORMAL, null).filter(w => w.get_workspace() !== null).map(
|
||||
(v, i) => windows[`${i}-${v.get_id()}`] = makeResult(v, `${i}-${v.get_id()}`)
|
||||
(v, i) => {
|
||||
windows[`${i}-${v.get_id()}`] = makeResult(v, `${i}-${v.get_id()}`);
|
||||
return windows[`${i}-${v.get_id()}`];
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (shellVersion >= 43) {
|
||||
if (shellVersion >= 43)
|
||||
return new Promise(resolve => resolve(this._getResultSet(terms)));
|
||||
} else {
|
||||
else
|
||||
callback(this._getResultSet(terms));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
filterResults (results, maxResults) {
|
||||
//return results.slice(0, maxResults);
|
||||
filterResults(results /* , maxResults*/) {
|
||||
// return results.slice(0, maxResults);
|
||||
return results;
|
||||
}
|
||||
|
||||
getSubsearchResultSet (previousResults, terms, callback, cancellable) {
|
||||
getSubsearchResultSet(previousResults, terms, callback/* , cancellable*/) {
|
||||
// if we return previous results, quick typers get non-actual results
|
||||
callback(this._getResultSet(terms));
|
||||
}
|
||||
|
||||
createResultOjbect(resultMeta) {
|
||||
/* createResultObject(resultMeta) {
|
||||
const app = Shell.WindowTracker.get_default().get_window_app(resultMeta.id);
|
||||
return new AppIcon(app);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* workspace.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { Clutter, St, Graphene } = imports.gi;
|
||||
const { St, Graphene } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Util = imports.misc.util;
|
||||
|
@ -19,33 +19,37 @@ const Workspace = imports.ui.workspace;
|
|||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
let _overrides;
|
||||
|
||||
let opt;
|
||||
|
||||
const BACKGROUND_CORNER_RADIUS_PIXELS = 40;
|
||||
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('workspaceModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
}
|
||||
|
||||
|
||||
if (reset) {
|
||||
imports.ui.workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
|
||||
Workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
_overrides.addOverride('WorkspaceBackground', Workspace.WorkspaceBackground.prototype, WorkspaceBackground);
|
||||
// fix window scaling in workspace state 0
|
||||
_overrides.addInjection('WorkspaceLayout', Workspace.WorkspaceLayout.prototype, WorkspaceLayoutInjections);
|
||||
|
||||
// fix overlay base for Vertical Workspaces
|
||||
_overrides.addOverride('WorkspaceLayout', Workspace.WorkspaceLayout.prototype, WorkspaceLayout);
|
||||
|
@ -54,32 +58,35 @@ function update(reset = false) {
|
|||
|
||||
// workaround for upstream bug (that is not that invisible in default shell)
|
||||
// smaller window cannot be scaled below 0.95 (WINDOW_PREVIEW_MAXIMUM_SCALE)
|
||||
// when its target scale for spread windows view (workspace state 1) is bigger than the scale needed for ws state 0.
|
||||
// when its target scale for exposed windows view (workspace state 1) is bigger than the scale needed for ws state 0.
|
||||
// in workspace state 0 where windows are not spread and window scale should follow workspace scale,
|
||||
// this window follows proper top left corner position, but doesn't scale with the workspace
|
||||
// so it looks bad and the window can exceed border of the workspace
|
||||
// extremely annoying in OVERVIEW_MODE 1 with single smaller window on the workspace, also affects appGrid transition animation
|
||||
var WorkspaceLayoutInjections = {
|
||||
_init: function() {
|
||||
|
||||
// disadvantage of following workaround - the WINDOW_PREVIEW_MAXIMUM_SCALE value is common for every workspace,
|
||||
// on multi-monitor system can be visible unwanted scaling of windows on workspace in WORKSPACE_MODE 0 (windows not spread)
|
||||
// when leaving overview while any other workspace is in the WORKSPACE_MODE 1.
|
||||
const WorkspaceLayout = {
|
||||
// injection to _init()
|
||||
after__init() {
|
||||
if (opt.OVERVIEW_MODE === 1) {
|
||||
this._stateAdjustment.connect('notify::value', () => {
|
||||
if (opt.OVERVIEW_MODE !== 1) return;
|
||||
// scale 0.1 for window state 0 just needs to be smaller then possible scale of any window in spread view
|
||||
const scale = this._stateAdjustment.value ? 0.95 : 0.1;
|
||||
if (scale !== Workspace.WINDOW_PREVIEW_MAXIMUM_SCALE || this._stateAdjustment.value === 1) {
|
||||
// when transition to ws state 1 begins, replace the constant with the original one
|
||||
// disadvantage - the value changes for all workspaces, so one affects others
|
||||
// that can be visible in certain situations but not a big deal.
|
||||
if (scale !== this.WINDOW_PREVIEW_MAXIMUM_SCALE) {
|
||||
this.WINDOW_PREVIEW_MAXIMUM_SCALE = scale;
|
||||
// when transition to ws state 1 (WINDOW_PICKER) begins, replace the constant with the original one
|
||||
Workspace.WINDOW_PREVIEW_MAXIMUM_SCALE = scale;
|
||||
// and force recalculation of the target layout, so the transition will be smooth
|
||||
this._needsLayout = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
var WorkspaceLayout = {
|
||||
// this fixes wrong size and position calculation of window clones while moving overview to the next (+1) workspace if vertical ws orientation is enabled in GS
|
||||
_adjustSpacingAndPadding: function(rowSpacing, colSpacing, containerBox) {
|
||||
_adjustSpacingAndPadding(rowSpacing, colSpacing, containerBox) {
|
||||
if (this._sortedWindows.length === 0)
|
||||
return [rowSpacing, colSpacing, containerBox];
|
||||
|
||||
|
@ -103,11 +110,11 @@ var WorkspaceLayout = {
|
|||
const monitor = Main.layoutManager.monitors[this._monitorIndex];
|
||||
|
||||
const bottomPoint = new Graphene.Point3D();
|
||||
if (vertical) {
|
||||
if (vertical)
|
||||
bottomPoint.x = containerBox.x2;
|
||||
} else {
|
||||
else
|
||||
bottomPoint.y = containerBox.y2;
|
||||
}
|
||||
|
||||
|
||||
const transformedBottomPoint =
|
||||
this._container.apply_transform_to_point(bottomPoint);
|
||||
|
@ -117,30 +124,29 @@ var WorkspaceLayout = {
|
|||
|
||||
const [, bottomOverlap] = window.overlapHeights();
|
||||
|
||||
if ((bottomOverlap + oversize) > bottomFreeSpace && !vertical) {
|
||||
if ((bottomOverlap + oversize) > bottomFreeSpace && !vertical)
|
||||
containerBox.y2 -= (bottomOverlap + oversize) - bottomFreeSpace;
|
||||
}
|
||||
}
|
||||
|
||||
return [rowSpacing, colSpacing, containerBox];
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var WorkspaceBackground = {
|
||||
_updateBorderRadius: function(value = false) {
|
||||
const WorkspaceBackground = {
|
||||
_updateBorderRadius(value = false) {
|
||||
// don't round already rounded corners during exposing windows
|
||||
if (value === false && opt.OVERVIEW_MODE === 1) {
|
||||
if (value === false && opt.OVERVIEW_MODE === 1)
|
||||
return;
|
||||
}
|
||||
|
||||
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||
const cornerRadius = scaleFactor * BACKGROUND_CORNER_RADIUS_PIXELS;
|
||||
const cornerRadius = scaleFactor * opt.WS_PREVIEW_BG_RADIUS;
|
||||
|
||||
const backgroundContent = this._bgManager.backgroundActor.content;
|
||||
value = (value !==false)
|
||||
value = value !== false
|
||||
? value
|
||||
: this._stateAdjustment.value;
|
||||
|
||||
backgroundContent.rounded_clip_radius =
|
||||
Util.lerp(0, cornerRadius, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* workspacesAnimation.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -9,31 +9,40 @@
|
|||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { St } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
|
||||
const WorkspaceAnimation = imports.ui.workspaceAnimation;
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
|
||||
// touching module properties defined by const/let for the first time returns undefined in GS 42, so we touch it here before we use it
|
||||
WorkspaceAnimation.MonitorGroup;
|
||||
// first reference to constant defined using const in other module returns undefined, the MonitorGroup const will remain empty and unused
|
||||
let MonitorGroupDummy = WorkspaceAnimation.MonitorGroup;
|
||||
MonitorGroupDummy = null;
|
||||
|
||||
let _origBaseDistance;
|
||||
let _wsAnimationSwipeBeginId;
|
||||
let _wsAnimationSwipeUpdateId;
|
||||
let _wsAnimationSwipeEndId;
|
||||
|
||||
let _overrides;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
_overrides.removeAll();
|
||||
}
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('workspaceAnimationModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
if (reset || !opt.STATIC_WS_SWITCHER_BG) {
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
if (reset || !moduleEnabled) {
|
||||
_connectWsAnimationSwipeTracker(true);
|
||||
_overrideMonitorGroupProperty(true);
|
||||
_overrides = null;
|
||||
|
@ -41,17 +50,19 @@ function update(reset = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (opt.STATIC_WS_SWITCHER_BG) {
|
||||
_overrides = new _Util.Overrides();
|
||||
_connectWsAnimationSwipeTracker();
|
||||
_overrideMonitorGroupProperty();
|
||||
_overrides.addOverride('WorkspaceAnimationMonitorGroup', WorkspaceAnimation.MonitorGroup.prototype, MonitorGroup);
|
||||
}
|
||||
|
||||
_overrides.addInjection('WorkspaceAnimationMonitorGroup', WorkspaceAnimation.MonitorGroup.prototype, MonitorGroupInjections);
|
||||
_connectWsAnimationSwipeTracker();
|
||||
}
|
||||
|
||||
// remove spacing between workspaces during transition to remove flashing wallpaper between workspaces with maximized windows
|
||||
function _overrideMonitorGroupProperty(reset = false) {
|
||||
if (!_origBaseDistance)
|
||||
_origBaseDistance = Object.getOwnPropertyDescriptor(WorkspaceAnimation.MonitorGroup.prototype,'baseDistance').get;
|
||||
_origBaseDistance = Object.getOwnPropertyDescriptor(WorkspaceAnimation.MonitorGroup.prototype, 'baseDistance').get;
|
||||
|
||||
let getter;
|
||||
if (reset) {
|
||||
|
@ -59,28 +70,29 @@ function _overrideMonitorGroupProperty(reset = false) {
|
|||
getter = { get: _origBaseDistance };
|
||||
} else {
|
||||
getter = {
|
||||
get: function () {
|
||||
//const spacing = 100 * St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
get() {
|
||||
// const spacing = 100 * imports.gi.St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
const spacing = 0;
|
||||
if (global.workspace_manager.layout_rows === -1)
|
||||
return this._monitor.height + spacing + (opt.PANEL_MODE ? Main.panel.height : 0); // compensation for hidden panel
|
||||
else
|
||||
return this._monitor.width + spacing;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (getter)
|
||||
Object.defineProperty(WorkspaceAnimation.MonitorGroup.prototype, "baseDistance", getter);
|
||||
Object.defineProperty(WorkspaceAnimation.MonitorGroup.prototype, 'baseDistance', getter);
|
||||
}
|
||||
|
||||
const MonitorGroupInjections = {
|
||||
_init: function() {
|
||||
const MonitorGroup = {
|
||||
// injection to _init()
|
||||
after__init() {
|
||||
// we have two options to implement static bg feature
|
||||
// one is adding background to monitorGroup
|
||||
// but this one has disadvantage - sticky windows will be always on top of animated windows
|
||||
// which is bad for conky, for example, that window should be always below
|
||||
/*this._bgManager = new Background.BackgroundManager({
|
||||
/* this._bgManager = new Background.BackgroundManager({
|
||||
container: this,
|
||||
monitorIndex: this._monitor.index,
|
||||
controlPosition: false,
|
||||
|
@ -92,21 +104,22 @@ const MonitorGroupInjections = {
|
|||
this.set_style('background-color: transparent;');
|
||||
// stickyGroup holds the Always on Visible Workspace windows to keep them static and above other windows during animation
|
||||
const stickyGroup = this.get_children()[1];
|
||||
stickyGroup._windowRecords.forEach((r, index) => {
|
||||
stickyGroup._windowRecords.forEach(r => {
|
||||
const metaWin = r.windowActor.metaWindow;
|
||||
// conky is sticky but should never get above other windows during ws animation
|
||||
// so we hide it from the overlay group, we will see the original if not covered by other windows
|
||||
if (metaWin.wm_class == 'conky') {
|
||||
if (metaWin.wm_class === 'conky')
|
||||
r.clone.opacity = 0;
|
||||
}
|
||||
})
|
||||
});
|
||||
this._hiddenWindows = [];
|
||||
// remove (hide) background wallpaper from the animation, we will see the original one
|
||||
this._workspaceGroups.forEach(w => w._background.opacity = 0);
|
||||
this._workspaceGroups.forEach(w => {
|
||||
w._background.opacity = 0;
|
||||
});
|
||||
// hide (scale to 0) all non-sticky windows, their clones will be animated
|
||||
global.get_window_actors().forEach(actor => {
|
||||
const metaWin = actor.metaWindow;
|
||||
if (metaWin?.get_monitor() === this._monitor.index && !(metaWin?.wm_class == 'conky' && metaWin?.is_on_all_workspaces())) { //* && !w.is_on_all_workspaces()*/) {
|
||||
if (metaWin?.get_monitor() === this._monitor.index && !(metaWin?.wm_class === 'conky' && metaWin?.is_on_all_workspaces())) { //* && !w.is_on_all_workspaces()*/) {
|
||||
// hide original window. we cannot use opacity since it also affects clones.
|
||||
// scaling them to 0 works well
|
||||
actor.scale_x = 0;
|
||||
|
@ -116,16 +129,13 @@ const MonitorGroupInjections = {
|
|||
|
||||
// restore all hidden windows at the end of animation
|
||||
// todo - actors removed during transition need to be removed from the list to avoid access to destroyed actor
|
||||
this.connect('destroy', () =>{
|
||||
this.connect('destroy', () => {
|
||||
this._hiddenWindows.forEach(actor => {
|
||||
actor.scale_x = 1;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------ connect Ws Animation Swipe Tracker --------------
|
||||
},
|
||||
};
|
||||
|
||||
function _connectWsAnimationSwipeTracker(reset = false) {
|
||||
if (reset) {
|
||||
|
@ -139,35 +149,30 @@ function _connectWsAnimationSwipeTracker(reset = false) {
|
|||
}
|
||||
} else if (!_wsAnimationSwipeBeginId) {
|
||||
// display ws switcher popup when gesture begins and connect progress
|
||||
_wsAnimationSwipeBeginId = Main.wm._workspaceAnimation._swipeTracker.connect('begin', _connectWsAnimationProgress);
|
||||
_wsAnimationSwipeBeginId = Main.wm._workspaceAnimation._swipeTracker.connect('begin', () => _connectWsAnimationProgress(true));
|
||||
// we want to be sure that popup with the final ws index show up when gesture ends
|
||||
_wsAnimationSwipeEndId = Main.wm._workspaceAnimation._swipeTracker.connect('end', () => _showWsSwitcherPopup(0));
|
||||
_wsAnimationSwipeEndId = Main.wm._workspaceAnimation._swipeTracker.connect('end', (tracker, duration, endProgress) => _connectWsAnimationProgress(false, endProgress));
|
||||
}
|
||||
}
|
||||
|
||||
function _connectWsAnimationProgress() {
|
||||
if (Main.overview.visible) return;
|
||||
function _connectWsAnimationProgress(connect, endProgress = null) {
|
||||
if (Main.overview.visible)
|
||||
return;
|
||||
|
||||
// progress is being updated only when user finished gesture and the animation continues on "autopilot"
|
||||
Main.wm._workspaceAnimation._switchData.monitors[0].connect('notify::progress',(actor) => {
|
||||
const progress = actor.progress % 1;
|
||||
let direction = 0;
|
||||
if (!actor._prg) actor._prg = progress;
|
||||
else if (!progress) return;
|
||||
else if (progress < actor._prg) direction = -1;
|
||||
else if (progress > actor._prg) direction = 1;
|
||||
if (progress < 0.6 && progress > 0.4)
|
||||
_showWsSwitcherPopup(direction);
|
||||
});
|
||||
|
||||
// display popup when gesture begins
|
||||
_showWsSwitcherPopup(0);
|
||||
if (connect && !_wsAnimationSwipeUpdateId) {
|
||||
_wsAnimationSwipeUpdateId = Main.wm._workspaceAnimation._swipeTracker.connect('update', (tracker, progress) => _showWsSwitcherPopup(progress));
|
||||
} else if (!connect && _wsAnimationSwipeUpdateId) {
|
||||
Main.wm._workspaceAnimation._swipeTracker.disconnect(_wsAnimationSwipeUpdateId);
|
||||
_wsAnimationSwipeUpdateId = 0;
|
||||
_showWsSwitcherPopup(Math.round(endProgress));
|
||||
}
|
||||
}
|
||||
|
||||
function _showWsSwitcherPopup(direction) {
|
||||
if (Main.overview.visible) return;
|
||||
function _showWsSwitcherPopup(progress) {
|
||||
if (Main.overview.visible)
|
||||
return;
|
||||
|
||||
const wsIndex = global.workspaceManager.get_active_workspace_index() + direction;
|
||||
const wsIndex = Math.round(progress);
|
||||
if (Main.wm._workspaceSwitcherPopup === null) {
|
||||
Main.wm._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
|
||||
Main.wm._workspaceSwitcherPopup.connect('destroy', () => {
|
90
extensions/vertical-workspaces/lib/workspaceSwitcherPopup.js
Normal file
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* workspacesSwitcherPopup.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @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.lib.util;
|
||||
let _overrides;
|
||||
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('workspaceSwitcherPopupModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
|
||||
_firstRun = false;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
const enabled = global.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 (allowWsPopupInjection) { // 1-VERTICAL, 0-HORIZONTAL
|
||||
_overrides.addOverride('WorkspaceSwitcherPopup', WorkspaceSwitcherPopup.WorkspaceSwitcherPopup.prototype, WorkspaceSwitcherPopupOverride);
|
||||
}
|
||||
}
|
||||
|
||||
const WorkspaceSwitcherPopupOverride = {
|
||||
// injection to _init()
|
||||
after__init() {
|
||||
if (opt.ORIENTATION) { // 1-VERTICAL, 0-HORIZONTAL
|
||||
this._list.vertical = true;
|
||||
}
|
||||
this._list.set_style('margin: 0;');
|
||||
this.remove_constraint(this.get_constraints()[0]);
|
||||
},
|
||||
|
||||
// injection to display()
|
||||
after_display() {
|
||||
if (opt.WS_SW_POPUP_MODE)
|
||||
this._setPopupPosition();
|
||||
else
|
||||
this.opacity = 0;
|
||||
},
|
||||
|
||||
_setPopupPosition() {
|
||||
let workArea;
|
||||
if (opt.WS_SW_POPUP_MODE === 1) {
|
||||
// workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);*/
|
||||
workArea = global.display.get_monitor_geometry(Main.layoutManager.primaryIndex);
|
||||
} else {
|
||||
// workArea = Main.layoutManager.getWorkAreaForMonitor(global.display.get_current_monitor());
|
||||
workArea = global.display.get_monitor_geometry(global.display.get_current_monitor());
|
||||
}
|
||||
|
||||
let [, natHeight] = this.get_preferred_height(global.screen_width);
|
||||
let [, natWidth] = this.get_preferred_width(natHeight);
|
||||
let h = opt.WS_SW_POPUP_H_POSITION;
|
||||
let v = opt.WS_SW_POPUP_V_POSITION;
|
||||
this.x = workArea.x + Math.floor((workArea.width - natWidth) * h);
|
||||
this.y = workArea.y + Math.floor((workArea.height - natHeight) * v);
|
||||
this.set_position(this.x, this.y);
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* workspacesView.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
|
@ -15,27 +15,30 @@ const { GObject, Clutter, Meta, St } = imports.gi;
|
|||
const Main = imports.ui.main;
|
||||
const Util = imports.misc.util;
|
||||
const WorkspacesView = imports.ui.workspacesView;
|
||||
//const SecondaryMonitorDisplay = WorkspacesView.SecondaryMonitorDisplay;
|
||||
// first call of item defined using const in other module returns undefined
|
||||
WorkspacesView.SecondaryMonitorDisplay;
|
||||
// first reference to constant defined using const in other module returns undefined, the SecondaryMonitorDisplay const will remain empty and unused
|
||||
const SecondaryMonitorDisplay = WorkspacesView.SecondaryMonitorDisplay;
|
||||
const ControlsState = imports.ui.overviewControls.ControlsState;
|
||||
const FitMode = imports.ui.workspacesView.FitMode;
|
||||
|
||||
const SIDE_CONTROLS_ANIMATION_TIME = imports.ui.overview.ANIMATION_TIME;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.windowSearchProvider.prefix;
|
||||
const SEARCH_RECENT_FILES_PREFIX = Me.imports.recentFilesSearchProvider.prefix;
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.lib.windowSearchProvider.prefix;
|
||||
const SEARCH_RECENT_FILES_PREFIX = Me.imports.lib.recentFilesSearchProvider.prefix;
|
||||
|
||||
const _Util = Me.imports.util;
|
||||
const _Util = Me.imports.lib.util;
|
||||
let _overrides;
|
||||
|
||||
let opt;
|
||||
|
||||
|
||||
|
||||
function update(reset = false) {
|
||||
if (_overrides) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
opt.DESKTOP_CUBE_ENABLED = Main.extensionManager._enabledExtensions.includes('desktop-cube@schneegans.github.com');
|
||||
const cubeSupported = opt.DESKTOP_CUBE_ENABLED && !opt.ORIENTATION && !opt.OVERVIEW_MODE;
|
||||
|
||||
// if desktop cube extension is enabled while V-Shell is loaded, removeAll() would override its code
|
||||
if (_overrides && !cubeSupported) {
|
||||
_overrides.removeAll();
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT, false, 1, -1);
|
||||
}
|
||||
|
@ -46,12 +49,14 @@ function update(reset = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
opt = Me.imports.settings.opt;
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
|
||||
if (!cubeSupported)
|
||||
_overrides.addOverride('WorkspacesView', WorkspacesView.WorkspacesView.prototype, WorkspacesViewCommon);
|
||||
|
||||
_overrides.addOverride('WorkspacesDisplay', WorkspacesView.WorkspacesDisplay.prototype, WorkspacesDisplay);
|
||||
_overrides.addOverride('ExtraWorkspaceView', WorkspacesView.ExtraWorkspaceView.prototype, ExtraWorkspaceView);
|
||||
|
||||
if (opt.ORIENTATION) {
|
||||
// switch internal workspace orientation in GS
|
||||
|
@ -62,8 +67,8 @@ function update(reset = false) {
|
|||
}
|
||||
}
|
||||
|
||||
var WorkspacesViewCommon = {
|
||||
_getFirstFitSingleWorkspaceBox: function(box, spacing, vertical) {
|
||||
const WorkspacesViewCommon = {
|
||||
_getFirstFitSingleWorkspaceBox(box, spacing, vertical) {
|
||||
let [width, height] = box.get_size();
|
||||
const [workspace] = this._workspaces;
|
||||
|
||||
|
@ -74,8 +79,8 @@ var WorkspacesViewCommon = {
|
|||
|
||||
// Single fit mode implies centered too
|
||||
let [x1, y1] = box.get_origin();
|
||||
const [, workspaceWidth] = workspace ? workspace.get_preferred_width(Math.floor(height)) : [,width];
|
||||
const [, workspaceHeight] = workspace ? workspace.get_preferred_height(workspaceWidth) : [,height];
|
||||
const [, workspaceWidth] = workspace ? workspace.get_preferred_width(Math.floor(height)) : [0, width];
|
||||
const [, workspaceHeight] = workspace ? workspace.get_preferred_height(workspaceWidth) : [0, height];
|
||||
|
||||
if (vertical) {
|
||||
x1 += (width - workspaceWidth) / 2;
|
||||
|
@ -85,7 +90,7 @@ var WorkspacesViewCommon = {
|
|||
x1 -= currentWorkspace * (workspaceWidth + spacing);
|
||||
}
|
||||
|
||||
const fitSingleBox = new Clutter.ActorBox({x1, y1});
|
||||
const fitSingleBox = new Clutter.ActorBox({ x1, y1 });
|
||||
|
||||
fitSingleBox.set_size(workspaceWidth, workspaceHeight);
|
||||
|
||||
|
@ -93,11 +98,12 @@ var WorkspacesViewCommon = {
|
|||
},
|
||||
|
||||
// set spacing between ws previews
|
||||
_getSpacing: function(box, fitMode, vertical) {
|
||||
_getSpacing(box, fitMode, vertical) {
|
||||
const [width, height] = box.get_size();
|
||||
const [workspace] = this._workspaces;
|
||||
|
||||
if (!workspace) return;
|
||||
if (!workspace)
|
||||
return 0;
|
||||
|
||||
let availableSpace;
|
||||
let workspaceSize;
|
||||
|
@ -117,12 +123,12 @@ var WorkspacesViewCommon = {
|
|||
},
|
||||
|
||||
// this function has duplicate in OverviewControls so we use one function for both to avoid issues with syncing them
|
||||
_getFitModeForState: function(state) {
|
||||
_getFitModeForState(state) {
|
||||
return _getFitModeForState(state);
|
||||
},
|
||||
|
||||
// normal view 0, spread windows 1
|
||||
_getWorkspaceModeForOverviewState: function(state) {
|
||||
_getWorkspaceModeForOverviewState(state) {
|
||||
|
||||
switch (state) {
|
||||
case ControlsState.HIDDEN:
|
||||
|
@ -130,14 +136,15 @@ var WorkspacesViewCommon = {
|
|||
case ControlsState.WINDOW_PICKER:
|
||||
return opt.WORKSPACE_MODE;
|
||||
case ControlsState.APP_GRID:
|
||||
return ((this._monitorIndex !== global.display.get_primary_monitor() || !opt.WS_ANIMATION) && !opt.OVERVIEW_MODE) ? 1 : 0;
|
||||
return (this._monitorIndex !== global.display.get_primary_monitor() || !opt.WS_ANIMATION) && !opt.OVERVIEW_MODE ? 1 : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
_updateVisibility: function() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
_updateVisibility() {
|
||||
// replaced in _updateWorkspacesState
|
||||
/* let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
const fitMode = this._fitModeAdjustment.value;
|
||||
|
@ -146,17 +153,15 @@ var WorkspacesViewCommon = {
|
|||
for (let w = 0; w < this._workspaces.length; w++) {
|
||||
let workspace = this._workspaces[w];
|
||||
|
||||
if (this._animating || this._gestureActive || !singleFitMode) {
|
||||
//workspace.show();
|
||||
} else {
|
||||
if (this._animating || this._gestureActive || !singleFitMode)
|
||||
workspace.show();
|
||||
else
|
||||
workspace.visible = Math.abs(w - active) <= opt.NUMBER_OF_VISIBLE_NEIGHBORS;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
},
|
||||
|
||||
// disable scaling and hide inactive workspaces
|
||||
_updateWorkspacesState: function() {
|
||||
_updateWorkspacesState() {
|
||||
const adj = this._scrollAdjustment;
|
||||
const fitMode = this._fitModeAdjustment.value;
|
||||
|
||||
|
@ -168,12 +173,11 @@ var WorkspacesViewCommon = {
|
|||
this._getWorkspaceModeForOverviewState(finalState),
|
||||
progress);
|
||||
|
||||
|
||||
const currentMonitor = Main.layoutManager.primaryMonitor.index;
|
||||
const primaryMonitor = Main.layoutManager.primaryMonitor.index;
|
||||
|
||||
// define the transition values here to save time in each ws
|
||||
let scaleX, scaleY;
|
||||
if (opt.ORIENTATION) { //vertical 1 / horizontal 0
|
||||
if (opt.ORIENTATION) { // vertical 1 / horizontal 0
|
||||
scaleX = 1;
|
||||
scaleY = 0.1;
|
||||
} else {
|
||||
|
@ -181,39 +185,33 @@ var WorkspacesViewCommon = {
|
|||
scaleY = 1;
|
||||
}
|
||||
|
||||
const wsScrollProgress = adj.value % 1;
|
||||
const secondaryMonitor = this._monitorIndex !== global.display.get_primary_monitor();
|
||||
const blockSecondaryAppGrid = opt.OVERVIEW_MODE && currentState >= 1;
|
||||
const blockSecondaryAppGrid = opt.OVERVIEW_MODE && currentState > 1;
|
||||
// Hide inactive workspaces
|
||||
this._workspaces.forEach((w, index) => {
|
||||
if (!(blockSecondaryAppGrid && secondaryMonitor))
|
||||
w.stateAdjustment.value = workspaceMode;
|
||||
//w.stateAdjustment.value = workspaceMode;
|
||||
|
||||
const distanceToCurrentWorkspace = Math.abs(adj.value - index);
|
||||
|
||||
const scaleProgress = 1 - Math.clamp(distanceToCurrentWorkspace, 0, 1);
|
||||
|
||||
// if we disable workspaces that we can't or don't need to see, transition animations will be noticeably smoother
|
||||
|
||||
// only the current ws needs to be visible during overview transition animations
|
||||
// and only current and adjacent ws when switching ws
|
||||
if (opt.WORKSPACE_MAX_SPACING > 340) { // large spacing - only one workspace needs to be visible at once in the overview
|
||||
w.visible = scaleProgress || ((currentState % 1) && !distanceToCurrentWorkspace);
|
||||
|
||||
// horizontal orientation - 2 adjacent workspaces can be visible on the screen with the current one
|
||||
// in order to keep animations as smooth as possible, hide all ws that cannot/shouldn't be visible at the given time
|
||||
} else {
|
||||
//
|
||||
w.visible = w.monitorIndex !== currentMonitor || scaleProgress || (!opt.WS_ANIMATION && distanceToCurrentWorkspace < opt.NUMBER_OF_VISIBLE_NEIGHBORS)
|
||||
|| (distanceToCurrentWorkspace < opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState <= ControlsState.WINDOW_PICKER
|
||||
&& ((initialState < ControlsState.APP_GRID && finalState < ControlsState.APP_GRID))
|
||||
w.visible = (this._animating && wsScrollProgress && distanceToCurrentWorkspace <= (opt.NUMBER_OF_VISIBLE_NEIGHBORS + 1)) || scaleProgress === 1 ||
|
||||
(opt.WORKSPACE_MAX_SPACING > 340 && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState === ControlsState.WINDOW_PICKER) ||
|
||||
(this._monitorIndex !== primaryMonitor && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS) || (!opt.WS_ANIMATION && distanceToCurrentWorkspace < opt.NUMBER_OF_VISIBLE_NEIGHBORS) ||
|
||||
(opt.WORKSPACE_MAX_SPACING < 340 && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState <= ControlsState.WINDOW_PICKER &&
|
||||
((initialState < ControlsState.APP_GRID && finalState < ControlsState.APP_GRID))
|
||||
);
|
||||
|
||||
// after transition from APP_GRID to WINDOW_PICKER state,
|
||||
// adjacent workspaces are hidden and we need them to show up
|
||||
// make them visible during animation can impact smoothness of the animation
|
||||
// so we show them after the animation finished, scaling animation will make impression that they move in from outside the monitor
|
||||
if (!w.visible && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState === ControlsState.WINDOW_PICKER) {
|
||||
if (!w.visible && distanceToCurrentWorkspace === 1 && initialState === ControlsState.APP_GRID && currentState === ControlsState.WINDOW_PICKER) {
|
||||
w.scale_x = scaleX;
|
||||
w.scale_y = scaleY;
|
||||
w.visible = true;
|
||||
|
@ -223,92 +221,107 @@ var WorkspacesViewCommon = {
|
|||
scale_y: 1,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
} else if (!w.visible && distanceToCurrentWorkspace <= opt.NUMBER_OF_VISIBLE_NEIGHBORS && currentState === ControlsState.WINDOW_PICKER) {
|
||||
w.set({
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
});
|
||||
}
|
||||
|
||||
// force ws preview bg corner radiuses where GS doesn't do it
|
||||
if (opt.SHOW_WS_PREVIEW_BG && opt.OVERVIEW_MODE === 1 && distanceToCurrentWorkspace < 2) {
|
||||
if (opt.SHOW_WS_PREVIEW_BG && opt.OVERVIEW_MODE === 1 && distanceToCurrentWorkspace < 2)
|
||||
w._background._updateBorderRadius(Math.min(1, w._overviewAdjustment.value));
|
||||
}
|
||||
|
||||
|
||||
// hide workspace background
|
||||
if (!opt.SHOW_WS_PREVIEW_BG && w._background.opacity) {
|
||||
if (!opt.SHOW_WS_PREVIEW_BG && w._background.opacity)
|
||||
w._background.opacity = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// SecondaryMonitorDisplay Vertical
|
||||
var SecondaryMonitorDisplayVertical = {
|
||||
_getThumbnailParamsForState: function(state) {
|
||||
const SecondaryMonitorDisplayVertical = {
|
||||
_getThumbnailParamsForState(state) {
|
||||
|
||||
let opacity, scale, translation_x;
|
||||
let opacity, scale, translationX;
|
||||
switch (state) {
|
||||
case ControlsState.HIDDEN:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_x = 0;
|
||||
if (!Main.layoutManager._startingUp && (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2)) {
|
||||
translation_x = this._thumbnails.width * (opt.SEC_WS_TMB_LEFT ? -1 : 1);
|
||||
}
|
||||
translationX = 0;
|
||||
if (!Main.layoutManager._startingUp && (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2))
|
||||
translationX = this._thumbnails.width * (opt.SEC_WS_TMB_LEFT ? -1 : 1);
|
||||
|
||||
break;
|
||||
case ControlsState.WINDOW_PICKER:
|
||||
case ControlsState.APP_GRID:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_x = 0;
|
||||
translationX = 0;
|
||||
break;
|
||||
default:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_x = 0;
|
||||
translationX = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return { opacity, scale, translation_x };
|
||||
return { opacity, scale, translationX };
|
||||
},
|
||||
|
||||
_getThumbnailsWidth: function(box, spacing) {
|
||||
if (!this._thumbnails.visible)
|
||||
_getThumbnailsWidth(box, spacing) {
|
||||
if (opt.SEC_WS_TMB_HIDDEN)
|
||||
return 0;
|
||||
|
||||
const [width, height] = box.get_size();
|
||||
const { expandFraction } = this._thumbnails;
|
||||
const [, thumbnailsWidth] = this._thumbnails.get_preferred_custom_width(height - 2 * spacing);
|
||||
let scaledWidth;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED)
|
||||
scaledWidth = ((height - Main.panel.height) * opt.SEC_MAX_THUMBNAIL_SCALE) * (width / height);
|
||||
else
|
||||
scaledWidth = width * opt.SEC_MAX_THUMBNAIL_SCALE;
|
||||
|
||||
return Math.min(
|
||||
thumbnailsWidth * expandFraction,
|
||||
width * opt.MAX_THUMBNAIL_SCALE);
|
||||
Math.round(scaledWidth));
|
||||
},
|
||||
|
||||
_getWorkspacesBoxForState: function(state, box, padding, thumbnailsWidth, spacing) {
|
||||
//const { ControlsState } = OverviewControls;
|
||||
_getWorkspacesBoxForState(state, box, padding, thumbnailsWidth, spacing) {
|
||||
// const { ControlsState } = OverviewControls;
|
||||
const workspaceBox = box.copy();
|
||||
const [width, height] = workspaceBox.get_size();
|
||||
|
||||
let wWidth, wHeight, wsbX, wsbY, offset, yShift;
|
||||
switch (state) {
|
||||
case ControlsState.HIDDEN:
|
||||
break;
|
||||
case ControlsState.WINDOW_PICKER:
|
||||
case ControlsState.APP_GRID:
|
||||
if (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE) {
|
||||
if (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE)
|
||||
break;
|
||||
|
||||
yShift = 0;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED) {
|
||||
if (opt.PANEL_POSITION_TOP)
|
||||
yShift = Main.panel.height;
|
||||
else
|
||||
yShift = -Main.panel.height;
|
||||
}
|
||||
|
||||
let wWidth = Math.round(width - thumbnailsWidth - 5 * spacing);
|
||||
let wHeight = Math.round(Math.min(wWidth / (width / height), height - 1.7 * padding));
|
||||
wWidth *= opt.WS_PREVIEW_SCALE;
|
||||
wHeight *= opt.WS_PREVIEW_SCALE;
|
||||
wWidth = width - thumbnailsWidth - 5 * spacing;
|
||||
wHeight = Math.min(wWidth / (width / height) - Math.abs(yShift), height - 4 * spacing);
|
||||
wWidth = Math.round(wWidth * opt.SEC_WS_PREVIEW_SCALE);
|
||||
wHeight = Math.round(wHeight * opt.SEC_WS_PREVIEW_SCALE);
|
||||
|
||||
let wsbX;
|
||||
let offset = Math.round(width - thumbnailsWidth - wWidth) / 2;
|
||||
if (opt.SEC_WS_TMB_LEFT) {
|
||||
offset = Math.round(width - thumbnailsWidth - wWidth) / 2;
|
||||
if (opt.SEC_WS_TMB_LEFT)
|
||||
wsbX = thumbnailsWidth + offset;
|
||||
} else {
|
||||
else
|
||||
wsbX = offset;
|
||||
}
|
||||
|
||||
const wsbY = Math.round((height - wHeight) / 2);
|
||||
wsbY = Math.round((height - wHeight - Math.abs(yShift)) / 2 + yShift);
|
||||
|
||||
workspaceBox.set_origin(wsbX, wsbY);
|
||||
workspaceBox.set_size(wWidth, wHeight);
|
||||
|
@ -318,7 +331,7 @@ var SecondaryMonitorDisplayVertical = {
|
|||
return workspaceBox;
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box) {
|
||||
vfunc_allocate(box) {
|
||||
this.set_allocation(box);
|
||||
|
||||
const themeNode = this.get_theme_node();
|
||||
|
@ -332,7 +345,7 @@ var SecondaryMonitorDisplayVertical = {
|
|||
let [, thumbnailsHeight] = this._thumbnails.get_preferred_custom_height(thumbnailsWidth);
|
||||
thumbnailsHeight = Math.min(thumbnailsHeight, height - 2 * spacing);
|
||||
|
||||
this._thumbnails.visible = opt.SHOW_WS_TMB;
|
||||
this._thumbnails.visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
if (this._thumbnails.visible) {
|
||||
let wsTmbX;
|
||||
if (opt.SEC_WS_TMB_LEFT) { // left
|
||||
|
@ -373,13 +386,12 @@ var SecondaryMonitorDisplayVertical = {
|
|||
this._workspacesView.allocate(workspacesBox);
|
||||
},
|
||||
|
||||
_updateThumbnailVisibility: function() {
|
||||
if (opt.OVERVIEW_MODE2) {
|
||||
_updateThumbnailVisibility() {
|
||||
if (opt.OVERVIEW_MODE2)
|
||||
this.set_child_above_sibling(this._thumbnails, null);
|
||||
}
|
||||
|
||||
const visible = !(this._settings.get_boolean('workspaces-only-on-primary') ||
|
||||
opt.SEC_WS_TMB_POSITION === 3); // 3 - disabled
|
||||
|
||||
const visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
|
||||
if (this._thumbnails.visible === visible)
|
||||
return;
|
||||
|
@ -396,15 +408,15 @@ var SecondaryMonitorDisplayVertical = {
|
|||
});
|
||||
},
|
||||
|
||||
_updateThumbnailParams: function() {
|
||||
_updateThumbnailParams() {
|
||||
if (opt.SEC_WS_TMB_HIDDEN)
|
||||
return;
|
||||
|
||||
// workaround for upstream bug - secondary thumbnails boxes don't catch 'showing' signal on the shell startup and don't populate the box with thumbnails
|
||||
// the tmbBox contents is also destroyed when overview state adjustment gets above 1 when swiping gesture from window picker to app grid
|
||||
if (!this._thumbnails._thumbnails.length) {
|
||||
if (!this._thumbnails._thumbnails.length)
|
||||
this._thumbnails._createThumbnails();
|
||||
}
|
||||
|
||||
if (!this._thumbnails.visible)
|
||||
return;
|
||||
|
||||
const { initialState, finalState, progress } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
@ -412,113 +424,122 @@ var SecondaryMonitorDisplayVertical = {
|
|||
const initialParams = this._getThumbnailParamsForState(initialState);
|
||||
const finalParams = this._getThumbnailParamsForState(finalState);
|
||||
|
||||
/*const opacity =
|
||||
/* const opacity =
|
||||
Util.lerp(initialParams.opacity, finalParams.opacity, progress);
|
||||
const scale =
|
||||
Util.lerp(initialParams.scale, finalParams.scale, progress);*/
|
||||
|
||||
// OVERVIEW_MODE 2 should animate dash and wsTmbBox only if WORKSPACE_MODE === 0 (windows not spread)
|
||||
const animateOverviewMode2 = opt.OVERVIEW_MODE2 && !(finalState === 1 && opt.WORKSPACE_MODE);
|
||||
const translation_x = (!Main.layoutManager._startingUp && ((!opt.SHOW_WS_PREVIEW_BG && !(opt.OVERVIEW_MODE2)) || animateOverviewMode2))
|
||||
? Util.lerp(initialParams.translation_x, finalParams.translation_x, progress)
|
||||
const translationX = !Main.layoutManager._startingUp && ((!opt.SHOW_WS_PREVIEW_BG && !opt.OVERVIEW_MODE2) || animateOverviewMode2)
|
||||
? Util.lerp(initialParams.translationX, finalParams.translationX, progress)
|
||||
: 0;
|
||||
|
||||
this._thumbnails.set({
|
||||
opacity: 255,
|
||||
//scale_x: scale,
|
||||
//scale_y: scale,
|
||||
translation_x,
|
||||
// scale_x: scale,
|
||||
// scale_y: scale,
|
||||
translation_x: translationX,
|
||||
});
|
||||
},
|
||||
|
||||
_updateWorkspacesView: function() {
|
||||
_updateWorkspacesView() {
|
||||
if (this._workspacesView)
|
||||
this._workspacesView.destroy();
|
||||
|
||||
if (this._settings.get_boolean('workspaces-only-on-primary')) {
|
||||
opt.SEC_WS_TMB_HIDDEN = true;
|
||||
this._workspacesView = new WorkspacesView.ExtraWorkspaceView(
|
||||
this._monitorIndex,
|
||||
this._overviewAdjustment);
|
||||
} else {
|
||||
opt.SEC_WS_TMB_HIDDEN = !opt.SHOW_SEC_WS_TMB;
|
||||
this._workspacesView = new WorkspacesView.WorkspacesView(
|
||||
this._monitorIndex,
|
||||
this._controls,
|
||||
this._scrollAdjustment,
|
||||
// Secondary monitors don't need FitMode.ALL since there is workspace switcher always visible
|
||||
//this._fitModeAdjustment,
|
||||
// this._fitModeAdjustment,
|
||||
new St.Adjustment({
|
||||
actor: this,
|
||||
value: 0,//FitMode.SINGLE,
|
||||
lower: 0,//FitMode.SINGLE,
|
||||
upper: 0,//FitMode.SINGLE,
|
||||
value: 0, // FitMode.SINGLE,
|
||||
lower: 0, // FitMode.SINGLE,
|
||||
upper: 0, // FitMode.SINGLE,
|
||||
}),
|
||||
//secondaryOverviewAdjustment);
|
||||
// secondaryOverviewAdjustment);
|
||||
this._overviewAdjustment);
|
||||
}
|
||||
this.add_child(this._workspacesView);
|
||||
this._thumbnails.opacity = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// SecondaryMonitorDisplay Horizontal
|
||||
var SecondaryMonitorDisplayHorizontal = {
|
||||
_getThumbnailParamsForState: function(state) {
|
||||
//const { ControlsState } = OverviewControls;
|
||||
const SecondaryMonitorDisplayHorizontal = {
|
||||
_getThumbnailParamsForState(state) {
|
||||
// const { ControlsState } = OverviewControls;
|
||||
|
||||
let opacity, scale, translation_y;
|
||||
let opacity, scale, translationY;
|
||||
switch (state) {
|
||||
case ControlsState.HIDDEN:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_y = 0;
|
||||
if (!Main.layoutManager._startingUp && (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2)) {
|
||||
translation_y = this._thumbnails.height * (opt.SEC_WS_TMB_TOP ? -1 : 1);
|
||||
}
|
||||
translationY = 0;
|
||||
if (!Main.layoutManager._startingUp && (!opt.SHOW_WS_PREVIEW_BG || opt.OVERVIEW_MODE2))
|
||||
translationY = this._thumbnails.height * (opt.SEC_WS_TMB_TOP ? -1 : 1);
|
||||
|
||||
break;
|
||||
case ControlsState.WINDOW_PICKER:
|
||||
case ControlsState.APP_GRID:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_y = 0;
|
||||
translationY = 0;
|
||||
break;
|
||||
default:
|
||||
opacity = 255;
|
||||
scale = 1;
|
||||
translation_y = 0;
|
||||
translationY = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return { opacity, scale, translation_y };
|
||||
return { opacity, scale, translationY };
|
||||
},
|
||||
|
||||
_getWorkspacesBoxForState: function(state, box, padding, thumbnailsHeight, spacing) {
|
||||
//const { ControlsState } = OverviewControls;
|
||||
_getWorkspacesBoxForState(state, box, padding, thumbnailsHeight, spacing) {
|
||||
// const { ControlsState } = OverviewControls;
|
||||
const workspaceBox = box.copy();
|
||||
const [width, height] = workspaceBox.get_size();
|
||||
|
||||
let wWidth, wHeight, wsbX, wsbY, offset, yShift;
|
||||
switch (state) {
|
||||
case ControlsState.HIDDEN:
|
||||
break;
|
||||
case ControlsState.WINDOW_PICKER:
|
||||
case ControlsState.APP_GRID:
|
||||
if (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE) {
|
||||
if (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE)
|
||||
break;
|
||||
|
||||
yShift = 0;
|
||||
if (opt.SEC_WS_PREVIEW_SHIFT && !opt.PANEL_DISABLED) {
|
||||
if (opt.PANEL_POSITION_TOP)
|
||||
yShift = Main.panel.height;
|
||||
else
|
||||
yShift = -Main.panel.height;
|
||||
}
|
||||
|
||||
let wHeight = Math.round(Math.min(height - thumbnailsHeight - 5 * spacing));
|
||||
let wWidth = Math.round(Math.min(wHeight * (width / height), width - 1.7 * padding));
|
||||
wWidth *= opt.WS_PREVIEW_SCALE;
|
||||
wHeight *= opt.WS_PREVIEW_SCALE;
|
||||
wHeight = height - Math.abs(yShift) - (thumbnailsHeight ? thumbnailsHeight + 4 * spacing : padding);
|
||||
wWidth = Math.min(wHeight * (width / height), width - 5 * spacing);
|
||||
wWidth = Math.round(wWidth * opt.SEC_WS_PREVIEW_SCALE);
|
||||
wHeight = Math.round(wHeight * opt.SEC_WS_PREVIEW_SCALE);
|
||||
|
||||
let wsbY;
|
||||
let offset = Math.round((height - thumbnailsHeight - wHeight) / 2);
|
||||
if (opt.WS_TMB_TOP) {
|
||||
offset = Math.round((height - thumbnailsHeight - wHeight - Math.abs(yShift)) / 2);
|
||||
if (opt.SEC_WS_TMB_TOP)
|
||||
wsbY = thumbnailsHeight + offset;
|
||||
} else {
|
||||
else
|
||||
wsbY = offset;
|
||||
}
|
||||
|
||||
const wsbX = Math.round((width - wWidth) / 2);
|
||||
wsbY += yShift;
|
||||
wsbX = Math.round((width - wWidth) / 2);
|
||||
|
||||
workspaceBox.set_origin(wsbX, wsbY);
|
||||
workspaceBox.set_size(wWidth, wHeight);
|
||||
|
@ -528,8 +549,8 @@ var SecondaryMonitorDisplayHorizontal = {
|
|||
return workspaceBox;
|
||||
},
|
||||
|
||||
_getThumbnailsHeight: function(box) {
|
||||
if (!this._thumbnails.visible)
|
||||
_getThumbnailsHeight(box) {
|
||||
if (opt.SEC_WS_TMB_HIDDEN)
|
||||
return 0;
|
||||
|
||||
const [width, height] = box.get_size();
|
||||
|
@ -537,10 +558,10 @@ var SecondaryMonitorDisplayHorizontal = {
|
|||
const [thumbnailsHeight] = this._thumbnails.get_preferred_height(width);
|
||||
return Math.min(
|
||||
thumbnailsHeight * expandFraction,
|
||||
height * opt.MAX_THUMBNAIL_SCALE);
|
||||
height * opt.SEC_MAX_THUMBNAIL_SCALE);
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box) {
|
||||
vfunc_allocate(box) {
|
||||
this.set_allocation(box);
|
||||
|
||||
const themeNode = this.get_theme_node();
|
||||
|
@ -554,14 +575,14 @@ var SecondaryMonitorDisplayHorizontal = {
|
|||
let [, thumbnailsWidth] = this._thumbnails.get_preferred_custom_width(thumbnailsHeight);
|
||||
thumbnailsWidth = Math.min(thumbnailsWidth, width - 2 * spacing);
|
||||
|
||||
this._thumbnails.visible = opt.SHOW_WS_TMB;
|
||||
this._thumbnails.visible = !opt.SEC_WS_TMB_HIDDEN;
|
||||
if (this._thumbnails.visible) {
|
||||
let wsTmbY;
|
||||
if (opt.SEC_WS_TMB_TOP) {
|
||||
if (opt.SEC_WS_TMB_TOP)
|
||||
wsTmbY = Math.round(spacing / 4);
|
||||
} else {
|
||||
else
|
||||
wsTmbY = Math.round(height - spacing / 4 - thumbnailsHeight);
|
||||
}
|
||||
|
||||
|
||||
const childBox = new Clutter.ActorBox();
|
||||
const availSpace = width - thumbnailsWidth - 2 * spacing;
|
||||
|
@ -595,15 +616,15 @@ var SecondaryMonitorDisplayHorizontal = {
|
|||
|
||||
_updateThumbnailVisibility: SecondaryMonitorDisplayVertical._updateThumbnailVisibility,
|
||||
|
||||
_updateThumbnailParams: function() {
|
||||
_updateThumbnailParams() {
|
||||
if (opt.SEC_WS_TMB_HIDDEN)
|
||||
return;
|
||||
|
||||
// workaround for upstream bug - secondary thumbnails boxes don't catch 'showing' signal on the shell startup and don't populate the box with thumbnails
|
||||
// the tmbBox contents is also destroyed when overview state adjustment gets above 1 when swiping gesture from window picker to app grid
|
||||
if (!this._thumbnails._thumbnails.length) {
|
||||
if (!this._thumbnails._thumbnails.length)
|
||||
this._thumbnails._createThumbnails();
|
||||
}
|
||||
|
||||
if (!this._thumbnails.visible)
|
||||
return;
|
||||
|
||||
const { initialState, finalState, progress } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
@ -611,56 +632,79 @@ var SecondaryMonitorDisplayHorizontal = {
|
|||
const initialParams = this._getThumbnailParamsForState(initialState);
|
||||
const finalParams = this._getThumbnailParamsForState(finalState);
|
||||
|
||||
/*const opacity =
|
||||
/* const opacity =
|
||||
Util.lerp(initialParams.opacity, finalParams.opacity, progress);
|
||||
const scale =
|
||||
Util.lerp(initialParams.scale, finalParams.scale, progress);*/
|
||||
|
||||
// OVERVIEW_MODE 2 should animate dash and wsTmbBox only if WORKSPACE_MODE === 0 (windows not spread)
|
||||
const animateOverviewMode2 = opt.OVERVIEW_MODE2 && !(finalState === 1 && opt.WORKSPACE_MODE);
|
||||
const translation_y = (!Main.layoutManager._startingUp && ((!opt.SHOW_WS_PREVIEW_BG && !(opt.OVERVIEW_MODE2)) || animateOverviewMode2))
|
||||
? Util.lerp(initialParams.translation_y, finalParams.translation_y, progress)
|
||||
const translationY = !Main.layoutManager._startingUp && ((!opt.SHOW_WS_PREVIEW_BG && !opt.OVERVIEW_MODE2) || animateOverviewMode2)
|
||||
? Util.lerp(initialParams.translationY, finalParams.translationY, progress)
|
||||
: 0;
|
||||
|
||||
this._thumbnails.set({
|
||||
opacity: 255,
|
||||
//scale_x: scale,
|
||||
//scale_y: scale,
|
||||
translation_y,
|
||||
// scale_x: scale,
|
||||
// scale_y: scale,
|
||||
translation_y: translationY,
|
||||
});
|
||||
},
|
||||
|
||||
_updateWorkspacesView: function() {
|
||||
_updateWorkspacesView() {
|
||||
if (this._workspacesView)
|
||||
this._workspacesView.destroy();
|
||||
|
||||
if (this._settings.get_boolean('workspaces-only-on-primary')) {
|
||||
opt.SEC_WS_TMB_HIDDEN = true;
|
||||
this._workspacesView = new WorkspacesView.ExtraWorkspaceView(
|
||||
this._monitorIndex,
|
||||
this._overviewAdjustment);
|
||||
} else {
|
||||
opt.SEC_WS_TMB_HIDDEN = !opt.SHOW_SEC_WS_TMB;
|
||||
this._workspacesView = new WorkspacesView.WorkspacesView(
|
||||
this._monitorIndex,
|
||||
this._controls,
|
||||
this._scrollAdjustment,
|
||||
// Secondary monitors don't need FitMode.ALL since there is workspace switcher always visible
|
||||
//this._fitModeAdjustment,
|
||||
// this._fitModeAdjustment,
|
||||
new St.Adjustment({
|
||||
actor: this,
|
||||
value: 0,//FitMode.SINGLE,
|
||||
lower: 0,//FitMode.SINGLE,
|
||||
upper: 0,//FitMode.SINGLE,
|
||||
value: 0, // FitMode.SINGLE,
|
||||
lower: 0, // FitMode.SINGLE,
|
||||
upper: 0, // FitMode.SINGLE,
|
||||
}),
|
||||
//secondaryOverviewAdjustment);
|
||||
// secondaryOverviewAdjustment);
|
||||
this._overviewAdjustment);
|
||||
}
|
||||
this.add_child(this._workspacesView);
|
||||
this._thumbnails.opacity = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var WorkspacesDisplay = {
|
||||
_updateWorkspacesViews: function() {
|
||||
const ExtraWorkspaceView = {
|
||||
_updateWorkspaceMode() {
|
||||
const overviewState = this._overviewAdjustment.value;
|
||||
|
||||
const progress = Math.clamp(overviewState,
|
||||
ControlsState.HIDDEN,
|
||||
opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE ? ControlsState.HIDDEN : ControlsState.WINDOW_PICKER);
|
||||
|
||||
this._workspace.stateAdjustment.value = progress;
|
||||
|
||||
// force ws preview bg corner radiuses where GS doesn't do it
|
||||
if (opt.SHOW_WS_PREVIEW_BG && opt.OVERVIEW_MODE === 1)
|
||||
this._workspace._background._updateBorderRadius(Math.min(1, this._workspace._overviewAdjustment.value));
|
||||
|
||||
|
||||
// hide workspace background
|
||||
if (!opt.SHOW_WS_PREVIEW_BG && this._workspace._background.opacity)
|
||||
this._workspace._background.opacity = 0;
|
||||
},
|
||||
};
|
||||
|
||||
const WorkspacesDisplay = {
|
||||
_updateWorkspacesViews() {
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].destroy();
|
||||
|
||||
|
@ -684,12 +728,12 @@ var WorkspacesDisplay = {
|
|||
this._controls,
|
||||
this._scrollAdjustment,
|
||||
// Secondary monitors don't need FitMode.ALL since there is workspace switcher always visible
|
||||
//this._fitModeAdjustment,
|
||||
// this._fitModeAdjustment,
|
||||
new St.Adjustment({
|
||||
actor: this,
|
||||
value: 0,//FitMode.SINGLE,
|
||||
lower: 0,//FitMode.SINGLE,
|
||||
upper: 0,//FitMode.SINGLE,
|
||||
value: 0, // FitMode.SINGLE,
|
||||
lower: 0, // FitMode.SINGLE,
|
||||
upper: 0, // FitMode.SINGLE,
|
||||
}),
|
||||
this._overviewAdjustment);
|
||||
Main.layoutManager.overviewGroup.add_actor(view);
|
||||
|
@ -699,7 +743,7 @@ var WorkspacesDisplay = {
|
|||
}
|
||||
},
|
||||
|
||||
_onScrollEvent: function(actor, event) {
|
||||
_onScrollEvent(actor, event) {
|
||||
if (this._swipeTracker.canHandleScrollEvent(event))
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
|
@ -707,35 +751,37 @@ var WorkspacesDisplay = {
|
|||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
if (this._workspacesOnlyOnPrimary &&
|
||||
this._getMonitorIndexForEvent(event) != this._primaryIndex)
|
||||
this._getMonitorIndexForEvent(event) !== this._primaryIndex)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
const isShiftPressed = (event.get_state() & Clutter.ModifierType.SHIFT_MASK) != 0;
|
||||
/*const isCtrlPressed = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0;
|
||||
const isAltPressed = (event.get_state() & Clutter.ModifierType.MOD1_MASK) != 0;
|
||||
const noModifiersPressed = !(isCtrlPressed && isShiftPressed && isAltPressed);
|
||||
|
||||
if (OVERVIEW_MODE2 && noModifiersPressed) {
|
||||
Main.overview.hide();
|
||||
if (opt.PANEL_MODE === 1) {
|
||||
const panelBox = Main.layoutManager.panelBox;
|
||||
const [, y] = global.get_pointer();
|
||||
if (y > panelBox.allocation.y1 && y < panelBox.allocation.y2)
|
||||
return Clutter.EVENT_STOP;
|
||||
}*/
|
||||
}
|
||||
|
||||
let direction = event.get_scroll_direction();
|
||||
if (_Util.isShiftPressed()) {
|
||||
let direction = _Util.getScrollDirection(event);
|
||||
if (direction === null || (Date.now() - this._lastScrollTime) < 150)
|
||||
return Clutter.EVENT_STOP;
|
||||
this._lastScrollTime = Date.now();
|
||||
|
||||
if (/*SHIFT_REORDERS_WS && */isShiftPressed) {
|
||||
if (direction === Clutter.ScrollDirection.UP) {
|
||||
if (direction === Clutter.ScrollDirection.UP)
|
||||
direction = -1;
|
||||
}
|
||||
else if (direction === Clutter.ScrollDirection.DOWN) {
|
||||
|
||||
else if (direction === Clutter.ScrollDirection.DOWN)
|
||||
direction = 1;
|
||||
} else {
|
||||
else
|
||||
direction = 0;
|
||||
}
|
||||
|
||||
|
||||
if (direction) {
|
||||
_reorderWorkspace(direction);
|
||||
_Util.reorderWorkspace(direction);
|
||||
// make all workspaces on primary monitor visible for case the new position is hidden
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => w.visible = true);
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => {
|
||||
w.visible = true;
|
||||
});
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
}
|
||||
|
@ -743,24 +789,30 @@ var WorkspacesDisplay = {
|
|||
return Main.wm.handleWorkspaceScroll(event);
|
||||
},
|
||||
|
||||
_onKeyPressEvent: function(actor, event) {
|
||||
_onKeyPressEvent(actor, event) {
|
||||
const symbol = event.get_key_symbol();
|
||||
/*const { ControlsState } = OverviewControls;
|
||||
/* const { ControlsState } = OverviewControls;
|
||||
if (this._overviewAdjustment.value !== ControlsState.WINDOW_PICKER && symbol !== Clutter.KEY_space)
|
||||
return Clutter.EVENT_PROPAGATE;*/
|
||||
|
||||
/*if (!this.reactive)
|
||||
return Clutter.EVENT_PROPAGATE;**/
|
||||
const isCtrlPressed = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0;
|
||||
const isShiftPressed = (event.get_state() & Clutter.ModifierType.SHIFT_MASK) != 0;
|
||||
const isAltPressed = (event.get_state() & Clutter.ModifierType.MOD1_MASK) != 0;
|
||||
/* if (!this.reactive)
|
||||
return Clutter.EVENT_PROPAGATE; */
|
||||
const { workspaceManager } = global;
|
||||
const vertical = workspaceManager.layout_rows === -1;
|
||||
const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
|
||||
const state = this._overviewAdjustment.value;
|
||||
|
||||
let which;
|
||||
switch (symbol) {
|
||||
/*case Clutter.KEY_Return:*/
|
||||
case Clutter.KEY_Return:
|
||||
case Clutter.KEY_KP_Enter:
|
||||
if (_Util.isCtrlPressed()) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Dash')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
}
|
||||
return Clutter.EVENT_STOP;
|
||||
case Clutter.KEY_Page_Up:
|
||||
if (vertical)
|
||||
which = Meta.MotionDirection.UP;
|
||||
|
@ -784,30 +836,57 @@ var WorkspacesDisplay = {
|
|||
which = workspaceManager.n_workspaces - 1;
|
||||
break;
|
||||
case Clutter.KEY_space:
|
||||
if (isCtrlPressed && isShiftPressed) {
|
||||
if (_Util.isCtrlPressed() && _Util.isShiftPressed()) {
|
||||
_Util.openPreferences();
|
||||
} else if (isAltPressed) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {if (i.sortGroup === 1 && i.name === 'Dash') Main.ctrlAltTabManager.focusGroup(i)});
|
||||
} else if (opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED && isCtrlPressed) {
|
||||
} else if (_Util.isAltPressed()) {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Dash')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
} else if (opt.RECENT_FILES_SEARCH_PROVIDER_ENABLED && _Util.isCtrlPressed()) {
|
||||
_Util.activateSearchProvider(SEARCH_RECENT_FILES_PREFIX);
|
||||
} else if (opt.WINDOW_SEARCH_PROVIDER_ENABLED/* && SEARCH_WINDOWS_SPACE*/) {
|
||||
} else if (opt.WINDOW_SEARCH_PROVIDER_ENABLED) {
|
||||
_Util.activateSearchProvider(SEARCH_WINDOWS_PREFIX);
|
||||
}
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
case Clutter.KEY_Down:
|
||||
case Clutter.KEY_Left:
|
||||
case Clutter.KEY_Right:
|
||||
case Clutter.KEY_Up:
|
||||
case Clutter.KEY_Tab:
|
||||
if (Main.overview._overview._controls._searchController.searchActive) {
|
||||
Main.overview.searchEntry.grab_key_focus();
|
||||
} else /*if (OVERVIEW_MODE && !WORKSPACE_MODE)*/ {
|
||||
Main.ctrlAltTabManager._items.forEach(i => {if (i.sortGroup === 1 && i.name === 'Dash') Main.ctrlAltTabManager.focusGroup(i)});
|
||||
} else if (opt.OVERVIEW_MODE2 && !opt.WORKSPACE_MODE && state === 1) {
|
||||
// expose windows by "clicking" on ws thumbnail
|
||||
// in this case overview stateAdjustment will be used for transition
|
||||
Main.overview._overview.controls._thumbnailsBox._activateThumbnailAtPoint(0, 0, global.get_current_time(), true);
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Windows')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
} else if (opt.OVERVIEW_MODE && !opt.WORKSPACE_MODE && state === 1) {
|
||||
// expose windows for OVERVIEW_MODE 1
|
||||
const adjustment = this._workspacesViews[0]._workspaces[global.workspace_manager.get_active_workspace().index()]._background._stateAdjustment;
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
_Util.exposeWindows(adjustment, true);
|
||||
} else {
|
||||
if (state === 2)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
Main.ctrlAltTabManager._items.forEach(i => {
|
||||
if (i.sortGroup === 1 && i.name === 'Windows')
|
||||
Main.ctrlAltTabManager.focusGroup(i);
|
||||
});
|
||||
}
|
||||
|
||||
return Clutter.EVENT_STOP;
|
||||
default:
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
if (state === 2)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let ws;
|
||||
if (which < 0)
|
||||
// Negative workspace numbers are directions
|
||||
|
@ -816,16 +895,18 @@ var WorkspacesDisplay = {
|
|||
// Otherwise it is a workspace index
|
||||
ws = workspaceManager.get_workspace_by_index(which);
|
||||
|
||||
if (/*SHIFT_REORDERS_WS && */isShiftPressed) {
|
||||
if (_Util.isShiftPressed()) {
|
||||
let direction;
|
||||
if (which === Meta.MotionDirection.UP || which === Meta.MotionDirection.LEFT)
|
||||
direction = -1;
|
||||
else if (which === Meta.MotionDirection.DOWN || which === Meta.MotionDirection.RIGHT)
|
||||
direction = 1;
|
||||
if (direction)
|
||||
_reorderWorkspace(direction);
|
||||
_Util.reorderWorkspace(direction);
|
||||
// make all workspaces on primary monitor visible for case the new position is hidden
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => w.visible = true);
|
||||
Main.overview._overview._controls._workspacesDisplay._workspacesViews[0]._workspaces.forEach(w => {
|
||||
w.visible = true;
|
||||
});
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
|
@ -834,7 +915,7 @@ var WorkspacesDisplay = {
|
|||
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// same copy of this function should be available in OverviewControls and WorkspacesView
|
||||
function _getFitModeForState(state) {
|
||||
|
@ -851,14 +932,3 @@ function _getFitModeForState(state) {
|
|||
return FitMode.SINGLE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------ Reorder Workspaces - callback for Dash and workspacesDisplay -----------------------------------
|
||||
|
||||
function _reorderWorkspace(direction = 0) {
|
||||
let activeWs = global.workspace_manager.get_active_workspace();
|
||||
let activeWsIdx = activeWs.index();
|
||||
let targetIdx = activeWsIdx + direction;
|
||||
if (targetIdx > -1 && targetIdx < (global.workspace_manager.get_n_workspaces())) {
|
||||
global.workspace_manager.reorder_workspace(activeWs, targetIdx);
|
||||
}
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
"name": "Vertical Workspaces",
|
||||
"name": "V-Shell (Vertical Workspaces)",
|
||||
"uuid": "vertical-workspaces@G-dH.github.com",
|
||||
"description": "A extension that allows you to customize your desktop interface to suit your workflow and eyes. You can change the horizontal stacking of workspaces to vertical, but also change layout, content, appearance and behavior of Activities overview and workspace switcher.",
|
||||
"description": "Customize your GNOME Shell UX to suit your workflow, whether you like horizontally or vertically stacked workspaces.",
|
||||
"shell-version": [
|
||||
"42",
|
||||
"43"
|
||||
"43",
|
||||
"44"
|
||||
],
|
||||
"url": "https://github.com/G-dH/vertical-workspaces",
|
||||
"gettext-domain": "vertical-workspaces",
|
||||
"settings-schema": "org.gnome.shell.extensions.vertical-workspaces",
|
||||
"version": 23.5
|
||||
"version": 28
|
||||
}
|
||||
|
|
1553
extensions/vertical-workspaces/po/cs.po
Normal file
1389
extensions/vertical-workspaces/po/vertical-workspaces.pot
Normal file
|
@ -16,6 +16,12 @@
|
|||
<key type="i" name="ws-preview-scale">
|
||||
<default>100</default>
|
||||
</key>
|
||||
<key type="i" name="secondary-ws-preview-scale">
|
||||
<default>100</default>
|
||||
</key>
|
||||
<key type="b" name="secondary-ws-preview-shift">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="i" name="dash-position">
|
||||
<default>0</default>
|
||||
</key>
|
||||
|
@ -43,6 +49,9 @@
|
|||
<key type="i" name="sec-wst-position-adjust">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="close-ws-button-mode">
|
||||
<default>2</default>
|
||||
</key>
|
||||
<key type="b" name="center-dash-to-ws">
|
||||
<default>false</default>
|
||||
</key>
|
||||
|
@ -58,14 +67,20 @@
|
|||
<key type="i" name="ws-thumbnail-scale">
|
||||
<default>13</default>
|
||||
</key>
|
||||
<key type="i" name="ws-thumbnail-scale-appgrid">
|
||||
<default>13</default>
|
||||
</key>
|
||||
<key type="i" name="secondary-ws-thumbnail-scale">
|
||||
<default>13</default>
|
||||
</key>
|
||||
<key type="i" name="dash-max-icon-size">
|
||||
<default>48</default>
|
||||
</key>
|
||||
<key type="i" name="dash-bg-opacity">
|
||||
<default>40</default>
|
||||
<default>80</default>
|
||||
</key>
|
||||
<key type="i" name="dash-bg-radius">
|
||||
<default>0</default>
|
||||
<default>17</default>
|
||||
</key>
|
||||
<key type="b" name="enable-page-shortcuts">
|
||||
<default>false</default>
|
||||
|
@ -76,6 +91,9 @@
|
|||
<key type="b" name="show-ws-preview-bg">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="i" name="ws-preview-bg-radius">
|
||||
<default>30</default>
|
||||
</key>
|
||||
<key type="b" name="show-bg-in-overview">
|
||||
<default>true</default>
|
||||
</key>
|
||||
|
@ -85,6 +103,9 @@
|
|||
<key type="i" name="app-grid-bg-blur-sigma">
|
||||
<default>40</default>
|
||||
</key>
|
||||
<key type="i" name="overview-bg-brightness">
|
||||
<default>95</default>
|
||||
</key>
|
||||
<key type="b" name="smooth-blur-transitions">
|
||||
<default>false</default>
|
||||
</key>
|
||||
|
@ -119,44 +140,65 @@
|
|||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="search-icon-size">
|
||||
<default>64</default>
|
||||
<default>96</default>
|
||||
</key>
|
||||
<key type="i" name="search-width-scale">
|
||||
<default>103</default>
|
||||
</key>
|
||||
<key type="b" name="app-grid-allow-custom">
|
||||
<default>false</default>
|
||||
<default>104</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-icon-size">
|
||||
<default>80</default>
|
||||
<default>-1</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-columns">
|
||||
<default>8</default>
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-rows">
|
||||
<default>4</default>
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-order">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-include-dash">
|
||||
<default>0</default>
|
||||
<key type="i" name="app-grid-content">
|
||||
<default>2</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-folder-icon-size">
|
||||
<default>80</default>
|
||||
<default>-1</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-folder-columns">
|
||||
<default>3</default>
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-folder-rows">
|
||||
<default>3</default>
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-spacing">
|
||||
<default>12</default>
|
||||
</key>
|
||||
<key type="b" name="app-grid-incomplete-pages">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-names">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-folder-icon-grid">
|
||||
<default>3</default>
|
||||
</key>
|
||||
<key type="b" name="app-grid-active-preview">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="b" name="app-grid-folder-center">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="i" name="app-grid-page-width-scale">
|
||||
<default>90</default>
|
||||
</key>
|
||||
<key type="i" name="dash-show-windows-before-activation">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="dash-icon-scroll">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="search-windows-icon-scroll">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="b" name="search-windows-enable">
|
||||
<default>true</default>
|
||||
</key>
|
||||
|
@ -167,7 +209,7 @@
|
|||
<default>false</default>
|
||||
</key>
|
||||
<key type="i" name="search-max-results-rows">
|
||||
<default>10</default>
|
||||
<default>5</default>
|
||||
</key>
|
||||
<key type="i" name="panel-visibility">
|
||||
<default>0</default>
|
||||
|
@ -175,5 +217,135 @@
|
|||
<key type="i" name="panel-position">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="window-attention-mode">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="i" name="ws-sw-popup-h-position">
|
||||
<default>50</default>
|
||||
</key>
|
||||
<key type="i" name="ws-sw-popup-v-position">
|
||||
<default>95</default>
|
||||
</key>
|
||||
<key type="i" name="ws-sw-popup-mode">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="favorites-notify">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="notification-position">
|
||||
<default>2</default>
|
||||
</key>
|
||||
<key type="i" name="osd-position">
|
||||
<default>6</default>
|
||||
</key>
|
||||
<key type="i" name="hot-corner-action">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="hot-corner-position">
|
||||
<default>0</default>
|
||||
</key>
|
||||
<key type="b" name="hot-corner-fullscreen">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="b" name="hot-corner-ripples">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="always-activate-selected-window">
|
||||
<default>false</default>
|
||||
</key>
|
||||
<key type="b" name="window-icon-click-search">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="i" name="overlay-key-primary">
|
||||
<default>1</default>
|
||||
</key>
|
||||
<key type="i" name="overlay-key-secondary">
|
||||
<default>1</default>
|
||||
</key>
|
||||
|
||||
<key type="b" name="workspace-thumbnails-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="workspace-switcher-popup-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="workspace-animation-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="workspace-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="window-manager-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="window-preview-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="win-attention-handler-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="swipe-tracker-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="search-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="panel-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="overlay-key-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="osd-window-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="message-tray-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="layout-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="dash-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="app-display-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
<key type="b" name="app-favorites-module">
|
||||
<default>true</default>
|
||||
</key>
|
||||
|
||||
<key type="b" name="aaa-loading-profile">
|
||||
<default>false</default>
|
||||
</key>
|
||||
|
||||
<key type="s" name="profile-name-1">
|
||||
<default>""</default>
|
||||
</key>
|
||||
<key type="a{ss}" name="profile-data-1">
|
||||
<default>{'workspaceThumbnailsPosition': '1', 'wsMaxSpacing': '350', 'wsPreviewScale': '95', 'secWsPreviewScale': '100', 'secWsPreviewShift': 'false', 'wsThumbnailsFull': 'false', 'secWsThumbnailsPosition': '2', 'dashPosition': '3', 'dashPositionAdjust': '0', 'wsTmbPositionAdjust': '-80', 'showWsTmbLabels': '3', 'showWsTmbLabelsOnHover': 'false', 'closeWsButtonMode': '2', 'secWsTmbPositionAdjust': '-80', 'dashMaxIconSize': '64', 'dashShowWindowsIcon': '2', 'dashShowRecentFilesIcon': '2', 'centerDashToWs': 'false', 'showAppsIconPosition': '1', 'wsThumbnailScale': '13', 'wsThumbnailScaleAppGrid': '0', 'secWsThumbnailScale': '13', 'showSearchEntry': 'true', 'centerSearch': 'true', 'centerAppGrid': 'true', 'appGridPageWidthScale': '100', 'dashBgOpacity': '80', 'dashBgRadius': '17', 'enablePageShortcuts': 'true', 'showWsSwitcherBg': 'true', 'showWsPreviewBg': 'false', 'showBgInOverview': 'true', 'overviewBgBrightness': '30', 'overviewBgBlurSigma': '0', 'appGridBgBlurSigma': '0', 'smoothBlurTransitions': 'false', 'appGridAnimation': '4', 'searchViewAnimation': '4', 'workspaceAnimation': '1', 'animationSpeedFactor': '100', 'fixUbuntuDock': 'true', 'winPreviewIconSize': '1', 'alwaysShowWinTitles': 'false', 'startupState': '0', 'overviewMode': '0', 'workspaceSwitcherAnimation': '1', 'searchIconSize': '96', 'searchViewScale': '104', 'appGridIconSize': '-1', 'appGridColumns': '0', 'appGridRows': '0', 'appGridFolderIconSize': '-1', 'appGridFolderColumns': '4', 'appGridFolderRows': '3', 'appGridSpacing': '12', 'appGridFolderIconGrid': '2', 'appGridContent': '2', 'appGridIncompletePages': 'false', 'appGridOrder': '0', 'appGridNamesMode': '0', 'appGridActivePreview': 'false', 'appGridFolderCenter': 'false', 'searchWindowsEnable': 'true', 'searchRecentFilesEnable': 'true', 'searchFuzzy': 'false', 'searchMaxResultsRows': '5', 'dashShowWindowsBeforeActivation': '1', 'panelVisibility': '0', 'panelPosition': '0', 'windowAttentionMode': '0', 'wsSwPopupHPosition': '50', 'wsSwPopupVPosition': '50', 'wsSwPopupMode': '1', 'favoritesNotify': '1', 'notificationPosition': '1', 'hotCornerAction': '1', 'hotCornerPosition': '0', 'hotCornerFullscreen': 'true', 'hotCornerRipples': 'true', 'alwaysActivateSelectedWindow': 'false', 'workspaceThumbnailsModule': 'true', 'workspaceSwitcherPopupModule': 'true', 'workspaceAnimationModule': 'true', 'workspaceModule': 'true', 'windowManagerModule': 'true', 'windowPreviewModule': 'true', 'winAttentionHandlerModule': 'true', 'swipeTrackerModule': 'true', 'searchModule': 'true', 'panelModule': 'true', 'messageTrayModule': 'true', 'layoutModule': 'true', 'dashModule': 'true', 'appFavoritesModule': 'true', 'appDisplayModule': 'true'}</default>
|
||||
</key>
|
||||
|
||||
<key type="s" name="profile-name-2">
|
||||
<default>""</default>
|
||||
</key>
|
||||
<key type="a{ss}" name="profile-data-2">
|
||||
<default>{'workspaceThumbnailsPosition': '5', 'wsMaxSpacing': '80', 'wsPreviewScale': '100', 'secWsPreviewScale': '100', 'secWsPreviewShift': 'false', 'wsThumbnailsFull': 'false', 'secWsThumbnailsPosition': '2', 'dashPosition': '2', 'dashPositionAdjust': '0', 'wsTmbPositionAdjust': '0', 'showWsTmbLabels': '0', 'showWsTmbLabelsOnHover': 'false', 'closeWsButtonMode': '2', 'secWsTmbPositionAdjust': '0', 'dashMaxIconSize': '64', 'dashShowWindowsIcon': '2', 'dashShowRecentFilesIcon': '2', 'centerDashToWs': 'false', 'showAppsIconPosition': '1', 'wsThumbnailScale': '5', 'wsThumbnailScaleAppGrid': '15', 'secWsThumbnailScale': '13', 'showSearchEntry': 'true', 'centerSearch': 'true', 'centerAppGrid': 'true', 'appGridPageWidthScale': '80', 'dashBgOpacity': '100', 'dashBgRadius': '17', 'enablePageShortcuts': 'true', 'showWsSwitcherBg': 'true', 'showWsPreviewBg': 'true', 'showBgInOverview': 'false', 'overviewBgBrightness': '30', 'overviewBgBlurSigma': '0', 'appGridBgBlurSigma': '0', 'smoothBlurTransitions': 'false', 'appGridAnimation': '4', 'searchViewAnimation': '4', 'workspaceAnimation': '1', 'animationSpeedFactor': '100', 'fixUbuntuDock': 'true', 'winPreviewIconSize': '0', 'alwaysShowWinTitles': 'false', 'startupState': '0', 'overviewMode': '0', 'workspaceSwitcherAnimation': '0', 'searchIconSize': '96', 'searchViewScale': '104', 'appGridIconSize': '-1', 'appGridColumns': '0', 'appGridRows': '0', 'appGridFolderIconSize': '-1', 'appGridFolderColumns': '3', 'appGridFolderRows': '3', 'appGridSpacing': '12', 'appGridFolderIconGrid': '2', 'appGridContent': '2', 'appGridIncompletePages': 'false', 'appGridOrder': '0', 'appGridNamesMode': '0', 'appGridActivePreview': 'false', 'appGridFolderCenter': 'false', 'searchWindowsEnable': 'true', 'searchRecentFilesEnable': 'true', 'searchFuzzy': 'false', 'searchMaxResultsRows': '5', 'dashShowWindowsBeforeActivation': '1', 'panelVisibility': '0', 'panelPosition': '0', 'windowAttentionMode': '0', 'wsSwPopupHPosition': '50', 'wsSwPopupVPosition': '95', 'wsSwPopupMode': '1', 'favoritesNotify': '1', 'notificationPosition': '1', 'hotCornerAction': '1', 'hotCornerPosition': '6', 'hotCornerFullscreen': 'true', 'hotCornerRipples': 'false', 'alwaysActivateSelectedWindow': 'false', 'workspaceThumbnailsModule': 'true', 'workspaceSwitcherPopupModule': 'true', 'workspaceAnimationModule': 'true', 'workspaceModule': 'true', 'windowManagerModule': 'true', 'windowPreviewModule': 'true', 'winAttentionHandlerModule': 'true', 'swipeTrackerModule': 'true', 'searchModule': 'true', 'panelModule': 'true', 'messageTrayModule': 'true', 'layoutModule': 'true', 'dashModule': 'true', 'appFavoritesModule': 'true', 'appDisplayModule': 'true'}</default>
|
||||
</key>
|
||||
|
||||
<key type="s" name="profile-name-3">
|
||||
<default>""</default>
|
||||
</key>
|
||||
<key type="a{ss}" name="profile-data-3">
|
||||
<default>{'workspaceThumbnailsPosition': '0', 'wsMaxSpacing': '350', 'wsPreviewScale': '95', 'secWsPreviewScale': '100', 'secWsPreviewShift': 'false', 'wsThumbnailsFull': 'false', 'secWsThumbnailsPosition': '2', 'dashPosition': '0', 'dashPositionAdjust': '-100', 'wsTmbPositionAdjust': '-100', 'showWsTmbLabels': '3', 'showWsTmbLabelsOnHover': 'false', 'closeWsButtonMode': '2', 'secWsTmbPositionAdjust': '0', 'dashMaxIconSize': '48', 'dashShowWindowsIcon': '1', 'dashShowRecentFilesIcon': '1', 'centerDashToWs': 'false', 'showAppsIconPosition': '0', 'wsThumbnailScale': '13', 'wsThumbnailScaleAppGrid': '0', 'secWsThumbnailScale': '13', 'showSearchEntry': 'false', 'centerSearch': 'true', 'centerAppGrid': 'false', 'appGridPageWidthScale': '90', 'dashBgOpacity': '85', 'dashBgRadius': '17', 'enablePageShortcuts': 'true', 'showWsSwitcherBg': 'true', 'showWsPreviewBg': 'false', 'showBgInOverview': 'true', 'overviewBgBrightness': '95', 'overviewBgBlurSigma': '0', 'appGridBgBlurSigma': '80', 'smoothBlurTransitions': 'false', 'appGridAnimation': '4', 'searchViewAnimation': '4', 'workspaceAnimation': '1', 'animationSpeedFactor': '100', 'fixUbuntuDock': 'true', 'winPreviewIconSize': '1', 'alwaysShowWinTitles': 'true', 'startupState': '2', 'overviewMode': '1', 'workspaceSwitcherAnimation': '1', 'searchIconSize': '96', 'searchViewScale': '104', 'appGridIconSize': '-1', 'appGridColumns': '0', 'appGridRows': '0', 'appGridFolderIconSize': '-1', 'appGridFolderColumns': '0', 'appGridFolderRows': '0', 'appGridSpacing': '12', 'appGridFolderIconGrid': '3', 'appGridContent': '0', 'appGridIncompletePages': 'false', 'appGridOrder': '0', 'appGridNamesMode': '0', 'appGridActivePreview': 'true', 'appGridFolderCenter': 'false', 'searchWindowsEnable': 'true', 'searchRecentFilesEnable': 'true', 'searchFuzzy': 'false', 'searchMaxResultsRows': '5', 'dashShowWindowsBeforeActivation': '1', 'panelVisibility': '0', 'panelPosition': '0', 'windowAttentionMode': '2', 'wsSwPopupHPosition': '50', 'wsSwPopupVPosition': '95', 'wsSwPopupMode': '1', 'favoritesNotify': '0', 'notificationPosition': '2', 'hotCornerAction': '1', 'hotCornerPosition': '1', 'hotCornerFullscreen': 'true', 'hotCornerRipples': 'true', 'alwaysActivateSelectedWindow': 'false', 'workspaceThumbnailsModule': 'true', 'workspaceSwitcherPopupModule': 'true', 'workspaceAnimationModule': 'true', 'workspaceModule': 'true', 'windowManagerModule': 'true', 'windowPreviewModule': 'true', 'winAttentionHandlerModule': 'true', 'swipeTrackerModule': 'true', 'searchModule': 'true', 'panelModule': 'true', 'messageTrayModule': 'true', 'layoutModule': 'true', 'dashModule': 'true', 'appFavoritesModule': 'true', 'appDisplayModule': 'true'}</default>
|
||||
</key>
|
||||
|
||||
<key type="s" name="profile-name-4">
|
||||
<default>""</default>
|
||||
</key>
|
||||
<key type="a{ss}" name="profile-data-4">
|
||||
<default>{'workspaceThumbnailsPosition': '6', 'wsMaxSpacing': '65', 'wsPreviewScale': '95', 'secWsPreviewScale': '100', 'secWsPreviewShift': 'false', 'wsThumbnailsFull': 'false', 'secWsThumbnailsPosition': '2', 'dashPosition': '2', 'dashPositionAdjust': '0', 'wsTmbPositionAdjust': '0', 'showWsTmbLabels': '3', 'showWsTmbLabelsOnHover': 'false', 'closeWsButtonMode': '2', 'secWsTmbPositionAdjust': '0', 'dashMaxIconSize': '48', 'dashShowWindowsIcon': '1', 'dashShowRecentFilesIcon': '1', 'centerDashToWs': 'false', 'showAppsIconPosition': '1', 'wsThumbnailScale': '10', 'wsThumbnailScaleAppGrid': '0', 'secWsThumbnailScale': '10', 'showSearchEntry': 'false', 'centerSearch': 'true', 'centerAppGrid': 'false', 'appGridPageWidthScale': '90', 'dashBgOpacity': '85', 'dashBgRadius': '17', 'enablePageShortcuts': 'true', 'showWsSwitcherBg': 'true', 'showWsPreviewBg': 'true', 'showBgInOverview': 'true', 'overviewBgBrightness': '100', 'overviewBgBlurSigma': '80', 'appGridBgBlurSigma': '80', 'smoothBlurTransitions': 'false', 'appGridAnimation': '4', 'searchViewAnimation': '4', 'workspaceAnimation': '1', 'animationSpeedFactor': '100', 'fixUbuntuDock': 'true', 'winPreviewIconSize': '2', 'alwaysShowWinTitles': 'true', 'startupState': '2', 'overviewMode': '2', 'workspaceSwitcherAnimation': '1', 'searchIconSize': '96', 'searchViewScale': '104', 'appGridIconSize': '-1', 'appGridColumns': '0', 'appGridRows': '0', 'appGridFolderIconSize': '-1', 'appGridFolderColumns': '0', 'appGridFolderRows': '0', 'appGridSpacing': '12', 'appGridFolderIconGrid': '3', 'appGridContent': '0', 'appGridIncompletePages': 'false', 'appGridOrder': '0', 'appGridNamesMode': '0', 'appGridActivePreview': 'true', 'appGridFolderCenter': 'false', 'searchWindowsEnable': 'true', 'searchRecentFilesEnable': 'true', 'searchFuzzy': 'false', 'searchMaxResultsRows': '5', 'dashShowWindowsBeforeActivation': '1', 'panelVisibility': '0', 'panelPosition': '0', 'windowAttentionMode': '2', 'wsSwPopupHPosition': '50', 'wsSwPopupVPosition': '95', 'wsSwPopupMode': '1', 'favoritesNotify': '0', 'notificationPosition': '1', 'hotCornerAction': '1', 'hotCornerPosition': '6', 'hotCornerFullscreen': 'true', 'hotCornerRipples': 'false', 'alwaysActivateSelectedWindow': 'false', 'workspaceThumbnailsModule': 'true', 'workspaceSwitcherPopupModule': 'true', 'workspaceAnimationModule': 'true', 'workspaceModule': 'true', 'windowManagerModule': 'true', 'windowPreviewModule': 'true', 'winAttentionHandlerModule': 'true', 'swipeTrackerModule': 'true', 'searchModule': 'true', 'panelModule': 'true', 'messageTrayModule': 'true', 'layoutModule': 'true', 'dashModule': 'true', 'appFavoritesModule': 'true', 'appDisplayModule': 'true'}</default>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
BIN
extensions/vertical-workspaces/screenshots/screenshot0.jpg
Normal file
After Width: | Height: | Size: 284 KiB |
Before Width: | Height: | Size: 313 KiB After Width: | Height: | Size: 274 KiB |
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 280 KiB |
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 375 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 50 KiB |
|
@ -1,52 +0,0 @@
|
|||
/**
|
||||
* 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;`);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,17 @@
|
|||
/*
|
||||
* V-Shell (Vertical Workspaces)
|
||||
* stylesheet.css
|
||||
*/
|
||||
|
||||
/* General dash */
|
||||
#dash.vertical-overview {
|
||||
#dash.vertical {
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
padding: 0px 0;
|
||||
}
|
||||
|
||||
#dash.vertical-overview .app-well-app,
|
||||
#dash.vertical-overview .show-apps {
|
||||
#dash.vertical .app-well-app,
|
||||
#dash.vertical .show-apps {
|
||||
padding-right: 8px;
|
||||
padding-left: 8px;
|
||||
/*spacing between icons*/
|
||||
|
@ -15,7 +20,7 @@
|
|||
margin: 0px;
|
||||
}
|
||||
|
||||
#dash.vertical-overview .dash-separator {
|
||||
#dash.vertical .dash-separator {
|
||||
height: 1px;
|
||||
margin-right: 2px;
|
||||
margin-left: 2px;
|
||||
|
@ -24,36 +29,35 @@
|
|||
background-color: transparentize(#eeeeec, 0.7);
|
||||
}
|
||||
|
||||
#dash.vertical-overview .overview-icon {
|
||||
#dash.vertical .overview-icon {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
#dash.vertical-overview .app-well-app-running-dot {
|
||||
#dash.vertical .app-well-app-running-dot {
|
||||
margin: 4px 0px;
|
||||
width: 2px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#dash.vertical-overview .dash-background {
|
||||
#dash.vertical .dash-background {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#dash.vertical-overview-left .dash-background {
|
||||
#dash.vertical-left .dash-background {
|
||||
border-radius: 0 18px 18px 0;
|
||||
border-left: 0px;
|
||||
padding: 8px 12px 8px 4px;
|
||||
}
|
||||
|
||||
#dash.vertical-overview-right .dash-background {
|
||||
#dash.vertical-right .dash-background {
|
||||
border-radius: 18px 0 0 18px;
|
||||
border-right: 0px;
|
||||
padding: 8px 4px 8px 12px;
|
||||
}
|
||||
|
||||
/* default horizontal dash */
|
||||
.dash-background {
|
||||
.v-shell-dash-background {
|
||||
padding: 6px;
|
||||
border-radius: 17px;
|
||||
}
|
||||
|
||||
.app-well-app {
|
||||
|
@ -72,12 +76,6 @@
|
|||
text-shadow: 1px 1px 3px rgba(33, 33, 33, 1);
|
||||
}
|
||||
|
||||
.search-entry {
|
||||
padding: 3px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
/*adjustment for the vertical ws switcher indicator popup*/
|
||||
.ws-switcher-indicator {
|
||||
padding: 3px;
|
||||
|
@ -97,7 +95,7 @@
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.ws-tmb, .ws-tmb-labeled {
|
||||
.workspace-thumbnail-indicator {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
|
@ -131,11 +129,38 @@
|
|||
|
||||
}
|
||||
|
||||
.search-entry, .search-entry-om2 {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.search-entry-om2 {
|
||||
border: 5px;
|
||||
}
|
||||
|
||||
.search-section-content {
|
||||
background-color: rgba(20, 20, 20, 0.8);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* for static ws mode */
|
||||
.search-section-content-om2 {
|
||||
background-color: rgba(20, 20, 20, 0.95);
|
||||
color: white;
|
||||
border-radius: 20px;
|
||||
border: 1px, rgb(40, 40, 40);
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
/* "no results" / "searching..." text*/
|
||||
.search-statustext {
|
||||
background-color: rgba(23,23,23, 0.95);
|
||||
color: white;
|
||||
margin-top: 50px;
|
||||
padding: 30px;
|
||||
border-radius: 20px;
|
||||
text-shadow: 0px 0px 5px rgb(23, 23, 23);
|
||||
}
|
||||
|
||||
.transparent-panel {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
@ -145,9 +170,9 @@
|
|||
spacing: 2px;
|
||||
}
|
||||
|
||||
/*.panel {
|
||||
.panel {
|
||||
text-shadow: 1px 1px 3px rgba(33, 33, 33, 1);
|
||||
}*/
|
||||
}
|
||||
|
||||
/* hide vertical scroll bar, it's distracting in the search results */
|
||||
StButton#vhandle {
|
||||
|
@ -165,3 +190,35 @@ StButton#vhandle {
|
|||
margin: 0;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
.workspace-close-button {
|
||||
color: white;
|
||||
background-color: dimgrey;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
padding: 2px;
|
||||
margin: 2px;
|
||||
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
|
||||
border: 0px;
|
||||
border-radius: 35px;
|
||||
}
|
||||
|
||||
.workspace-close-button-hover {
|
||||
background-color: rgb(255, 0, 0);
|
||||
}
|
||||
|
||||
/* ws tmb placeholder */
|
||||
.placeholder-vertical {
|
||||
background-size: contain;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* reduce size of hot corner ripples to half */
|
||||
.ripple-box {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.osd-window {
|
||||
margin: 4em;
|
||||
}
|
||||
|
|
|
@ -1,270 +0,0 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* util.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @copyright 2022 - 2023
|
||||
* @license GPL-3.0
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gi = imports._gi;
|
||||
const { Shell, Meta } = imports.gi;
|
||||
|
||||
const Config = imports.misc.config;
|
||||
const Main = imports.ui.main;
|
||||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
var shellVersion = parseFloat(Config.PACKAGE_VERSION);
|
||||
|
||||
var Overrides = class {
|
||||
constructor() {
|
||||
this._overrides = {};
|
||||
this._injections = {};
|
||||
}
|
||||
|
||||
addOverride(name, prototype, overrideList) {
|
||||
this._overrides[name] = {
|
||||
originals: this.overrideProto(prototype, overrideList),
|
||||
prototype,
|
||||
};
|
||||
}
|
||||
|
||||
removeOverride(name) {
|
||||
const override = this._overrides[name];
|
||||
if (!override)
|
||||
return false;
|
||||
|
||||
this.overrideProto(override.prototype, override.originals);
|
||||
this._overrides[name] = undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
className.prototype
|
||||
.injections.funcName1
|
||||
.funcName2
|
||||
*/
|
||||
addInjection(className, prototype, injections) {
|
||||
if (!this._injections[className])
|
||||
this._injections[className] = {
|
||||
prototype,
|
||||
injections: {},
|
||||
};
|
||||
|
||||
for (let name in injections) {
|
||||
this._injections[className].injections[name] = {
|
||||
original: this.injectToFunction(prototype, name, injections[name]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeInjection(className, funcName) {
|
||||
if (this._injections[className]) return false;
|
||||
const prototype = this._injections[className].prototype;
|
||||
|
||||
const injection = this._injections[className].injections[funcName];
|
||||
if (!injection) return false;
|
||||
|
||||
prototype[funcName] = injection.original;
|
||||
this._injections[funcName] = undefined;
|
||||
return true;
|
||||
}
|
||||
|
||||
removeAll() {
|
||||
for (let name in this._overrides) {
|
||||
this.removeOverride(name);
|
||||
this._overrides[name] = undefined;
|
||||
}
|
||||
|
||||
for (let className in this._injections) {
|
||||
const injt = this._injections[className];
|
||||
const prototype = injt.prototype;
|
||||
for (let funcName in injt.injections) {
|
||||
prototype[funcName] = injt.injections[funcName].original;
|
||||
}
|
||||
this._injections[className] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
hookVfunc(proto, symbol, func) {
|
||||
proto[Gi.hook_up_vfunc_symbol](symbol, func);
|
||||
}
|
||||
|
||||
overrideProto(proto, overrides) {
|
||||
const backup = {};
|
||||
|
||||
for (let symbol in overrides) {
|
||||
if (symbol.startsWith('after_')) {
|
||||
const actualSymbol = symbol.slice('after_'.length);
|
||||
const fn = proto[actualSymbol];
|
||||
const afterFn = overrides[symbol]
|
||||
proto[actualSymbol] = function() {
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const res = fn.apply(this, args);
|
||||
afterFn.apply(this, args);
|
||||
return res;
|
||||
};
|
||||
backup[actualSymbol] = fn;
|
||||
}
|
||||
else {
|
||||
backup[symbol] = proto[symbol];
|
||||
if (symbol.startsWith('vfunc')) {
|
||||
if (shellVersion < 42) {
|
||||
this.hookVfunc(proto, symbol.slice(6), overrides[symbol]);
|
||||
} else {
|
||||
this.hookVfunc(proto[Gi.gobject_prototype_symbol], symbol.slice(6), overrides[symbol]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
proto[symbol] = overrides[symbol];
|
||||
}
|
||||
}
|
||||
}
|
||||
return backup;
|
||||
}
|
||||
|
||||
injectToFunction(parent, name, func) {
|
||||
let origin = parent[name];
|
||||
parent[name] = function() {
|
||||
let ret;
|
||||
ret = origin.apply(this, arguments);
|
||||
func.apply(this, arguments);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return origin;
|
||||
}
|
||||
}
|
||||
|
||||
//------- Common functions -----------------------------------------------------------------------
|
||||
|
||||
function getOverviewTranslations(opt, dash, tmbBox, searchEntryBin) {
|
||||
//const tmbBox = Main.overview._overview._controls._thumbnailsBox;
|
||||
let searchTranslation_y = 0;
|
||||
if (searchEntryBin.visible) {
|
||||
const offset = (dash.visible && (!opt.DASH_VERTICAL ? dash.height + 12 : 0))
|
||||
+ (opt.WS_TMB_TOP ? tmbBox.height + 12 : 0);
|
||||
searchTranslation_y = - searchEntryBin.height - offset - 30;
|
||||
}
|
||||
|
||||
let tmbTranslation_x = 0;
|
||||
let tmbTranslation_y = 0;
|
||||
let offset;
|
||||
if (tmbBox.visible) {
|
||||
switch (opt.WS_TMB_POSITION) {
|
||||
case 3: // left
|
||||
offset = 10 + ((dash?.visible && opt.DASH_LEFT) ? dash.width : 0);
|
||||
tmbTranslation_x = - tmbBox.width - offset;
|
||||
tmbTranslation_y = 0;
|
||||
break;
|
||||
case 1: // right
|
||||
offset = 10 + ((dash?.visible && opt.DASH_RIGHT) ? dash.width : 0);
|
||||
tmbTranslation_x = tmbBox.width + offset;
|
||||
tmbTranslation_y = 0;
|
||||
break;
|
||||
case 0: // top
|
||||
offset = 10 + ((dash?.visible && opt.DASH_TOP) ? dash.height : 0) + Main.panel.height;
|
||||
tmbTranslation_x = 0;
|
||||
tmbTranslation_y = - tmbBox.height - offset;
|
||||
break;
|
||||
case 2: // bottom
|
||||
offset = 10 + ((dash?.visible && opt.DASH_BOTTOM) ? dash.height : 0) + Main.panel.height; // just for case the panel is at bottom
|
||||
tmbTranslation_x = 0;
|
||||
tmbTranslation_y = tmbBox.height + offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let dashTranslation_x = 0;
|
||||
let dashTranslation_y = 0;
|
||||
let position = opt.DASH_POSITION;
|
||||
// if DtD replaced the original Dash, read its position
|
||||
if (dashIsDashToDock()) {
|
||||
position = dash._position;
|
||||
}
|
||||
if (dash?.visible) {
|
||||
switch (position) {
|
||||
case 0: // top
|
||||
dashTranslation_x = 0;
|
||||
dashTranslation_y = - dash.height - dash.margin_bottom - Main.panel.height;
|
||||
break;
|
||||
case 1: // right
|
||||
dashTranslation_x = dash.width;
|
||||
dashTranslation_y = 0;
|
||||
break;
|
||||
case 2: // bottom
|
||||
dashTranslation_x = 0;
|
||||
dashTranslation_y = dash.height + dash.margin_bottom + Main.panel.height;
|
||||
break;
|
||||
case 3: // left
|
||||
dashTranslation_x = - dash.width;
|
||||
dashTranslation_y = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return [tmbTranslation_x, tmbTranslation_y, dashTranslation_x, dashTranslation_y, searchTranslation_y];
|
||||
}
|
||||
|
||||
function openPreferences() {
|
||||
const windows = global.display.get_tab_list(Meta.TabList.NORMAL_ALL, null);
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
let metaWin, isVW = null;
|
||||
|
||||
for (let win of windows) {
|
||||
const app = tracker.get_window_app(win);
|
||||
if (win.get_title().includes(Me.metadata.name) && app.get_name() === 'Extensions') {
|
||||
// this is our existing window
|
||||
metaWin = win;
|
||||
isVW = true;
|
||||
break;
|
||||
} else if (win.wm_class.includes('org.gnome.Shell.Extensions')) {
|
||||
// this is prefs window of another extension
|
||||
metaWin = win;
|
||||
isVW = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (metaWin && !isVW) {
|
||||
// other prefs window blocks opening another prefs window, so close it
|
||||
metaWin.delete(global.get_current_time());
|
||||
} else if (metaWin && isVW) {
|
||||
// if prefs window already exist, move it to the current WS and activate it
|
||||
metaWin.change_workspace(global.workspace_manager.get_active_workspace());
|
||||
metaWin.activate(global.get_current_time());
|
||||
}
|
||||
|
||||
if (!metaWin || (metaWin && !isVW)) {
|
||||
try {
|
||||
Main.extensionManager.openExtensionPrefs(Me.metadata.uuid, '', {});
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function activateSearchProvider(prefix = '') {
|
||||
const searchEntry = Main.overview.searchEntry;
|
||||
if (!searchEntry.get_text() || !searchEntry.get_text().startsWith(prefix)) {
|
||||
prefix = _(prefix + ' ');
|
||||
const position = prefix.length;
|
||||
searchEntry.set_text(prefix);
|
||||
searchEntry.get_first_child().set_cursor_position(position);
|
||||
searchEntry.get_first_child().set_selection(position, position);
|
||||
} else {
|
||||
searchEntry.set_text('');
|
||||
}
|
||||
}
|
||||
|
||||
function dashNotDefault() {
|
||||
return Main.overview.dash !== Main.overview._overview._controls.layoutManager._dash;
|
||||
}
|
||||
|
||||
function dashIsDashToDock() {
|
||||
return Main.overview.dash._isHorizontal !== undefined;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* Vertical Workspaces
|
||||
* workspacesSwitcherPopup.js
|
||||
*
|
||||
* @author GdH <G-dH@github.com>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
5
share/doc/TODO.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
TODO
|
||||
====
|
||||
|
||||
* add https://github.com/gTile/gTile
|
||||
blocker: bazel 6 (#1021950)
|