Anonymous avatar Anonymous committed ad9de93

--install

Comments (0)

Files changed (1)

 from os import environ, popen, stat, system
 from stat import S_IEXEC
 from string import strip
+from time import time
+
+def install_gnome():
+    def config(dirname):
+        return "%s/.gconf/apps/metacity/%s/%%gconf.xml" % dirname
+
+    with open(config("keybinding_commands"), "w") as fo:
+        xml = '''<?xml version="1.0"?>
+                    <gconf>
+                    <entry name="command_1" mtime="%d" type="string">
+                            <stringvalue>%s</stringvalue>
+                    </entry>
+                    </gconf>''' % (time(), __file__)
+        fo.write(xml)
+
+
+    with open(config("global_keybindings"), "w") as fo:
+        xml = '''<?xml version="1.0"?>
+            <gconf>
+                <entry name="run_command_1" mtime="%d" type="string">
+                    <stringvalue>&lt;Control&gt;&lt;Shift&gt;k</stringvalue>
+                </entry>
+            </gconf>''' % time()
+        fo.write(xml)
 
 def unique(items):
     seen = set()
 
     parser = OptionParser(usage="usage: %prog", 
             version="tll %s" % __version__)
+    parser.add_option("--install", help="install key bindings", 
+                  dest="install", default="")
 
     opts, args = parser.parse_args(argv[1:])
+
+    if opts.install:
+        if opts.install != "gnome":
+            raise SystemExit("error: only gnome install supported")
+        install_gnome()
+        raise SystemExit
+
+
     if len(args) != 0:
         parser.error("wrong number of arguments") # Will exit
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.