/usr/share/gnome-shell/extensions/pixel-saver@deadalnix.me/util.js is in gnome-shell-extension-pixelsaver 1.10+git20161217-49f47bf-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
const MAXIMIZED = Meta.MaximizeFlags.BOTH;
function getWindow() {
// get all window in stacking order.
let windows = global.display.sort_windows_by_stacking(
global.screen.get_active_workspace().list_windows().filter(function (w) {
return w.get_window_type() !== Meta.WindowType.DESKTOP;
})
);
let i = windows.length;
while (i--) {
let window = windows[i];
if (window.get_maximized() === MAXIMIZED && !window.minimized) {
return window;
}
}
return null;
}
function onSizeChange(callback) {
let callbackIDs = [];
let wm = global.window_manager;
// Obvious size change callback.
callbackIDs.push(wm.connect('size-change', callback));
// Needed for window drag to top panel (this doesn't trigger maximize).
callbackIDs.push(wm.connect('hide-tile-preview', callback));
// NB: 'destroy' needs a delay for .list_windows() report correctly
callbackIDs.push(wm.connect('destroy', function () {
Mainloop.idle_add(callback);
}));
return callbackIDs;
}
|