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

Implement hiding of workspace window #20

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions quake-mode@repsac-by.github.com/quakemodeapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Tweener = imports.ui.tweener;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const { getSettings, on, once } = Me.imports.util;
const { WindowHider } = Me.imports.windowHider;

var state = {
INITIAL: Symbol('INITIAL'),
Expand Down Expand Up @@ -50,6 +51,11 @@ var QuakeModeApp = class {
this.settings = null;
}

if ( this.windowHider ) {
this.windowHider.destroy();
this.windowHider = null;
}

this.win = null;
this.app = null;
}
Expand Down Expand Up @@ -145,6 +151,7 @@ var QuakeModeApp = class {
return reject(`app '${this.app.id}' is launched but no windows`);

this.win = app.get_windows()[0];
this.windowHider = new WindowHider(this.win);

once(this.win, 'unmanaged', () => this.destroy());

Expand Down
51 changes: 51 additions & 0 deletions quake-mode@repsac-by.github.com/windowHider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

/* exported WindowHider */

const Workspace = imports.ui.workspace.Workspace;
const { WindowSwitcherPopup, WindowCyclerPopup } = imports.ui.altTab;


var WindowHider = class {
constructor(win) {
this._win = win;

this._workspace_getWindows = Workspace.prototype._isOverviewWindow;
Workspace.prototype._isOverviewWindow = win => {
return this._workspace_getWindows.apply(Workspace, arguments)
&& !this._isOurWindow(win);
};

//TODO this doesn't seem to work right now
/*
this._switcher_getWindowList = WindowSwitcherPopup.prototype._getWindowList;
WindowSwitcherPopup.prototype._getWindowList = () => {
return this._switcher_getWindowList
.filter(win => !this._isOurWindow(win))
};

this._cycler_getWindows = WindowCyclerPopup.prototype._getWindows;
WindowCyclerPopup.prototype._getWindows = () => {
return this._cycler_getWindows
.filter(win => !this._isOurWindow(win))
};
*/
}

_isOurWindow(win) {
// log(`app id ${win.get_gtk_application_id()}, ${this._win.get_gtk_application_id()}, equals ${win === this._win ? 'yes' : 'no'}`);
log(`app id ${win.get_gtk_application_id}, ${this._win.get_gtk_application_id}, equals ${win === this._win ? 'yes' : 'no'}`);
// log(`pid ${win.get_pid}, ${this._win.get_pid}`);
//
// //return show && !(win.get_meta_window().get_gtk_application_id()+'.desktop'==app_id() && win.get_meta_window().minimized);
// return false;
return win === this._win;
}

destroy() {
Workspace.prototype._isOverviewWindow = this._workspace_getWindows;
//TODO uncomment if fixed
//WindowSwitcherPopup.prototype._getWindowList = this._switcher_getWindowList;
//WindowCyclerPopup.prototype._getWindows = this._cycler_getWindows;
}
};