In case of gnome extension, Suppose i have an Interface Definitions (in simpleModule.js
) like:
var SIMPLE_DBUS_IFACE = `
<node>
<interface name="org.gnome.Shell.Extensions.Windows">
<method name="SimpleMethod"/>
</interface>
</node>`;
function SimpleMethod() {
console.debug(`Running SimpleMethod`);
}
The SimpleMethod
is in simpleModule.js
. I have imported it in extension.js
by:
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const simpleModule = Me.imports.simpleModule;
class Extension {
enable() {
console.debug(`enabling ${Me.metadata.name}`);
this._dbus_windows = Gio.DBusExportedObject.wrapJSObject(simpleModule.SIMPLE_DBUS_IFACE, this);
this._dbus_windows.export(Gio.DBus.session, '/org/gnome/Shell/Extensions/Windows');
}
...
If SimpleMethod
is in extension.js
then the following command works.
dbus-send --print-reply=literal --session --dest=org.gnome.Shell /org/gnome/Shell/Extensions/Windows org.gnome.Shell.Extensions.Windows.SimpleMethod
But when the SimpleMethod
is in simpleModule
, the above command does not work.
Is there any way i can keep the SimpleMethod
function in simpleModule.js
instead of moving it to extension.js
?