41 lines
No EOL
987 B
JavaScript
41 lines
No EOL
987 B
JavaScript
/*
|
|
* Example: clearing messages
|
|
*
|
|
* gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/EvilEval * --method org.gnome.Shell.Extensions.EvilEval.Eval "Main.panel.statusArea.dateMenu._messageList.* _sectionList.get_children().forEach(s => s.clear());"
|
|
*
|
|
*/
|
|
|
|
const { Gio } = imports.gi;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
|
|
const DBUS_INTERFACE = `
|
|
<node>
|
|
<interface name="org.gnome.Shell.Extensions.EvilEval">
|
|
<method name="Eval">
|
|
<arg type="s" direction="in" name="code"/>
|
|
</method>
|
|
</interface>
|
|
</node>`;
|
|
|
|
class Extension {
|
|
enable() {
|
|
this._dbus = Gio.DBusExportedObject.wrapJSObject(DBUS_INTERFACE, this);
|
|
this._dbus.export(Gio.DBus.session, '/org/gnome/Shell/Extensions/EvilEval');
|
|
}
|
|
|
|
disable() {
|
|
this._dbus.flush();
|
|
this._dbus.unexport();
|
|
delete this._dbus;
|
|
}
|
|
|
|
Eval(code) {
|
|
eval(code);
|
|
}
|
|
}
|
|
|
|
function init() {
|
|
return new Extension();
|
|
} |