summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-20 03:16:30 +0100
committerhut <hut@lavabit.com>2010-01-20 03:16:30 +0100
commit845bd407b461138abbdc890bd8e9043b0236b46f (patch)
treec824eec1ea0d5e9f5a67ce5acaffe16cb91ad7ea
parentba3c477b4144943ceb1bd07cf316828e9e742a4d (diff)
downloadranger-845bd407b461138abbdc890bd8e9043b0236b46f.tar.gz
apps: added a few application definitions
-rw-r--r--ranger/defaults/apps.py58
1 files changed, 56 insertions, 2 deletions
diff --git a/ranger/defaults/apps.py b/ranger/defaults/apps.py
index 62866cb6..0bb1c5cb 100644
--- a/ranger/defaults/apps.py
+++ b/ranger/defaults/apps.py
@@ -12,15 +12,27 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
+from re import compile, VERBOSE
 from ranger.applications import *
 
+INTERPRETED_LANGUAGES = compile(r'''
+	^(text|application)\/x-(
+		haskell|perl|python|ruby|sh
+	)$''', VERBOSE)
+
 class CustomApplications(Applications):
 	def app_default(self, c):
 		"""How to determine the default application?"""
 		f = c.file
 
-		if f.extension is not None and f.extension in ('pdf'):
-			return self.app_apvlv(c)
+		if f.extension is not None:
+			if f.extension in ('pdf'):
+				return self.app_apvlv(c)
+			if f.extension in ('swc', 'smc'):
+				return self.app_zsnes(c)
+
+		if INTERPRETED_LANGUAGES.match(f.mimetype):
+			return self.app_edit_or_run(c)
 
 		if f.container:
 			return self.app_aunpack(c)
@@ -45,6 +57,11 @@ class CustomApplications(Applications):
 
 	app_editor = app_vim
 
+	def app_edit_or_run(self, c):
+		if c.mode is 1:
+			return self.app_self(c)
+		return self.app_editor(c)
+
 	def app_mplayer(self, c):
 		if c.mode is 1:
 			return tup('mplayer', *c)
@@ -81,3 +98,40 @@ class CustomApplications(Applications):
 	def app_apvlv(self, c):
 		c.flags += 'd'
 		return tup('apvlv', *c)
+
+	def app_make(self, c):
+		if c.mode is 0:
+			return tup("make")
+		if c.mode is 1:
+			return tup("make", "install")
+		if c.mode is 2:
+			return tup("make", "clear")
+	
+	def app_firefox(self, c):
+		return tup("firefox")
+
+	def app_javac(self, c):
+		return tup("javac", *c)
+	
+	def app_java(self, c):
+		def strip_extensions(file):
+			if '.' in file.basename:
+				return file.path[:file.path.index('.')]
+			return file.path
+		files_without_extensions = map(strip_extensions, c.files)
+		return tup("java", files_without_extensions)
+	
+	def app_zsnes(self, c):
+		return tup("zsnes", c.file)
+	
+	def app_evince(self, c):
+		return tup("evince", *c)
+	
+	def app_wine(self, c):
+		return tup("wine", c.file)
+
+	def app_totem(self, c):
+		if c.mode is 0:
+			return tup("totem", "--fullscreen", *c)
+		if c.mode is 1:
+			return tup("totem", *c)
=hlt&id=c762564bd754884e847922c99172076fde4d646e'>c762564b ^
805d58c6 ^
4a39d12d ^
c762564b ^

9e751bb8 ^
672e3e50 ^

a654e4ec ^



e5c11a51 ^






















a654e4ec ^

672e3e50 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^




2c678a4e ^
204dae92 ^

2c678a4e ^
805d58c6 ^
5fe060d5 ^
805d58c6 ^

204dae92 ^
2c678a4e ^
5fe060d5 ^
805d58c6 ^
204dae92 ^

5fe060d5 ^
805d58c6 ^
204dae92 ^




5fe060d5 ^
2c678a4e ^
5fe060d5 ^
204dae92 ^



5fe060d5 ^











204dae92 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
201458e3 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
201458e3 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^










































204dae92 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
201458e3 ^
5fe060d5 ^
204dae92 ^


5fe060d5 ^
201458e3 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^
204dae92 ^
5fe060d5 ^














204dae92 ^
5fe060d5 ^



























204dae92 ^
5fe060d5 ^








672e3e50 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238