1
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
3
const DBus = imports.dbus;
4
const Lang = imports.lang;
5
const Shell = imports.gi.Shell;
6
const Mainloop = imports.mainloop;
8
const Main = imports.ui.main;
10
const GnomeShellIface = {
11
name: "org.gnome.Shell",
12
methods: [{ name: "Eval",
18
properties: [{ name: "OverviewActive",
20
access: "readwrite" }]
23
function GnomeShell() {
27
GnomeShell.prototype = {
29
DBus.session.exportObject('/org/gnome/Shell', this);
34
* @code: A string containing JavaScript code
36
* This function executes arbitrary code in the main
37
* loop, and returns a boolean success and
38
* JSON representation of the object as a string.
40
* If evaluation completes without throwing an exception,
41
* then the return value will be [true, JSON.stringify(result)].
42
* If evaluation fails, then the return value will be
43
* [false, JSON.stringify(exception)];
46
Eval: function(code) {
50
returnValue = JSON.stringify(eval(code));
53
returnValue = JSON.stringify(e);
56
return [success, returnValue];
59
get OverviewActive() {
60
return Main.overview.visible;
63
set OverviewActive(visible) {
71
DBus.conformExport(GnomeShell.prototype, GnomeShellIface);