Skip to content

Commit c54481e

Browse files
authored
Merge pull request #18 from danigm/gnome-45
Gnome 45
2 parents 4832f5f + cb7acf4 commit c54481e

File tree

2 files changed

+54
-34
lines changed

2 files changed

+54
-34
lines changed

extension.js

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,52 @@
1-
const Config = imports.misc.config;
2-
const [major] = Config.PACKAGE_VERSION.split('.');
3-
const shellVersion = Number.parseInt(major);
4-
5-
const isOverviewWindow = imports.ui.workspace.Workspace.prototype._isOverviewWindow;
6-
const { Workspace } = imports.ui.workspace;
7-
const { altTab } = imports.ui;
8-
const { getWindows } = altTab;
9-
if(shellVersion >= 42) {
10-
var capture = imports.ui.screenshot.UIWindowSelector.prototype.capture;
11-
var { UIWindowSelector, UIWindowSelectorWindow } = imports.ui.screenshot;
12-
var Main = imports.ui.main;
13-
}
1+
import { Workspace } from 'resource:///org/gnome/shell/ui/workspace.js'
2+
import {
3+
GroupCyclerPopup,
4+
WindowCyclerPopup,
5+
WindowSwitcherPopup,
6+
} from 'resource:///org/gnome/shell/ui/altTab.js'
7+
8+
// import { UIWindowSelector, UIWindowSelectorWindow } from 'resource:///org/gnome/shell/ui/screenshot.js'
9+
// import * as Main from 'resource:///org/gnome/shell/ui/main.js';
10+
11+
const isOverviewWindow = Workspace.prototype._isOverviewWindow;
12+
const groupGetWindows = GroupCyclerPopup.prototype._getWindows;
13+
const windowGetWindows = WindowCyclerPopup.prototype._getWindows;
14+
const windowSwitcherWindows = WindowSwitcherPopup.prototype._getWindowList;
15+
16+
// const capture = UIWindowSelector.prototype.capture;
17+
1418

15-
function init() {
19+
function _filterWindows(windows) {
20+
return windows.filter((w, i, a) => !w.minimized);
1621
}
1722

18-
function enable() {
19-
Workspace.prototype._isOverviewWindow = (win) => {
20-
const show = isOverviewWindow(win);
21-
let meta = win;
22-
if (win.get_meta_window)
23-
meta = win.get_meta_window()
24-
return show && !meta.minimized;
25-
};
26-
altTab.getWindows = (workspace) => {
27-
const windows = getWindows(workspace);
28-
return windows.filter((w, i, a) => !w.minimized);
29-
};
30-
if(shellVersion >= 42) {
23+
24+
export default class HideMinimized {
25+
constructor() {
26+
}
27+
28+
enable() {
29+
Workspace.prototype._isOverviewWindow = (win) => {
30+
const show = isOverviewWindow(win);
31+
let meta = win;
32+
if (win.get_meta_window)
33+
meta = win.get_meta_window()
34+
return show && !meta.minimized;
35+
};
36+
37+
WindowCyclerPopup.prototype._getWindows = function() {
38+
return _filterWindows(windowGetWindows.bind(this)());
39+
};
40+
41+
GroupCyclerPopup.prototype._getWindows = function() {
42+
return _filterWindows(groupGetWindows.bind(this)());
43+
};
44+
45+
WindowSwitcherPopup.prototype._getWindowList = function() {
46+
return _filterWindows(windowSwitcherWindows.bind(this)());
47+
};
48+
49+
/*
3150
// Patched version of original function from:
3251
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenshot.js
3352
UIWindowSelector.prototype.capture = function() {
@@ -64,13 +83,14 @@ function enable() {
6483
this._layoutManager.addWindow(widget);
6584
}
6685
};
86+
*/
6787
}
68-
}
6988

70-
function disable() {
71-
Workspace.prototype._isOverviewWindow = isOverviewWindow;
72-
altTab.getWindows = getWindows;
73-
if(shellVersion >= 42) {
74-
UIWindowSelector.prototype.capture = capture;
89+
disable() {
90+
Workspace.prototype._isOverviewWindow = isOverviewWindow;
91+
WindowCyclerPopup.prototype._getWindows = windowGetWindows;
92+
GroupCyclerPopup.prototype._getWindows = groupGetWindows;
93+
WindowSwitcherPopup.prototype._getWindowList = windowSwitcherWindows;
94+
// UIWindowSelector.prototype.capture = capture;
7595
}
7696
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"uuid": "hide-minimized@danigm.net",
44
"name": "Hide minimized",
55
"url": "https://github.com/danigm/hide-minimized",
6-
"shell-version": ["3.30", "3.32", "3.34", "3.36", "3.38", "40", "41", "42", "43", "44"]
6+
"shell-version": ["45"]
77
}

0 commit comments

Comments
 (0)