[gnome-shell] Add gnome-shell --eval-file
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Add gnome-shell --eval-file
- Date: Fri, 13 Nov 2009 17:44:56 +0000 (UTC)
commit 8c05003acf87f201f7989869e3c1f4d6e46c74b2
Author: Colin Walters <walters verbum org>
Date: Thu Nov 12 18:18:34 2009 -0500
Add gnome-shell --eval-file
Convenience utility function for evaluating an arbitrary
JavaScript file.
src/gnome-shell.in | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index 2acc967..e5ef509 100644
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -212,6 +212,8 @@ parser.add_option("", "--geometry", metavar="GEOMETRY",
default="1024x768");
parser.add_option("-w", "--wide", action="store_true",
help="Use widescreen (1280x800) with Xephyr")
+parser.add_option("", "--eval-file", metavar="EVAL_FILE",
+ help="Evaluate the contents of the given JavaScript file")
options, args = parser.parse_args()
@@ -219,6 +221,20 @@ if args:
parser.print_usage()
sys.exit(1)
+if options.eval_file:
+ import dbus
+
+ f = open(options.eval_file)
+ contents = f.read()
+ f.close()
+
+ session = dbus.SessionBus()
+ shell = session.get_object('org.gnome.Shell', '/org/gnome/Shell')
+ shell = dbus.Interface(shell, 'org.gnome.Shell')
+ result = shell.Eval(contents)
+ print result
+ sys.exit(0)
+
if options.debug_command:
options.debug = True
elif options.debug:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]