workspaceSwitcherPopup: Drop direction parameter

The original popup included arrows that indicated the direction of
the switch. We stopped doing that a long time ago, and ever since
the popup has only indicated active vs. non-active workspaces.

Simplify both the API and style to reflect that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2127>
This commit is contained in:
Florian Müllner 2022-01-26 01:26:44 +01:00 committed by Marge Bot
parent 3e8fd65045
commit 209d8c7f10
3 changed files with 16 additions and 27 deletions

View File

@ -21,22 +21,18 @@ $ws_border_radius: $modal_radius + 8px;
spacing: $base_spacing * 2; spacing: $base_spacing * 2;
} }
.ws-switcher-box { .ws-switcher-indicator {
background: transparent; background: transparent;
height: 50px; height: 50px;
background-size: 32px; background-size: 32px;
border: 1px solid transparentize($osd_fg_color,0.9); border: 1px solid transparentize($osd_fg_color,0.9);
border-radius: $base_border_radius + 3px; border-radius: $base_border_radius + 3px;
}
// active workspace in the switcher &:active {
.ws-switcher-active-up, height: 52px;
.ws-switcher-active-down, background-color: $selected_bg_color;
.ws-switcher-active-left, border: 1px solid if($variant=='light', darken($selected_bg_color, 8%), lighten($selected_bg_color, 5%));
.ws-switcher-active-right { border-radius: $base_border_radius + 3px;
height: 52px; color: $selected_fg_color;
background-color: $selected_bg_color; }
border: 1px solid if($variant=='light', darken($selected_bg_color, 8%), lighten($selected_bg_color, 5%));
border-radius: $base_border_radius + 3px;
color: $selected_fg_color;
} }

View File

@ -1820,7 +1820,7 @@ var WindowManager = class {
this._isWorkspacePrepended = false; this._isWorkspacePrepended = false;
}); });
} }
this._workspaceSwitcherPopup.display(direction, newWs.index()); this._workspaceSwitcherPopup.display(newWs.index());
} }
} }

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported WorkspaceSwitcherPopup */ /* exported WorkspaceSwitcherPopup */
const { Clutter, GLib, GObject, Meta, St } = imports.gi; const { Clutter, GLib, GObject, St } = imports.gi;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -158,18 +158,12 @@ class WorkspaceSwitcherPopup extends St.Widget {
this._list.destroy_all_children(); this._list.destroy_all_children();
for (let i = 0; i < workspaceManager.n_workspaces; i++) { for (let i = 0; i < workspaceManager.n_workspaces; i++) {
let indicator = null; const indicator = new St.Bin({
style_class: 'ws-switcher-indicator',
});
if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.UP) if (i === this._activeWorkspaceIndex)
indicator = new St.Bin({ style_class: 'ws-switcher-active-up' }); indicator.add_style_pseudo_class('active');
else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.DOWN)
indicator = new St.Bin({ style_class: 'ws-switcher-active-down' });
else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.LEFT)
indicator = new St.Bin({ style_class: 'ws-switcher-active-left' });
else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.RIGHT)
indicator = new St.Bin({ style_class: 'ws-switcher-active-right' });
else
indicator = new St.Bin({ style_class: 'ws-switcher-box' });
this._list.add_actor(indicator); this._list.add_actor(indicator);
} }
@ -190,8 +184,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
this.show(); this.show();
} }
display(direction, activeWorkspaceIndex) { display(activeWorkspaceIndex) {
this._direction = direction;
this._activeWorkspaceIndex = activeWorkspaceIndex; this._activeWorkspaceIndex = activeWorkspaceIndex;
this._redisplay(); this._redisplay();