gnome-shell-signal-tracker
GNOME Shell extension utility for tracking objects implementing the GJS signal emitter interface (Signals.addSignalMethods).
Building
This module's source uses ES6 classes and modules, to build it into an ES5 UMD
module run npm run build
.
Usage
To use in an extension, include the UMD module or use a module bundler like Webpack.
import {SignalTracker, ShellWindowTracker, ShellWorkspaceTracker} from 'gnome-shell-signal-tracker';
const signals = new SignalTracker();
const windows = new ShellWindowTracker(signals);
function enable() {
signals.connect(global.screen, 'workspace-switched', () => print('switched workspace'));
windows.onEvery(win => print('found a new window'));
windows.connectEvery('focus', win => print('focused a window'));
}
function disable() {
signals.clean();
}
Documentation
For now, the JSDoc annotations in the source.