Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnome 45 #18

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 53 additions & 33 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,52 @@
const Config = imports.misc.config;
const [major] = Config.PACKAGE_VERSION.split('.');
const shellVersion = Number.parseInt(major);

const isOverviewWindow = imports.ui.workspace.Workspace.prototype._isOverviewWindow;
const { Workspace } = imports.ui.workspace;
const { altTab } = imports.ui;
const { getWindows } = altTab;
if(shellVersion >= 42) {
var capture = imports.ui.screenshot.UIWindowSelector.prototype.capture;
var { UIWindowSelector, UIWindowSelectorWindow } = imports.ui.screenshot;
var Main = imports.ui.main;
}
import { Workspace } from 'resource:///org/gnome/shell/ui/workspace.js'
import {
GroupCyclerPopup,
WindowCyclerPopup,
WindowSwitcherPopup,
} from 'resource:///org/gnome/shell/ui/altTab.js'

// import { UIWindowSelector, UIWindowSelectorWindow } from 'resource:///org/gnome/shell/ui/screenshot.js'
// import * as Main from 'resource:///org/gnome/shell/ui/main.js';

const isOverviewWindow = Workspace.prototype._isOverviewWindow;
const groupGetWindows = GroupCyclerPopup.prototype._getWindows;
const windowGetWindows = WindowCyclerPopup.prototype._getWindows;
const windowSwitcherWindows = WindowSwitcherPopup.prototype._getWindowList;

// const capture = UIWindowSelector.prototype.capture;


function init() {
function _filterWindows(windows) {
return windows.filter((w, i, a) => !w.minimized);
}

function enable() {
Workspace.prototype._isOverviewWindow = (win) => {
const show = isOverviewWindow(win);
let meta = win;
if (win.get_meta_window)
meta = win.get_meta_window()
return show && !meta.minimized;
};
altTab.getWindows = (workspace) => {
const windows = getWindows(workspace);
return windows.filter((w, i, a) => !w.minimized);
};
if(shellVersion >= 42) {

export default class HideMinimized {
constructor() {
}

enable() {
Workspace.prototype._isOverviewWindow = (win) => {
const show = isOverviewWindow(win);
let meta = win;
if (win.get_meta_window)
meta = win.get_meta_window()
return show && !meta.minimized;
};

WindowCyclerPopup.prototype._getWindows = function() {
return _filterWindows(windowGetWindows.bind(this)());
};

GroupCyclerPopup.prototype._getWindows = function() {
return _filterWindows(groupGetWindows.bind(this)());
};

WindowSwitcherPopup.prototype._getWindowList = function() {
return _filterWindows(windowSwitcherWindows.bind(this)());
};

/*
// Patched version of original function from:
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/screenshot.js
UIWindowSelector.prototype.capture = function() {
Expand Down Expand Up @@ -64,13 +83,14 @@ function enable() {
this._layoutManager.addWindow(widget);
}
};
*/
}
}

function disable() {
Workspace.prototype._isOverviewWindow = isOverviewWindow;
altTab.getWindows = getWindows;
if(shellVersion >= 42) {
UIWindowSelector.prototype.capture = capture;
disable() {
Workspace.prototype._isOverviewWindow = isOverviewWindow;
WindowCyclerPopup.prototype._getWindows = windowGetWindows;
GroupCyclerPopup.prototype._getWindows = groupGetWindows;
WindowSwitcherPopup.prototype._getWindowList = windowSwitcherWindows;
// UIWindowSelector.prototype.capture = capture;
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"uuid": "[email protected]",
"name": "Hide minimized",
"url": "https://github.com/danigm/hide-minimized",
"shell-version": ["3.30", "3.32", "3.34", "3.36", "3.38", "40", "41", "42", "43", "44"]
"shell-version": ["45"]
}