Skip to content

Commit ec99a87

Browse files
authored
Merge pull request #278 from mzur/gnome-46
Gnome 46
2 parents bfcc56b + f33dd77 commit ec99a87

File tree

7 files changed

+32
-111
lines changed

7 files changed

+32
-111
lines changed

[email protected]/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"shell-version": [
3-
"45"
3+
"46"
44
],
55
"uuid": "[email protected]",
66
"url": "https://github.com/mzur/gnome-shell-wsmatrix",

[email protected]/overview/controlsManagerLayout.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {SMALL_WORKSPACE_RATIO, ControlsState} from 'resource:///org/gnome/shell/
55
const _computeWorkspacesBoxForState = function(state, box, searchHeight, dashHeight, thumbnailsHeight) {
66
const workspaceBox = box.copy();
77
const [width, height] = workspaceBox.get_size();
8-
const { y1: startY } = this._workAreaBox;
9-
const {spacing} = this;
8+
const {y1: startY} = this._workAreaBox;
109
const {expandFraction} = this._workspacesThumbnails;
1110

1211
const workspaceManager = global.workspace_manager;
@@ -19,16 +18,16 @@ const _computeWorkspacesBoxForState = function(state, box, searchHeight, dashHei
1918
break;
2019
case ControlsState.WINDOW_PICKER:
2120
workspaceBox.set_origin(0,
22-
startY + searchHeight + spacing +
23-
thumbnailsHeight * rows + spacing * expandFraction);
21+
startY + searchHeight + this._spacing +
22+
thumbnailsHeight * rows + this._spacing * expandFraction);
2423
workspaceBox.set_size(width,
2524
height -
26-
dashHeight - spacing -
27-
searchHeight - spacing -
28-
thumbnailsHeight * rows - spacing * expandFraction);
25+
dashHeight - this._spacing -
26+
searchHeight - this._spacing -
27+
thumbnailsHeight * rows - this._spacing * expandFraction);
2928
break;
3029
case ControlsState.APP_GRID:
31-
workspaceBox.set_origin(0, startY + searchHeight + spacing);
30+
workspaceBox.set_origin(0, startY + searchHeight + this._spacing);
3231
workspaceBox.set_size(
3332
width,
3433
Math.round(height * rows * SMALL_WORKSPACE_RATIO));

[email protected]/overview/overviewManager.js

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,23 @@
1-
// import ControlsManagerLayout from './controlsManagerLayout.js';
1+
import ControlsManagerLayout from './controlsManagerLayout.js';
22
import SecondaryMonitorDisplay from './secondaryMonitorDisplay.js';
3-
// import ThumbnailsBox from './thumbnailsBox.js';
3+
import ThumbnailsBox from './thumbnailsBox.js';
44
import WorkspacesView from './workspacesView.js';
5-
import {GNOMEversionCompare} from 'resource:///org/gnome/shell/misc/util.js';
65
import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js';
76

87
export default class OverviewManager {
98
constructor(settings) {
109
this._settings = settings;
11-
}
12-
13-
async enable() {
14-
this._connectSettings();
15-
await this._initOverrides();
16-
this._handleShowOverviewGridChanged();
17-
}
18-
19-
// This can be moved to the constructor again if there is no need for the conditional
20-
// import any more.
21-
async _initOverrides() {
2210
this._overrides = [
2311
new WorkspacesView(),
2412
new SecondaryMonitorDisplay(),
25-
// new ThumbnailsBox(),
26-
// new ControlsManagerLayout(),
13+
new ThumbnailsBox(),
14+
new ControlsManagerLayout(),
2715
];
16+
}
2817

29-
// This only works starting in GNOME Shell 45.1 and up.
30-
if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) {
31-
const {default: ThumbnailsBox} = await import('./thumbnailsBox.js');
32-
this._overrides.push(new ThumbnailsBox());
33-
const {default: ControlsManagerLayout} = await import('./controlsManagerLayout.js');
34-
this._overrides.push(new ControlsManagerLayout());
35-
}
18+
enable() {
19+
this._connectSettings();
20+
this._handleShowOverviewGridChanged();
3621
}
3722

3823
_connectSettings() {

[email protected]/overview/thumbnailsBox.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const addThumbnails = function (start, count) {
1919
this._porthole.x, this._porthole.y,
2020
this._porthole.width, this._porthole.height);
2121
this._thumbnails.push(thumbnail);
22-
this.add_actor(thumbnail);
22+
this.add_child(thumbnail);
2323

2424
if (this._shouldShow && start > 0 && this._spliceIndex === -1) {
2525
// not the initial fill, and not splicing via DND
@@ -105,10 +105,8 @@ const vfunc_allocate = function(box) {
105105

106106
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
107107

108-
if (this._thumbnails.length == 0) {
109-
// not visible
110-
return;
111-
}
108+
if (this._thumbnails.length === 0) // not visible
109+
return;
112110

113111
let themeNode = this.get_theme_node();
114112
box = themeNode.get_content_box(box);

[email protected]/prefs.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,6 @@ import Adw from 'gi://Adw';
22
import Gio from 'gi://Gio';
33
import Gtk from 'gi://Gtk';
44
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
5-
import {PACKAGE_VERSION} from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js';
6-
7-
// From js/misc/utils.js which can't be imported.
8-
function _GNOMEversionToNumber(version) {
9-
let ret = Number(version);
10-
if (!isNaN(ret))
11-
return ret;
12-
if (version === 'alpha')
13-
return -2;
14-
if (version === 'beta')
15-
return -1;
16-
return ret;
17-
}
18-
19-
function GNOMEversionCompare(version1, version2) {
20-
const v1Array = version1.split('.');
21-
const v2Array = version2.split('.');
22-
23-
for (let i = 0; i < Math.max(v1Array.length, v2Array.length); i++) {
24-
let elemV1 = _GNOMEversionToNumber(v1Array[i] || '0');
25-
let elemV2 = _GNOMEversionToNumber(v2Array[i] || '0');
26-
if (elemV1 < elemV2)
27-
return -1;
28-
if (elemV1 > elemV2)
29-
return 1;
30-
}
31-
32-
return 0;
33-
}
345

356
export default class Prefs extends ExtensionPreferences {
367
fillPreferencesWindow(window) {
@@ -40,17 +11,6 @@ export default class Prefs extends ExtensionPreferences {
4011

4112
const page = new Adw.PreferencesPage();
4213

43-
if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') < 0) {
44-
// window.add_toast(new Adw.Toast({title: 'Test'}));
45-
let group = new Adw.PreferencesGroup();
46-
let banner = new Adw.Banner({
47-
title: _('Some features of the extension are disabled until GNOME Shell 45.1.'),
48-
revealed: true,
49-
});
50-
group.add(banner);
51-
page.add(group);
52-
}
53-
5414
let group = new Adw.PreferencesGroup({
5515
title: _('General Settings'),
5616
});

[email protected]/workspacePopup/workspaceManagerOverride.js

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,10 @@ import GLib from 'gi://GLib';
55
import Meta from 'gi://Meta';
66
import Shell from 'gi://Shell';
77
import WorkspaceSwitcherPopup from "./workspaceSwitcherPopup.js";
8-
// import {SCROLL_TIMEOUT_TIME} from 'resource:///org/gnome/shell/ui/windowManager.js';
9-
// import {WorkspaceAnimationController} from "./workspaceAnimation.js";
10-
import {GNOMEversionCompare} from 'resource:///org/gnome/shell/misc/util.js';
8+
import {SCROLL_TIMEOUT_TIME} from 'resource:///org/gnome/shell/ui/windowManager.js';
9+
import {WorkspaceAnimationController} from "./workspaceAnimation.js";
1110
import {PACKAGE_VERSION} from 'resource:///org/gnome/shell/misc/config.js';
1211

13-
let SCROLL_TIMEOUT_TIME = 150;
14-
if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) {
15-
import('resource:///org/gnome/shell/ui/windowManager.js').then((mod) => {
16-
SCROLL_TIMEOUT_TIME = mod.SCROLL_TIMEOUT_TIME;
17-
});
18-
}
19-
2012
const WraparoundMode = {
2113
NONE: 0,
2214
NEXT_PREV: 1,
@@ -36,11 +28,15 @@ export default class WorkspaceManagerOverride {
3628
this._keybindings = keybindings;
3729
this._overviewKeybindingActions = {};
3830
this.monitors = [];
39-
}
4031

41-
async enable() {
42-
await this._initOverrides()
32+
this._workspaceAnimation = new WorkspaceAnimationController();
33+
this.overrideProperties = [
34+
'_workspaceAnimation',
35+
'handleWorkspaceScroll',
36+
];
37+
}
4338

39+
enable() {
4440
this._overrideDynamicWorkspaces();
4541
this._overrideKeybindingHandlers();
4642
this._overrideOriginalProperties();
@@ -53,23 +49,6 @@ export default class WorkspaceManagerOverride {
5349
this._connectLayoutManager();
5450
}
5551

56-
// This can be moved to the constructor again if there is no need for the conditional
57-
// import any more.
58-
async _initOverrides() {
59-
// this._workspaceAnimation = new WorkspaceAnimationController();
60-
this.overrideProperties = [
61-
// '_workspaceAnimation',
62-
'handleWorkspaceScroll',
63-
];
64-
65-
// This only works starting in GNOME Shell 45.1 and up.
66-
if (GNOMEversionCompare(PACKAGE_VERSION, '45.1') >= 0) {
67-
const {WorkspaceAnimationController} = await import("./workspaceAnimation.js");
68-
this._workspaceAnimation = new WorkspaceAnimationController();
69-
this.overrideProperties.push('_workspaceAnimation');
70-
}
71-
}
72-
7352
disable() {
7453
this._destroyWorkspaceSwitcherPopup();
7554
this._restoreLayout();

[email protected]/workspacePopup/workspaceSwitcherPopupList.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default GObject.registerClass({
6363
this.redisplay();
6464
});
6565

66-
this.add_actor(workspacesRow);
66+
this.add_child(workspacesRow);
6767
this._lists.push(workspacesRow);
6868
}
6969

@@ -113,7 +113,7 @@ export default GObject.registerClass({
113113
}
114114

115115
bbox.set_child(container);
116-
list.add_actor(bbox);
116+
list.add_child(bbox);
117117

118118
bbox.connect('clicked', () => this._onItemClicked(bbox));
119119
bbox.connect('motion-event', () => this._onItemEnter(bbox));
@@ -169,12 +169,12 @@ export default GObject.registerClass({
169169

170170
highlight(index, justOutline) {
171171
if (this._items[this._highlighted]) {
172-
this._items[this._highlighted].remove_style_pseudo_class('outlined');
172+
this._items[this._highlighted].remove_style_pseudo_class('highlighted');
173173
this._items[this._highlighted].remove_style_pseudo_class('selected');
174174
}
175175

176176
if (this._items[index]) {
177-
this._items[index].add_style_pseudo_class(justOutline ? 'outlined' : 'selected');
177+
this._items[index].add_style_pseudo_class(justOutline ? 'highlighted' : 'selected');
178178
}
179179

180180
this._highlighted = index;

0 commit comments

Comments
 (0)