diff python/dmenu.py @ 297:618db1b1f34b

dmenu + emacs, baby
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 11 May 2013 10:00:48 -0700
parents 8f92aa15406f
children
line wrap: on
line diff
--- a/python/dmenu.py	Sat May 11 06:50:40 2013 -0700
+++ b/python/dmenu.py	Sat May 11 10:00:48 2013 -0700
@@ -2,6 +2,7 @@
 
 import optparse
 import os
+import shlex
 import subprocess
 import sys
 
@@ -38,8 +39,13 @@
     chosen =  choose_file(options.directory)
     if chosen:
         if options.executable:
-            pass
-        print chosen
+            # TODO: extract this pattern (see ims journal.txt)
+            command = shlex.split(options.executable)
+            executable = command[0]
+            command.append(chosen)
+            os.execlp(executable, *command)
+        else:
+            print chosen
     else:
         sys.exit(1)