summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-09 05:22:30 +0200
committerhut <hut@lavabit.com>2011-10-09 05:59:17 +0200
commitd288ec979e7e5e6949066e72cbbbcd6e6509065a (patch)
treeff74f3af974325b20ad2ac7285f1b4a86f71c1c5
parent710b0bb77fef315bb023a32e244e0da663cfb532 (diff)
downloadranger-d288ec979e7e5e6949066e72cbbbcd6e6509065a.tar.gz
data/apps.py: updated
-rw-r--r--ranger/data/apps.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/ranger/data/apps.py b/ranger/data/apps.py
index c9958e1e..8a50604d 100644
--- a/ranger/data/apps.py
+++ b/ranger/data/apps.py
@@ -54,6 +54,15 @@
 # 4. "None" to indicate that no action was found.
 #     return None
 # ===================================================================
+# When using the "either" method, ranger determines which program to
+# pick by looking at its dependencies.  You can set dependencies by
+# adding the decorator "depends_on":
+#     @depends_on("vim")
+#     def app_vim(self, context):
+#         ....
+# There is a special keyword which you can use as a dependence: "X"
+# This ensures that the program will only run when X is running.
+# ===================================================================
 
 # Import the basics
 from ranger.defaults.apps import CustomApplications as DefaultApps
@@ -93,13 +102,16 @@ class CustomApplications(DefaultApps):
 
 ## Often a programs invocation is trivial.  For example:
 ##    vim test.py readme.txt [...]
+##
 ## This could be implemented like:
 ##    @depends_on("vim")
 ##    def app_vim(self, context):
 ##        return "vim", context
-## Instead of creating such a generic function for each program, just add
-## its name here and it will be automatically done for you.
-#CustomApplications.generic('zsnes', 'javac')
+##
+## But this is redundant and ranger does this automatically.  However, sometimes
+## you want to change some properties like flags or dependencies.  This can be
+## done with the generic() classmethod.
+#CustomApplications.generic('zsnes', 'wine', deps=['X'])
 
 ## By setting flags='d', this programs will not block ranger's terminal:
-#CustomApplications.generic('gimp', 'evince', flags='d')
+#CustomApplications.generic('gimp', 'evince', deps=['X'], flags='d')