summaryrefslogtreecommitdiff
path: root/src/bin/tyls.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-03-11 20:44:27 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-03-11 20:44:27 +0900
commitde8141dec651e8983c3117802fb469edced51b0a (patch)
tree26f34210d9b0b3534f748f9bef15663c3018d626 /src/bin/tyls.c
parent735d93fbc4f60375794846bb21e0fef3d39fc3ff (diff)
tyls now uses standard icons names for normal files (not starting with
/) so u see icons for files as well as thumbnails for videos, images, svg's etc... and now when u clikc on the icon... u launch it (folders launch in efm... other file types open via the standard tools like with efm/e etc. and highlighted links)
Diffstat (limited to 'src/bin/tyls.c')
-rw-r--r--src/bin/tyls.c592
1 files changed, 337 insertions, 255 deletions
diff --git a/src/bin/tyls.c b/src/bin/tyls.c
index d67b755..2b38c9c 100644
--- a/src/bin/tyls.c
+++ b/src/bin/tyls.c
@@ -194,285 +194,358 @@ typedef struct _Cmatch
194{ 194{
195 short fr, fg, fb; 195 short fr, fg, fb;
196 short br, bg, bb; 196 short br, bg, bb;
197 const char *match; 197 const char *match, *icon;
198} Cmatch; 198} Cmatch;
199 199
200// for regular files 200// for regular files
201const Cmatch fmatch[] = 201const Cmatch fmatch[] =
202{ 202{
203 { 5, 5, 5, 9, 9, 9, "*.jpg"}, 203 { 5, 5, 5, 9, 9, 9, "*.jpg", NULL},
204 { 5, 5, 5, 9, 9, 9, "*.JPG"}, 204 { 5, 5, 5, 9, 9, 9, "*.JPG", NULL},
205 { 5, 5, 5, 9, 9, 9, "*.jpeg"}, 205 { 5, 5, 5, 9, 9, 9, "*.jpeg", NULL},
206 { 5, 5, 5, 9, 9, 9, "*.JPEG"}, 206 { 5, 5, 5, 9, 9, 9, "*.JPEG", NULL},
207 { 5, 5, 5, 9, 9, 9, "*.jfif"}, 207 { 5, 5, 5, 9, 9, 9, "*.jfif", NULL},
208 { 5, 5, 5, 9, 9, 9, "*.JFIF"}, 208 { 5, 5, 5, 9, 9, 9, "*.JFIF", NULL},
209 { 5, 5, 5, 9, 9, 9, "*.jfi"}, 209 { 5, 5, 5, 9, 9, 9, "*.jfi", NULL},
210 { 5, 5, 5, 9, 9, 9, "*.JFI"}, 210 { 5, 5, 5, 9, 9, 9, "*.JFI", NULL},
211 { 5, 5, 5, 9, 9, 9, "*.png"}, 211 { 5, 5, 5, 9, 9, 9, "*.png", NULL},
212 { 5, 5, 5, 9, 9, 9, "*.PNG"}, 212 { 5, 5, 5, 9, 9, 9, "*.PNG", NULL},
213 { 5, 5, 5, 9, 9, 9, "*.bmp"}, 213 { 5, 5, 5, 9, 9, 9, "*.bmp", NULL},
214 { 5, 5, 5, 9, 9, 9, "*.BMP"}, 214 { 5, 5, 5, 9, 9, 9, "*.BMP", NULL},
215 { 5, 5, 5, 9, 9, 9, "*.gif"}, 215 { 5, 5, 5, 9, 9, 9, "*.gif", NULL},
216 { 5, 5, 5, 9, 9, 9, "*.GIF"}, 216 { 5, 5, 5, 9, 9, 9, "*.GIF", NULL},
217 { 5, 5, 5, 9, 9, 9, "*.xcf"}, 217 { 5, 5, 5, 9, 9, 9, "*.xcf", NULL},
218 { 5, 5, 5, 9, 9, 9, "*.XCF"}, 218 { 5, 5, 5, 9, 9, 9, "*.XCF", NULL},
219 { 5, 5, 5, 9, 9, 9, "*.xcf.gz"}, 219 { 5, 5, 5, 9, 9, 9, "*.xcf.gz", NULL},
220 { 5, 5, 5, 9, 9, 9, "*.XCF.gz"}, 220 { 5, 5, 5, 9, 9, 9, "*.XCF.gz", NULL},
221 { 5, 5, 5, 9, 9, 9, "*.svg"}, 221 { 5, 5, 5, 9, 9, 9, "*.svg", NULL},
222 { 5, 5, 5, 9, 9, 9, "*.SVG"}, 222 { 5, 5, 5, 9, 9, 9, "*.SVG", NULL},
223 { 5, 5, 5, 9, 9, 9, "*.svgz"}, 223 { 5, 5, 5, 9, 9, 9, "*.svgz", NULL},
224 { 5, 5, 5, 9, 9, 9, "*.SVGZ"}, 224 { 5, 5, 5, 9, 9, 9, "*.SVGZ", NULL},
225 { 5, 5, 5, 9, 9, 9, "*.svg.gz"}, 225 { 5, 5, 5, 9, 9, 9, "*.svg.gz", NULL},
226 { 5, 5, 5, 9, 9, 9, "*.SVG.GZ"}, 226 { 5, 5, 5, 9, 9, 9, "*.SVG.GZ", NULL},
227 { 5, 5, 5, 9, 9, 9, "*.ppm"}, 227 { 5, 5, 5, 9, 9, 9, "*.ppm", NULL},
228 { 5, 5, 5, 9, 9, 9, "*.PPM"}, 228 { 5, 5, 5, 9, 9, 9, "*.PPM", NULL},
229 { 5, 5, 5, 9, 9, 9, "*.tif"}, 229 { 5, 5, 5, 9, 9, 9, "*.tif", NULL},
230 { 5, 5, 5, 9, 9, 9, "*.TIF"}, 230 { 5, 5, 5, 9, 9, 9, "*.TIF", NULL},
231 { 5, 5, 5, 9, 9, 9, "*.tiff"}, 231 { 5, 5, 5, 9, 9, 9, "*.tiff", NULL},
232 { 5, 5, 5, 9, 9, 9, "*.TIFF"}, 232 { 5, 5, 5, 9, 9, 9, "*.TIFF", NULL},
233 { 5, 5, 5, 9, 9, 9, "*.ico"}, 233 { 5, 5, 5, 9, 9, 9, "*.ico", NULL},
234 { 5, 5, 5, 9, 9, 9, "*.ICO"}, 234 { 5, 5, 5, 9, 9, 9, "*.ICO", NULL},
235 { 5, 5, 5, 9, 9, 9, "*.pgm"}, 235 { 5, 5, 5, 9, 9, 9, "*.pgm", NULL},
236 { 5, 5, 5, 9, 9, 9, "*.PGM"}, 236 { 5, 5, 5, 9, 9, 9, "*.PGM", NULL},
237 { 5, 5, 5, 9, 9, 9, "*.pbm"}, 237 { 5, 5, 5, 9, 9, 9, "*.pbm", NULL},
238 { 5, 5, 5, 9, 9, 9, "*.PBM"}, 238 { 5, 5, 5, 9, 9, 9, "*.PBM", NULL},
239 { 5, 5, 5, 9, 9, 9, "*.psd"}, 239 { 5, 5, 5, 9, 9, 9, "*.psd", NULL},
240 { 5, 5, 5, 9, 9, 9, "*.PSD"}, 240 { 5, 5, 5, 9, 9, 9, "*.PSD", NULL},
241 { 5, 5, 5, 9, 9, 9, "*.wbmp"}, 241 { 5, 5, 5, 9, 9, 9, "*.wbmp", NULL},
242 { 5, 5, 5, 9, 9, 9, "*.WBMP"}, 242 { 5, 5, 5, 9, 9, 9, "*.WBMP", NULL},
243 { 5, 5, 5, 9, 9, 9, "*.cur"}, 243 { 5, 5, 5, 9, 9, 9, "*.cur", NULL},
244 { 5, 5, 5, 9, 9, 9, "*.CUR"}, 244 { 5, 5, 5, 9, 9, 9, "*.CUR", NULL},
245 { 5, 5, 5, 9, 9, 9, "*.arw"}, 245 { 5, 5, 5, 9, 9, 9, "*.arw", NULL},
246 { 5, 5, 5, 9, 9, 9, "*.ARW"}, 246 { 5, 5, 5, 9, 9, 9, "*.ARW", NULL},
247 { 5, 5, 5, 9, 9, 9, "*.webp"}, 247 { 5, 5, 5, 9, 9, 9, "*.webp", NULL},
248 { 5, 5, 5, 9, 9, 9, "*.WEBP"}, 248 { 5, 5, 5, 9, 9, 9, "*.WEBP", NULL},
249 { 5, 5, 5, 9, 9, 9, "*.cr2"}, 249 { 5, 5, 5, 9, 9, 9, "*.cr2", NULL},
250 { 5, 5, 5, 9, 9, 9, "*.CR2"}, 250 { 5, 5, 5, 9, 9, 9, "*.CR2", NULL},
251 { 5, 5, 5, 9, 9, 9, "*.crw"}, 251 { 5, 5, 5, 9, 9, 9, "*.crw", NULL},
252 { 5, 5, 5, 9, 9, 9, "*.CRW"}, 252 { 5, 5, 5, 9, 9, 9, "*.CRW", NULL},
253 { 5, 5, 5, 9, 9, 9, "*.dcr"}, 253 { 5, 5, 5, 9, 9, 9, "*.dcr", NULL},
254 { 5, 5, 5, 9, 9, 9, "*.DCR"}, 254 { 5, 5, 5, 9, 9, 9, "*.DCR", NULL},
255 { 5, 5, 5, 9, 9, 9, "*.dng"}, 255 { 5, 5, 5, 9, 9, 9, "*.dng", NULL},
256 { 5, 5, 5, 9, 9, 9, "*.DNG"}, 256 { 5, 5, 5, 9, 9, 9, "*.DNG", NULL},
257 { 5, 5, 5, 9, 9, 9, "*.k25"}, 257 { 5, 5, 5, 9, 9, 9, "*.k25", NULL},
258 { 5, 5, 5, 9, 9, 9, "*.K25"}, 258 { 5, 5, 5, 9, 9, 9, "*.K25", NULL},
259 { 5, 5, 5, 9, 9, 9, "*.kdc"}, 259 { 5, 5, 5, 9, 9, 9, "*.kdc", NULL},
260 { 5, 5, 5, 9, 9, 9, "*.KDC"}, 260 { 5, 5, 5, 9, 9, 9, "*.KDC", NULL},
261 { 5, 5, 5, 9, 9, 9, "*.thm"}, 261 { 5, 5, 5, 9, 9, 9, "*.thm", NULL},
262 { 5, 5, 5, 9, 9, 9, "*.THM"}, 262 { 5, 5, 5, 9, 9, 9, "*.THM", NULL},
263 { 5, 5, 5, 9, 9, 9, "*.erf"}, 263 { 5, 5, 5, 9, 9, 9, "*.erf", NULL},
264 { 5, 5, 5, 9, 9, 9, "*.ERF"}, 264 { 5, 5, 5, 9, 9, 9, "*.ERF", NULL},
265 { 5, 5, 5, 9, 9, 9, "*.mrw"}, 265 { 5, 5, 5, 9, 9, 9, "*.mrw", NULL},
266 { 5, 5, 5, 9, 9, 9, "*.MRW"}, 266 { 5, 5, 5, 9, 9, 9, "*.MRW", NULL},
267 { 5, 5, 5, 9, 9, 9, "*.nef"}, 267 { 5, 5, 5, 9, 9, 9, "*.nef", NULL},
268 { 5, 5, 5, 9, 9, 9, "*.NEF"}, 268 { 5, 5, 5, 9, 9, 9, "*.NEF", NULL},
269 { 5, 5, 5, 9, 9, 9, "*.nrf"}, 269 { 5, 5, 5, 9, 9, 9, "*.nrf", NULL},
270 { 5, 5, 5, 9, 9, 9, "*.NRF"}, 270 { 5, 5, 5, 9, 9, 9, "*.NRF", NULL},
271 { 5, 5, 5, 9, 9, 9, "*.nrw"}, 271 { 5, 5, 5, 9, 9, 9, "*.nrw", NULL},
272 { 5, 5, 5, 9, 9, 9, "*.NRW"}, 272 { 5, 5, 5, 9, 9, 9, "*.NRW", NULL},
273 { 5, 5, 5, 9, 9, 9, "*.orf"}, 273 { 5, 5, 5, 9, 9, 9, "*.orf", NULL},
274 { 5, 5, 5, 9, 9, 9, "*.ORF"}, 274 { 5, 5, 5, 9, 9, 9, "*.ORF", NULL},
275 { 5, 5, 5, 9, 9, 9, "*.raw"}, 275 { 5, 5, 5, 9, 9, 9, "*.raw", NULL},
276 { 5, 5, 5, 9, 9, 9, "*.RAW"}, 276 { 5, 5, 5, 9, 9, 9, "*.RAW", NULL},
277 { 5, 5, 5, 9, 9, 9, "*.rw2"}, 277 { 5, 5, 5, 9, 9, 9, "*.rw2", NULL},
278 { 5, 5, 5, 9, 9, 9, "*.RW2"}, 278 { 5, 5, 5, 9, 9, 9, "*.RW2", NULL},
279 { 5, 5, 5, 9, 9, 9, "*.pef"}, 279 { 5, 5, 5, 9, 9, 9, "*.pef", NULL},
280 { 5, 5, 5, 9, 9, 9, "*.PEF"}, 280 { 5, 5, 5, 9, 9, 9, "*.PEF", NULL},
281 { 5, 5, 5, 9, 9, 9, "*.raf"}, 281 { 5, 5, 5, 9, 9, 9, "*.raf", NULL},
282 { 5, 5, 5, 9, 9, 9, "*.RAF"}, 282 { 5, 5, 5, 9, 9, 9, "*.RAF", NULL},
283 { 5, 5, 5, 9, 9, 9, "*.sr2"}, 283 { 5, 5, 5, 9, 9, 9, "*.sr2", NULL},
284 { 5, 5, 5, 9, 9, 9, "*.SR2"}, 284 { 5, 5, 5, 9, 9, 9, "*.SR2", NULL},
285 { 5, 5, 5, 9, 9, 9, "*.srf"}, 285 { 5, 5, 5, 9, 9, 9, "*.srf", NULL},
286 { 5, 5, 5, 9, 9, 9, "*.SRF"}, 286 { 5, 5, 5, 9, 9, 9, "*.SRF", NULL},
287 { 5, 5, 5, 9, 9, 9, "*.x3f"}, 287 { 5, 5, 5, 9, 9, 9, "*.x3f", NULL},
288 { 5, 5, 5, 9, 9, 9, "*.X3F"}, 288 { 5, 5, 5, 9, 9, 9, "*.X3F", NULL},
289 289
290 { 5, 5, 2, 9, 9, 9, "*.pdf"}, 290 { 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
291 { 5, 5, 2, 9, 9, 9, "*.PDF"}, 291 { 5, 5, 2, 9, 9, 9, "*.PDF", NULL},
292 { 5, 5, 2, 9, 9, 9, "*.pdf"}, 292 { 5, 5, 2, 9, 9, 9, "*.pdf", NULL},
293 { 5, 5, 2, 9, 9, 9, "*.ps"}, 293 { 5, 5, 2, 9, 9, 9, "*.ps", NULL},
294 { 5, 5, 2, 9, 9, 9, "*.PS"}, 294 { 5, 5, 2, 9, 9, 9, "*.PS", NULL},
295 { 5, 5, 2, 9, 9, 9, "*.ps.gz"}, 295 { 5, 5, 2, 9, 9, 9, "*.ps.gz", NULL},
296 { 5, 5, 2, 9, 9, 9, "*.PS.GZ"}, 296 { 5, 5, 2, 9, 9, 9, "*.PS.GZ", NULL},
297 297
298 { 3, 4, 5, 9, 9, 9, "*.asf"}, 298 { 3, 4, 5, 9, 9, 9, "*.asf", NULL},
299 { 3, 4, 5, 9, 9, 9, "*.avi"}, 299 { 3, 4, 5, 9, 9, 9, "*.avi", NULL},
300 { 3, 4, 5, 9, 9, 9, "*.bdm"}, 300 { 3, 4, 5, 9, 9, 9, "*.bdm", NULL},
301 { 3, 4, 5, 9, 9, 9, "*.bdmv"}, 301 { 3, 4, 5, 9, 9, 9, "*.bdmv", NULL},
302 { 3, 4, 5, 9, 9, 9, "*.clpi"}, 302 { 3, 4, 5, 9, 9, 9, "*.clpi", NULL},
303 { 3, 4, 5, 9, 9, 9, "*.cpi"}, 303 { 3, 4, 5, 9, 9, 9, "*.cpi", NULL},
304 { 3, 4, 5, 9, 9, 9, "*.dv"}, 304 { 3, 4, 5, 9, 9, 9, "*.dv", NULL},
305 { 3, 4, 5, 9, 9, 9, "*.fla"}, 305 { 3, 4, 5, 9, 9, 9, "*.fla", NULL},
306 { 3, 4, 5, 9, 9, 9, "*.flv"}, 306 { 3, 4, 5, 9, 9, 9, "*.flv", NULL},
307 { 3, 4, 5, 9, 9, 9, "*.m1v"}, 307 { 3, 4, 5, 9, 9, 9, "*.m1v", NULL},
308 { 3, 4, 5, 9, 9, 9, "*.m2t"}, 308 { 3, 4, 5, 9, 9, 9, "*.m2t", NULL},
309 { 3, 4, 5, 9, 9, 9, "*.m4v"}, 309 { 3, 4, 5, 9, 9, 9, "*.m4v", NULL},
310 { 3, 4, 5, 9, 9, 9, "*.mkv"}, 310 { 3, 4, 5, 9, 9, 9, "*.mkv", NULL},
311 { 3, 4, 5, 9, 9, 9, "*.mov"}, 311 { 3, 4, 5, 9, 9, 9, "*.mov", NULL},
312 { 3, 4, 5, 9, 9, 9, "*.mp2"}, 312 { 3, 4, 5, 9, 9, 9, "*.mp2", NULL},
313 { 3, 4, 5, 9, 9, 9, "*.mp2ts"}, 313 { 3, 4, 5, 9, 9, 9, "*.mp2ts", NULL},
314 { 3, 4, 5, 9, 9, 9, "*.mp4"}, 314 { 3, 4, 5, 9, 9, 9, "*.mp4", NULL},
315 { 3, 4, 5, 9, 9, 9, "*.mpe"}, 315 { 3, 4, 5, 9, 9, 9, "*.mpe", NULL},
316 { 3, 4, 5, 9, 9, 9, "*.mpeg"}, 316 { 3, 4, 5, 9, 9, 9, "*.mpeg", NULL},
317 { 3, 4, 5, 9, 9, 9, "*.mpg"}, 317 { 3, 4, 5, 9, 9, 9, "*.mpg", NULL},
318 { 3, 4, 5, 9, 9, 9, "*.mpl"}, 318 { 3, 4, 5, 9, 9, 9, "*.mpl", NULL},
319 { 3, 4, 5, 9, 9, 9, "*.mpls"}, 319 { 3, 4, 5, 9, 9, 9, "*.mpls", NULL},
320 { 3, 4, 5, 9, 9, 9, "*.mts"}, 320 { 3, 4, 5, 9, 9, 9, "*.mts", NULL},
321 { 3, 4, 5, 9, 9, 9, "*.mxf"}, 321 { 3, 4, 5, 9, 9, 9, "*.mxf", NULL},
322 { 3, 4, 5, 9, 9, 9, "*.nut"}, 322 { 3, 4, 5, 9, 9, 9, "*.nut", NULL},
323 { 3, 4, 5, 9, 9, 9, "*.nuv"}, 323 { 3, 4, 5, 9, 9, 9, "*.nuv", NULL},
324 { 3, 4, 5, 9, 9, 9, "*.ogg"}, 324 { 3, 4, 5, 9, 9, 9, "*.ogg", NULL},
325 { 3, 4, 5, 9, 9, 9, "*.ogv"}, 325 { 3, 4, 5, 9, 9, 9, "*.ogv", NULL},
326 { 3, 4, 5, 9, 9, 9, "*.ogm"}, 326 { 3, 4, 5, 9, 9, 9, "*.ogm", NULL},
327 { 3, 4, 5, 9, 9, 9, "*.qt"}, 327 { 3, 4, 5, 9, 9, 9, "*.qt", NULL},
328 { 3, 4, 5, 9, 9, 9, "*.rm"}, 328 { 3, 4, 5, 9, 9, 9, "*.rm", NULL},
329 { 3, 4, 5, 9, 9, 9, "*.rmj"}, 329 { 3, 4, 5, 9, 9, 9, "*.rmj", NULL},
330 { 3, 4, 5, 9, 9, 9, "*.rmm"}, 330 { 3, 4, 5, 9, 9, 9, "*.rmm", NULL},
331 { 3, 4, 5, 9, 9, 9, "*.rms"}, 331 { 3, 4, 5, 9, 9, 9, "*.rms", NULL},
332 { 3, 4, 5, 9, 9, 9, "*.rmvb"}, 332 { 3, 4, 5, 9, 9, 9, "*.rmvb", NULL},
333 { 3, 4, 5, 9, 9, 9, "*.rmx"}, 333 { 3, 4, 5, 9, 9, 9, "*.rmx", NULL},
334 { 3, 4, 5, 9, 9, 9, "*.rv"}, 334 { 3, 4, 5, 9, 9, 9, "*.rv", NULL},
335 { 3, 4, 5, 9, 9, 9, "*.swf"}, 335 { 3, 4, 5, 9, 9, 9, "*.swf", NULL},
336 { 3, 4, 5, 9, 9, 9, "*.ts"}, 336 { 3, 4, 5, 9, 9, 9, "*.ts", NULL},
337 { 3, 4, 5, 9, 9, 9, "*.weba"}, 337 { 3, 4, 5, 9, 9, 9, "*.weba", NULL},
338 { 3, 4, 5, 9, 9, 9, "*.webm"}, 338 { 3, 4, 5, 9, 9, 9, "*.webm", NULL},
339 { 3, 4, 5, 9, 9, 9, "*.wmv"}, 339 { 3, 4, 5, 9, 9, 9, "*.wmv", NULL},
340 { 3, 4, 5, 9, 9, 9, "*.3g2"}, 340 { 3, 4, 5, 9, 9, 9, "*.3g2", NULL},
341 { 3, 4, 5, 9, 9, 9, "*.3gp2"}, 341 { 3, 4, 5, 9, 9, 9, "*.3gp2", NULL},
342 { 3, 4, 5, 9, 9, 9, "*.3gpp"}, 342 { 3, 4, 5, 9, 9, 9, "*.3gpp", NULL},
343 { 3, 4, 5, 9, 9, 9, "*.3gpp2"}, 343 { 3, 4, 5, 9, 9, 9, "*.3gpp2", NULL},
344 { 3, 4, 5, 9, 9, 9, "*.3p2"}, 344 { 3, 4, 5, 9, 9, 9, "*.3p2", NULL},
345 { 3, 4, 5, 9, 9, 9, "*.264"}, 345 { 3, 4, 5, 9, 9, 9, "*.264", NULL},
346 { 3, 4, 5, 9, 9, 9, "*.3gp"}, 346 { 3, 4, 5, 9, 9, 9, "*.3gp", NULL},
347 347
348 { 2, 3, 5, 9, 9, 9, "*.mp3"}, 348 { 2, 3, 5, 9, 9, 9, "*.mp3", NULL},
349 { 2, 3, 5, 9, 9, 9, "*.MP3"}, 349 { 2, 3, 5, 9, 9, 9, "*.MP3", NULL},
350 { 2, 3, 5, 9, 9, 9, "*.aac"}, 350 { 2, 3, 5, 9, 9, 9, "*.aac", NULL},
351 { 2, 3, 5, 9, 9, 9, "*.AAC"}, 351 { 2, 3, 5, 9, 9, 9, "*.AAC", NULL},
352 { 2, 3, 5, 9, 9, 9, "*.wav"}, 352 { 2, 3, 5, 9, 9, 9, "*.wav", NULL},
353 { 2, 3, 5, 9, 9, 9, "*.WAV"}, 353 { 2, 3, 5, 9, 9, 9, "*.WAV", NULL},
354 { 2, 3, 5, 9, 9, 9, "*.m3u"}, 354 { 2, 3, 5, 9, 9, 9, "*.m3u", "audio-x-mp3-playlist"},
355 { 2, 3, 5, 9, 9, 9, "*.M3U"}, 355 { 2, 3, 5, 9, 9, 9, "*.M3U", "audio-x-mp3-playlist"},
356 356
357 { 3, 5, 2, 9, 9, 9, "*.patch"}, 357 { 3, 5, 2, 9, 9, 9, "*.patch", "text-x-generic"},
358 { 3, 5, 2, 9, 9, 9, "*.PATCH"}, 358 { 3, 5, 2, 9, 9, 9, "*.PATCH", "text-x-generic"},
359 { 3, 5, 2, 9, 9, 9, "*.diff"}, 359 { 3, 5, 2, 9, 9, 9, "*.diff", "text-x-generic"},
360 { 3, 5, 2, 9, 9, 9, "*.DIFF"}, 360 { 3, 5, 2, 9, 9, 9, "*.DIFF", "text-x-generic"},
361 361
362 { 5, 1, 1, 9, 9, 9, "*.tar.*"}, 362 { 5, 3, 0, 9, 9, 9, "*.rpm", "package-x-generic"},
363 { 5, 1, 1, 9, 9, 9, "*.TAR.*"}, 363 { 5, 3, 0, 9, 9, 9, "*.RPM", "package-x-generic"},
364 { 5, 1, 1, 9, 9, 9, "*.tar"}, 364 { 5, 3, 0, 9, 9, 9, "*.srpm", "package-x-generic"},
365 { 5, 1, 1, 9, 9, 9, "*.TAR"}, 365 { 5, 3, 0, 9, 9, 9, "*.SRPM", "package-x-generic"},
366 { 5, 1, 1, 9, 9, 9, "*.tgz"}, 366 { 5, 3, 0, 9, 9, 9, "*.deb", "package-x-generic"},
367 { 5, 1, 1, 9, 9, 9, "*.TGZ"}, 367 { 5, 3, 0, 9, 9, 9, "*.DEB", "package-x-generic"},
368 { 5, 1, 1, 9, 9, 9, "*.tbz"}, 368 { 5, 3, 0, 9, 9, 9, "*.pkg.tar.xz", "package-x-generic"},
369 { 5, 1, 1, 9, 9, 9, "*.TBZ"}, 369 { 5, 3, 0, 9, 9, 9, "*.PKG.TAR.XZ", "package-x-generic"},
370 { 5, 1, 1, 9, 9, 9, "*.zip"}, 370
371 { 5, 1, 1, 9, 9, 9, "*.ZIP"}, 371 { 5, 1, 1, 9, 9, 9, "*.tar.*", "application-x-tar"},
372 { 5, 1, 1, 9, 9, 9, "*.rar"}, 372 { 5, 1, 1, 9, 9, 9, "*.TAR.*", "application-x-tar"},
373 { 5, 1, 1, 9, 9, 9, "*.RAR"}, 373 { 5, 1, 1, 9, 9, 9, "*.tar", "application-x-tar"},
374 { 5, 1, 1, 9, 9, 9, "*.cpio"}, 374 { 5, 1, 1, 9, 9, 9, "*.TAR", "application-x-tar"},
375 { 5, 1, 1, 9, 9, 9, "*.CPIO"}, 375 { 5, 1, 1, 9, 9, 9, "*.tgz", "application-x-tar"},
376 376 { 5, 1, 1, 9, 9, 9, "*.TGZ", "application-x-tar"},
377 { 0, 5, 2, 9, 9, 9, "*.iso"}, 377 { 5, 1, 1, 9, 9, 9, "*.tbz", "application-x-tar"},
378 { 0, 5, 2, 9, 9, 9, "*.ISO"}, 378 { 5, 1, 1, 9, 9, 9, "*.TBZ", "application-x-tar"},
379 { 0, 5, 2, 9, 9, 9, "*.img"}, 379 { 5, 1, 1, 9, 9, 9, "*.zip", "application-x-zip"},
380 { 0, 5, 2, 9, 9, 9, "*.IMG"}, 380 { 5, 1, 1, 9, 9, 9, "*.ZIP", "application-x-zip"},
381 { 5, 1, 1, 9, 9, 9, "*.rar", "text-x-generic"},
382 { 5, 1, 1, 9, 9, 9, "*.RAR", "text-x-generic"},
383 { 5, 1, 1, 9, 9, 9, "*.cpio", "text-x-generic"},
384 { 5, 1, 1, 9, 9, 9, "*.CPIO", "text-x-generic"},
385
386 { 0, 5, 2, 9, 9, 9, "*.iso", "application-x-cd-image"},
387 { 0, 5, 2, 9, 9, 9, "*.ISO", "application-x-cd-image"},
388 { 0, 5, 2, 9, 9, 9, "*.img", "text-x-generic"},
389 { 0, 5, 2, 9, 9, 9, "*.IMG", "text-x-generic"},
381 390
382 { 1, 1, 1, 9, 9, 9, "*~"}, 391 { 3, 5, 1, 9, 9, 9, "*.ttf", "font-x-generic"},
383 392 { 3, 5, 1, 9, 9, 9, "*.TTF", "font-x-generic"},
384 { 5, 3, 1, 9, 9, 9, "Makefile"}, 393 { 3, 5, 1, 9, 9, 9, "*.bdf", "font-x-generic"},
385 { 4, 2, 0, 9, 9, 9, "Makefile.in"}, 394 { 3, 5, 1, 9, 9, 9, "*.BDF", "font-x-generic"},
386 { 3, 1, 0, 9, 9, 9, "*.am"}, 395 { 3, 5, 1, 9, 9, 9, "*.pcf", "font-x-generic"},
387 396 { 3, 5, 1, 9, 9, 9, "*.PCF", "font-x-generic"},
388 { 4, 1, 5, 9, 9, 9, "*.m4"}, 397
389 398 { 1, 1, 1, 9, 9, 9, "*~", "text-x-generic"},
390 { 5, 2, 0, 9, 9, 9, "*.sh"}, 399
391 { 5, 2, 0, 9, 9, 9, "*.SH"}, 400 { 1, 2, 2, 9, 9, 9, "stamp-h1", "text-x-generic"},
392 { 5, 2, 0, 9, 9, 9, "*.bin"},
393 { 5, 2, 0, 9, 9, 9, "*.BIN"},
394 { 5, 2, 0, 9, 9, 9, "*.run"},
395 { 5, 2, 0, 9, 9, 9, "*.RUN"},
396 401
397 { 5, 4, 0, 9, 9, 9, "configure"}, 402 { 5, 3, 1, 9, 9, 9, "Makefile", "text-x-generic"},
398 { 5, 3, 0, 9, 9, 9, "configure.in"}, 403 { 4, 2, 0, 9, 9, 9, "Makefile.in", "text-x-generic"},
399 { 5, 2, 0, 9, 9, 9, "configure.ac"}, 404 { 3, 1, 0, 9, 9, 9, "*.am", "text-x-generic"},
400 405
401 { 2, 2, 3, 9, 9, 9, "*.in"}, 406 { 4, 2, 5, 9, 9, 9, "*.spec", "text-x-generic"},
407
408 { 4, 1, 5, 9, 9, 9, "*.m4", "application-x-m4"},
409
410 { 5, 2, 0, 9, 9, 9, "*.sh", "text-x-generic"},
411 { 5, 2, 0, 9, 9, 9, "*.SH", "text-x-generic"},
412 { 5, 2, 0, 9, 9, 9, "*.bin", "text-x-generic"},
413 { 5, 2, 0, 9, 9, 9, "*.BIN", "text-x-generic"},
414 { 5, 2, 0, 9, 9, 9, "*.run", "text-x-generic"},
415 { 5, 2, 0, 9, 9, 9, "*.RUN", "text-x-generic"},
416
417 { 5, 4, 0, 9, 9, 9, "configure", "text-x-generic"},
418 { 5, 3, 0, 9, 9, 9, "configure.in", "text-x-generic"},
419 { 5, 2, 0, 9, 9, 9, "configure.ac", "text-x-generic"},
420
421 { 2, 2, 3, 9, 9, 9, "*.in", "text-x-generic"},
402 422
403 { 0, 5, 5, 9, 9, 9, "*.c"}, 423 { 0, 5, 5, 9, 9, 9, "*.c", "text-x-c"},
404 { 0, 5, 5, 9, 9, 9, "*.C"}, 424 { 0, 5, 5, 9, 9, 9, "*.C", "text-x-c"},
405 { 1, 4, 5, 9, 9, 9, "*.x"}, 425 { 1, 4, 5, 9, 9, 9, "*.x", "text-x-c"},
406 { 1, 4, 5, 9, 9, 9, "*.X"}, 426 { 1, 4, 5, 9, 9, 9, "*.X", "text-x-c"},
407 { 1, 3, 5, 9, 9, 9, "*.h"}, 427 { 1, 3, 5, 9, 9, 9, "*.h", "text-x-chdr"},
408 { 1, 3, 5, 9, 9, 9, "*.H"}, 428 { 1, 3, 5, 9, 9, 9, "*.H", "text-x-chdr"},
409 429
410 { 5, 5, 2, 9, 9, 9, "*.edc"}, 430 { 5, 5, 2, 9, 9, 9, "*.edc", "text-x-generic"},
411 { 5, 5, 2, 9, 9, 9, "*.EDC"}, 431 { 5, 5, 2, 9, 9, 9, "*.EDC", "text-x-generic"},
412 432
413 { 5, 3, 0, 9, 9, 9, "*.edj"}, 433 { 5, 3, 0, 9, 9, 9, "*.edj", "text-x-generic"},
414 { 5, 3, 0, 9, 9, 9, "*.EDJ"}, 434 { 5, 3, 0, 9, 9, 9, "*.EDJ", "text-x-generic"},
415 435
416 { 5, 0, 5, 9, 9, 9, "*.cc"}, 436 { 5, 0, 5, 9, 9, 9, "*.cc", "text-x-c++"},
417 { 5, 0, 5, 9, 9, 9, "*.CC"}, 437 { 5, 0, 5, 9, 9, 9, "*.CC", "text-x-c++"},
418 { 3, 1, 5, 9, 9, 9, "*.hh"}, 438 { 3, 1, 5, 9, 9, 9, "*.hh", "text-x-c++hdr"},
419 { 3, 1, 5, 9, 9, 9, "*.HH"}, 439 { 3, 1, 5, 9, 9, 9, "*.HH", "text-x-c++hdr"},
420 440
421 { 2, 0, 5, 9, 9, 9, "*.desktop"}, 441 { 5, 5, 2, 9, 9, 9, "*.php", "application-x-php"},
422 { 2, 0, 5, 9, 9, 9, "*.directory"}, 442 { 5, 5, 2, 9, 9, 9, "*.PHP", "application-x-php"},
443
444 { 2, 0, 5, 9, 9, 9, "*.desktop", "application-x-desktop"},
445 { 2, 0, 5, 9, 9, 9, "*.directory", "application-x-desktop"},
423 446
424 { 0, 1, 3, 9, 9, 9, "*.o"}, 447 { 0, 1, 3, 9, 9, 9, "*.o", "text-x-generic"},
425 { 0, 1, 3, 9, 9, 9, "*.O"}, 448 { 0, 1, 3, 9, 9, 9, "*.O", "text-x-generic"},
426 { 0, 1, 3, 9, 9, 9, "*.lo"}, 449 { 0, 1, 3, 9, 9, 9, "*.lo", "text-x-generic"},
427 450 { 0, 1, 3, 9, 9, 9, "*.la", "text-x-generic"},
428 { 5, 1, 3, 9, 9, 9, "*.log"}, 451
429 { 5, 1, 3, 9, 9, 9, "*.LOG"}, 452 { 5, 1, 3, 9, 9, 9, "*.log", "text-x-generic"},
430 453 { 5, 1, 3, 9, 9, 9, "*.LOG", "text-x-generic"},
431 { 3, 1, 5, 9, 9, 9, "*.txt"}, 454
432 { 3, 1, 5, 9, 9, 9, "*.TXT"}, 455 { 3, 1, 5, 9, 9, 9, "*.txt", "text-x-generic"},
433 { 3, 1, 5, 9, 9, 9, "README"}, 456 { 3, 1, 5, 9, 9, 9, "*.TXT", "text-x-generic"},
434 { 3, 1, 5, 9, 9, 9, "Readme"}, 457 { 3, 1, 5, 9, 9, 9, "*.xml", "text-xml"},
435 { 3, 1, 5, 9, 9, 9, "readme"}, 458 { 3, 1, 5, 9, 9, 9, "*.XML", "text-xml"},
436 { 3, 1, 5, 9, 9, 9, "INSTALL"}, 459 { 3, 1, 5, 9, 9, 9, "README", "text-x-generic"},
437 { 3, 1, 5, 9, 9, 9, "COPYING"}, 460 { 3, 1, 5, 9, 9, 9, "Readme", "text-x-generic"},
438 { 3, 1, 5, 9, 9, 9, "NEWS"}, 461 { 3, 1, 5, 9, 9, 9, "readme", "text-x-generic"},
439 { 3, 1, 5, 9, 9, 9, "ChangeLog"}, 462 { 3, 1, 5, 9, 9, 9, "INSTALL", "text-x-generic"},
440 { 3, 1, 5, 9, 9, 9, "AUTHORS"}, 463 { 3, 1, 5, 9, 9, 9, "COPYING", "text-x-generic"},
441 { 3, 1, 5, 9, 9, 9, "TODO"}, 464 { 3, 1, 5, 9, 9, 9, "NEWS", "text-x-generic"},
442 { 3, 1, 5, 9, 9, 9, "*.doc"}, 465 { 3, 1, 5, 9, 9, 9, "ChangeLog", "text-x-changelog"},
443 { 3, 1, 5, 9, 9, 9, "*.DOC"}, 466 { 3, 1, 5, 9, 9, 9, "AUTHORS", "text-x-generic"},
444 { 3, 1, 5, 9, 9, 9, "*.docx"}, 467 { 3, 1, 5, 9, 9, 9, "TODO", "text-x-generic"},
445 { 3, 1, 5, 9, 9, 9, "*.DOCX"}, 468 { 3, 1, 5, 9, 9, 9, "*.doc", "x-office-document"},
446 { 3, 1, 5, 9, 9, 9, "*.html"}, 469 { 3, 1, 5, 9, 9, 9, "*.DOC", "x-office-document"},
447 { 3, 1, 5, 9, 9, 9, "*.HTML"}, 470 { 3, 1, 5, 9, 9, 9, "*.docx", "x-office-document"},
448 { 3, 1, 5, 9, 9, 9, "*.htm"}, 471 { 3, 1, 5, 9, 9, 9, "*.DOCX", "x-office-document"},
449 { 3, 1, 5, 9, 9, 9, "*.HTM"}, 472 { 3, 1, 5, 9, 9, 9, "*.html", "text-x-html"},
473 { 3, 1, 5, 9, 9, 9, "*.HTML", "text-x-html"},
474 { 3, 1, 5, 9, 9, 9, "*.htm", "text-x-html"},
475 { 3, 1, 5, 9, 9, 9, "*.HTM", "text-x-html"},
476 { 3, 1, 5, 9, 9, 9, "*.css", "text-x-css"},
477 { 3, 1, 5, 9, 9, 9, "*.CSS", "text-x-css"},
450 478
451 { 0, 0, 0, 0, 0, 0, NULL} 479 { 0, 0, 0, 0, 0, 0, NULL, NULL}
452}; 480};
453 481
454// for directories 482// for directories
455const Cmatch dmatch[] = 483const Cmatch dmatch[] =
456{ 484{
457 { 5, 3, 0, 9, 9, 9, "Desktop"}, 485 { 5, 3, 0, 9, 9, 9, "Desktop", "user-desktop"},
458 { 5, 3, 0, 9, 9, 9, "Desktop-*"}, 486 { 5, 3, 0, 9, 9, 9, "Desktop-*", "user-desktop"},
459 { 4, 1, 5, 9, 9, 9, "public_html"}, 487 { 4, 1, 5, 9, 9, 9, "public_html", "folder"},
460 { 0, 0, 0, 0, 0, 0, NULL} 488 { 1, 3, 5, 9, 9, 9, "*", "folder"},
489 { 0, 0, 0, 0, 0, 0, NULL, NULL}
461}; 490};
462 491
463// for exectuable files 492// for exectuable files
464const Cmatch xmatch[] = 493const Cmatch xmatch[] =
465{ 494{
466 { 5, 2, 0, 9, 9, 9, "*.sh"}, 495 { 5, 2, 0, 9, 9, 9, "*.sh", "text-x-script"},
467 { 5, 2, 0, 9, 9, 9, "*.bin"}, 496 { 5, 2, 0, 9, 9, 9, "*.bin", "application-x-executable"},
468 { 5, 2, 0, 9, 9, 9, "*.BIN"}, 497 { 5, 2, 0, 9, 9, 9, "*.BIN", "application-x-executable"},
498
499 { 4, 0, 4, 9, 9, 9, "*.exe", "application-x-executable"},
500 { 4, 0, 4, 9, 9, 9, "*.EXE", "application-x-executable"},
469 501
470 { 4, 0, 4, 9, 9, 9, "*.exe"}, 502 { 5, 0, 5, 9, 9, 9, "*", "application-x-executable"},
471 { 4, 0, 4, 9, 9, 9, "*.EXE"},
472 503
473 { 0, 0, 0, 0, 0, 0, NULL} 504 { 0, 0, 0, 0, 0, 0, NULL, NULL}
474}; 505};
475 506
507static const char *
508filematch(const char *name, const Cmatch *m)
509{
510 int i;
511
512 for (i = 0; m[i].match; i++)
513 {
514 if (!fnmatch(m[i].match, name, 0))
515 return m[i].icon;
516 }
517 return NULL;
518}
519
520static const char *
521fileicon(const char *path)
522{
523 Eina_Bool isdir = EINA_FALSE;
524 Eina_Bool islink = EINA_FALSE;
525 Eina_Bool isexec = EINA_FALSE;
526 const char *name;
527
528 name = ecore_file_file_get(path);
529 if (name)
530 {
531 char *ts;
532
533 if (ecore_file_is_dir(path)) isdir = EINA_TRUE;
534 ts = ecore_file_readlink(path);
535 if (ts)
536 {
537 islink = EINA_TRUE;
538 free(ts);
539 }
540 if (ecore_file_can_exec(path)) isexec = EINA_TRUE;
541
542 if (isdir) return filematch(name, dmatch);
543 else if (isexec) return filematch(name, xmatch);
544 else return filematch(name, fmatch);
545 }
546 return NULL;
547}
548
476static Eina_Bool 549static Eina_Bool
477printmatch(const char *name, const Cmatch *m) 550printmatch(const char *name, const Cmatch *m)
478{ 551{
@@ -604,22 +677,29 @@ list_dir(const char *dir, int mode)
604 rows = ((num + (cols - 1)) / cols); 677 rows = ((num + (cols - 1)) / cols);
605 for (i = 0; i < rows; i++) 678 for (i = 0; i < rows; i++)
606 { 679 {
680 char buf[4096];
681 const char *icon;
682
607 if (mode == SMALL) 683 if (mode == SMALL)
608 { 684 {
609 for (c = 0; c < cols; c++) 685 for (c = 0; c < cols; c++)
610 { 686 {
611 char buf[4096], sz[6], szch = ' '; 687 char sz[6], szch = ' ';
612 long long size; 688 long long size;
613 689
614 s = names[(c * rows) + i]; 690 s = names[(c * rows) + i];
615 if (!s) continue; 691 if (!s) continue;
616 snprintf(buf, sizeof(buf), "%s/%s", dir, s); 692 snprintf(buf, sizeof(buf), "%s/%s", dir, s);
617 int len = eina_unicode_utf8_get_len(s); 693 int len = eina_unicode_utf8_get_len(s);
694 icon = fileicon(buf);
618 cw = tw / cols; 695 cw = tw / cols;
619 size = ecore_file_size(buf); 696 size = ecore_file_size(buf);
620 size_print(sz, sizeof(sz), &szch, size); 697 size_print(sz, sizeof(sz), &szch, size);
621 len += stuff; 698 len += stuff;
622 printf("%c}it#%i;%i;%s%c", 0x1b, 2, 1, buf, 0); 699 if (icon)
700 printf("%c}it#%i;%i;%s\n%s%c", 0x1b, 2, 1, buf, icon, 0);
701 else
702 printf("%c}it#%i;%i;%s%c", 0x1b, 2, 1, buf, 0);
623 printf("%c}ib%c", 0x1b, 0); 703 printf("%c}ib%c", 0x1b, 0);
624 printf("##"); 704 printf("##");
625 printf("%c}ie%c", 0x1b, 0); 705 printf("%c}ie%c", 0x1b, 0);
@@ -634,16 +714,18 @@ list_dir(const char *dir, int mode)
634 { 714 {
635 for (c = 0; c < cols; c++) 715 for (c = 0; c < cols; c++)
636 { 716 {
637 char buf[4096];
638
639 s = names[(c * rows) + i]; 717 s = names[(c * rows) + i];
640 if (!s) continue; 718 if (!s) continue;
641 int len = eina_unicode_utf8_get_len(s); 719 int len = eina_unicode_utf8_get_len(s);
642 snprintf(buf, sizeof(buf), "%s/%s", dir, s); 720 snprintf(buf, sizeof(buf), "%s/%s", dir, s);
721 icon = fileicon(buf);
643 cw = tw / cols; 722 cw = tw / cols;
644 len += 4; 723 len += 4;
645 if (cols > 1) len += 1; 724 if (cols > 1) len += 1;
646 printf("%c}it%c%i;%i;%s%c", 0x1b, 33 + c, 4, 2, buf, 0); 725 if (icon)
726 printf("%c}it%c%i;%i;%s\n%s%c", 0x1b, 33 + c, 4, 2, buf, icon, 0);
727 else
728 printf("%c}it%c%i;%i;%s%c", 0x1b, 33 + c, 4, 2, buf, 0);
647 printf("%c}ib%c", 0x1b, 0); 729 printf("%c}ib%c", 0x1b, 0);
648 printf("%c%c%c%c", 33 + c, 33 + c, 33 + c, 33 + c); 730 printf("%c%c%c%c", 33 + c, 33 + c, 33 + c, 33 + c);
649 printf("%c}ie%c", 0x1b, 0); 731 printf("%c}ie%c", 0x1b, 0);
@@ -656,7 +738,7 @@ list_dir(const char *dir, int mode)
656 printf("\n"); 738 printf("\n");
657 for (c = 0; c < cols; c++) 739 for (c = 0; c < cols; c++)
658 { 740 {
659 char buf[4096], sz[6], szch = ' '; 741 char sz[6], szch = ' ';
660 long long size; 742 long long size;
661 int len; 743 int len;
662 744