[gnome-shell/eos3.8: 57/255] Implement the "toggle apps" functionality
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 57/255] Implement the "toggle apps" functionality
- Date: Wed, 10 Jun 2020 19:02:44 +0000 (UTC)
commit 0e06555da925dc35d59387b24834c8d5de6b5bdc
Author: Mario Sanchez Prada <mario endlessm com>
Date: Thu Sep 14 16:29:58 2017 +0100
Implement the "toggle apps" functionality
This will be invoked both when pressing the Super key or the Endless
button, allowing the user to switch between the desktop's icon grid
and the current mode (e.g. running application, windows picker).
js/ui/main.js | 2 +-
js/ui/overview.js | 45 +++++++++++++++++++++++++++++++++++++++++++++
js/ui/viewSelector.js | 45 +++++++++++++++++++++++++++++++++------------
3 files changed, 79 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index b930b2c4c8..146ea3007e 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -226,7 +226,7 @@ function _initializeUI() {
global.display.connect('overlay-key', () => {
if (!_a11ySettings.get_boolean(STICKY_KEYS_ENABLE))
- overview.toggle();
+ overview.toggleApps();
});
global.connect('locate-pointer', () => {
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 60daca7f6e..20c8a960b0 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -12,6 +12,7 @@ const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
const OverviewControls = imports.ui.overviewControls;
const Params = imports.misc.params;
+const ViewSelector = imports.ui.viewSelector;
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
// Time for initial animation going into Overview mode
@@ -457,6 +458,27 @@ var Overview = class {
this._overview.searchEntry.grab_key_focus();
}
+ _showOrSwitchPage(page) {
+ if (this.visible)
+ this.viewSelector.setActivePage(page);
+ else
+ this.show();
+ }
+
+ showApps() {
+ if (this.isDummy)
+ return;
+
+ this._showOrSwitchPage(ViewSelector.ViewPage.APPS);
+ }
+
+ showWindows() {
+ if (this.isDummy)
+ return;
+
+ this._showOrSwitchPage(ViewSelector.ViewPage.WINDOWS);
+ }
+
fadeInDesktop() {
this._desktopFade.opacity = 0;
this._desktopFade.show();
@@ -485,6 +507,29 @@ var Overview = class {
});
}
+ toggleApps() {
+ if (this.isDummy)
+ return;
+
+ if (!this.visible ||
+ this.viewSelector.getActivePage() !== ViewSelector.ViewPage.APPS) {
+ this.showApps();
+ return;
+ }
+
+ if (!Main.workspaceMonitor.hasVisibleWindows) {
+ // There are active windows but all of them are hidden, so activate
+ // the most recently used one before hiding the overview.
+ let appSystem = Shell.AppSystem.get_default();
+ let runningApps = appSystem.get_running();
+ if (runningApps.length > 0)
+ runningApps[0].activate();
+ }
+
+ // Toggle to the currently open window
+ this.hide();
+ }
+
// Checks if the Activities button is currently sensitive to
// clicks. The first call to this function within the
// OVERVIEW_ACTIVATION_TIMEOUT time of the hot corner being
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 52dc603324..8dbfa7441e 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -221,7 +221,7 @@ var ViewSelector = GObject.registerClass({
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
- this._toggleAppsPage.bind(this));
+ Main.overview.toggleApps.bind(this));
Main.wm.addKeybinding('toggle-overview',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
@@ -258,10 +258,6 @@ var ViewSelector = GObject.registerClass({
Main.overview.show();
}
- _toggleAppsPage() {
- Main.overview.show();
- }
-
showApps() {
Main.overview.show();
}
@@ -269,11 +265,8 @@ var ViewSelector = GObject.registerClass({
show() {
this.reset();
this._workspacesDisplay.show(true);
- this._activePage = null;
- this._showPage(this._appsPage);
- if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
- Main.overview.fadeOutDesktop();
+ this._showPage(this._appsPage);
}
animateFromOverview() {
@@ -282,9 +275,6 @@ var ViewSelector = GObject.registerClass({
this._workspacesPage.opacity = 255;
this._workspacesDisplay.animateFromOverview(this._activePage != this._workspacesPage);
-
- if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
- Main.overview.fadeInDesktop();
}
setWorkspacesFullGeometry(geom) {
@@ -578,6 +568,17 @@ var ViewSelector = GObject.registerClass({
return Clutter.EVENT_PROPAGATE;
}
+ _pageFromViewPage(viewPage) {
+ let page;
+
+ if (viewPage === ViewPage.WINDOWS)
+ page = this._workspacesPage;
+ else
+ page = this._appsPage;
+
+ return page;
+ }
+
getActivePage() {
if (this._activePage == this._workspacesPage)
return ViewPage.WINDOWS;
@@ -586,4 +587,24 @@ var ViewSelector = GObject.registerClass({
else
return ViewPage.SEARCH;
}
+
+ setActivePage(viewPage) {
+ this._showPage(this._pageFromViewPage(viewPage));
+ }
+
+ fadeIn() {
+ this._activePage.ease({
+ opacity: 255,
+ duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME / 2,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
+
+ fadeHalf() {
+ this._activePage.ease({
+ opacity: 128,
+ duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME / 2,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]