Skip to content

Commit

Permalink
Update for GNOME Shell 3.32
Browse files Browse the repository at this point in the history
  • Loading branch information
maiself committed Jan 25, 2019
1 parent 2932f13 commit 1dd570a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 43 deletions.
41 changes: 0 additions & 41 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,8 @@ const ExtensionUtils = imports.misc.extensionUtils;
const Self = ExtensionUtils.getCurrentExtension();
const Convenience = Self.imports.convenience;

const ui = imports.ui;

const SHORTCUT = 'invert-window-shortcut';

function inject_after(proto, name, func) {
let orig = proto[name];

proto[name] = function() {
let ret = orig.apply(this, arguments);
return func.apply(this, [ret].concat([].slice.call(arguments)));
}

return orig;
}

function remove_injection(proto, name, orig) {
proto[name] = orig;
}

const InvertWindowEffect = new Lang.Class({
Name: 'InvertWindowEffect',
Extends: Clutter.ShaderEffect,
Expand Down Expand Up @@ -55,8 +38,6 @@ const InvertWindowEffect = new Lang.Class({

function InvertWindow() {
this.settings = Convenience.getSettings();
this.workspace_injection = null;
this.alttab_injection = null;
}

InvertWindow.prototype = {
Expand Down Expand Up @@ -86,22 +67,6 @@ InvertWindow.prototype = {
Lang.bind(this, this.toggle_effect)
);

this.workspace_injection = inject_after(ui.workspace.WindowClone.prototype, '_init', function(ret) {
if(this.realWindow.get_effect('invert-color')) {
let effect = new InvertWindowEffect();
this.actor.add_effect_with_name('invert-color', effect);
}
return ret;
});

this.alttab_injection = inject_after(ui.altTab, '_createWindowClone', function(clone, window, size) {
if(window.get_effect('invert-color')) {
let effect = new InvertWindowEffect();
clone.add_effect_with_name('invert-color', effect);
}
return clone;
});

global.get_window_actors().forEach(function(actor) {
let meta_window = actor.get_meta_window();
if(meta_window.hasOwnProperty('_invert_window_tag')) {
Expand All @@ -117,12 +82,6 @@ InvertWindow.prototype = {
global.get_window_actors().forEach(function(actor) {
actor.remove_effect_by_name('invert-color');
}, this);

remove_injection(ui.workspace.WindowClone.prototype, '_init', this.workspace_injection);
this.workspace_injection = null;

remove_injection(ui.altTab, '_createWindowClone', this.alttab_injection);
this.alttab_injection = null;
}
};

Expand Down
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"name": "Invert Window Color",
"description": "Inverts the color of individual windows\nDefault shortcut is Super+I",
"url": "https://github.com/maiself/gnome-shell-extension-invert-color",
"shell-version": ["3.16", "3.18", "3.20"],
"shell-version": [
"3.32"
],
"settings-schema": "org.gnome.shell.extensions.invert-window",
"version": 1
"version": 5
}

0 comments on commit 1dd570a

Please sign in to comment.