-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.toml.advanced
478 lines (376 loc) · 11.7 KB
/
config.toml.advanced
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
#
# This is an example of config file for rsop, showing advanced usage.
#
# It makes use of many external programs you may need to install from your distribution packages or from source:
# - atril https://github.com/mate-desktop/atril
# - bat https://github.com/sharkdp/bat
# - bsdtar https://www.libarchive.org/
# - chafa https://hpjansson.org/chafa/
# - delta https://github.com/dandavison/delta
# - dpkg https://wiki.debian.org/Teams/Dpkg
# - ffmpegthumbnailer https://github.com/dirkvdb/ffmpegthumbnailer
# - ffprobe https://ffmpeg.org/
# - firefox https://firefox.com/
# - hexyl https://github.com/sharkdp/hexyl
# - imv https://github.com/eXeC64/imv
# - libreoffice https://www.libreoffice.org/
# - lsd https://github.com/Peltoche/lsd
# - mdcat https://github.com/lunaryorn/mdcat
# - mediainfo https://mediaarea.net/en/MediaInfo
# - moreutils https://joeyh.name/code/moreutils/
# - mpv https://mpv.io/
# - odt2txt https://github.com/dstosberg/odt2txt/
# - openscad https://openscad.org/
# - openssl https://www.openssl.org/
# - pandoc https://pandoc.org/
# - pbzip2 http://compression.ca/pbzip2/
# - pigz https://www.zlib.net/pigz/
# - pdftoppm https://poppler.freedesktop.org/
# - retext https://github.com/retext-project/retext
# - sqlite3 https://www.sqlite.org/index.html
# - ss https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
# - transmission-remote-gtk https://github.com/transmission-remote-gtk/transmission-remote-gtk
# - transmission-show https://transmissionbt.com/
# - tree http://mama.indstate.edu/users/ice/tree/
# - tshark https://www.wireshark.org/
# - tuxguitar http://www.tuxguitar.com.ar/
# - w3m https://salsa.debian.org/debian/w3m
# - wireshark https://www.wireshark.org/
# - xz https://tukaani.org/xz/
# - zstd https://facebook.github.io/zstd/
#
# You most likely want to edit this file to fit your needs.
#
#
# File types, identified by extension or MIME type
#
# - extensions
# List of extensions, always checked before MIME type. Double extensions (ie. 'tar.gz') are supported, although it usually
# makes more sense to use a filter instead.
#
# - mimes
# List of MIME types, a prefix (part before the '+', '.' or '/') can be used to match several subtypes.
# Compared to identification by extension this has the advantage of also working with data piped from stdin.
#
[filetype.archive]
mimes = [
"application/java-archive",
"application/vnd.rar",
"application/x-7z-compressed",
"application/x-archive",
"application/x-cpio",
"application/x-rar",
"application/x-rpm",
"application/x-tar",
"application/zip"
]
# bsdtar can decompress transparently
extensions = ["iso", "tar.bz2", "tar.gz", "tar.xz", "tar.zst"]
[filetype.audio]
mimes = ["audio", "video/ogg"]
extensions = ["m4a", "ogg"]
[filetype.binary]
mimes = ["application/octet-stream"]
[filetype.bzip2]
mimes = ["application/x-bzip2"]
[filetype.certificate]
mimes = ["application/pkix-cert"]
[filetype.deb]
extensions = ["deb"]
mimes = ["application/vnd.debian.binary-package"]
[filetype.directory]
mimes = ["inode/directory"]
[filetype.dot]
extensions = ["dot"]
mimes = ["text/vnd.graphviz"]
[filetype.drawio]
extensions = ["drawio"]
[filetype.epub]
mimes = ["application/epub"]
[filetype.gif]
extensions = ["gif"]
mimes = ["image/gif"]
[filetype.graph]
extensions = ["graph"]
[filetype.guitar_tab]
extensions = ["gp3", "gp4", "gp5", "ptb"]
[filetype.gzip]
mimes = ["application/gzip"]
[filetype.html]
extensions = ["htm", "html", "xhtml"]
mimes = ["text/html"]
[filetype.image]
mimes = ["image"]
[filetype.jpeg]
mimes = ["image/jpeg"]
[filetype.markdown]
extensions = ["md"]
[filetype.mobi]
extensions = ["mobi"]
[filetype.motion_jpeg]
extensions = ["mp.jpg"]
[filetype.msdocument]
extensions = ["doc", "docx", "pptx", "rtf", "xlsx"]
mimes = ["application/vnd.openxmlformats-officedocument", "text/rtf"]
[filetype.opendocument]
extensions = ["odg", "odp", "ods", "odt"]
mimes = ["application/vnd.oasis.opendocument"]
[filetype.patch]
mimes = ["text/x-patch"]
extensions = ["patch"]
[filetype.pcap]
mimes = ["application/vnd.tcpdump.pcap", "application/x-pcapng"]
[filetype.pdf]
mimes = ["application/pdf"]
[filetype.scad]
extensions = ["scad"]
[filetype.socket]
mimes = ["inode/socket"]
[filetype.sqlite]
mimes = ["application/vnd.sqlite3"]
[filetype.svg]
mimes = ["image/svg"]
extensions = ["svg"]
[filetype.text]
mimes = [
"text",
"application/mbox",
"application/pkcs8+pem",
"application/x-desktop",
"application/x-perl",
"application/x-php",
"application/x-shellscript",
"application/x-subrip",
"application/xml"
]
[filetype.torrent]
mimes = ["application/x-bittorrent"]
[filetype.video]
mimes = ["video", "application/vnd.ms-asf", "application/x-matroska", "application/x-riff"]
extensions = ["3gp", "avi", "mp4", "ogv"]
[filetype.xsv]
extensions = ["csv", "tsv"]
[filetype.xz]
mimes = ["application/x-xz"]
[filetype.zstandard]
mimes = ["application/zstd"]
#
# File handlers
#
# - command
# The command to run to open or preview file.
# Substitution is done for the following expressions:
# %c: terminal column count
# %i: input path
# %l: terminal line count
# %m: input MIME type
# Use '%%' if you need to pass a literal '%' char.
#
# - shell
# If true, runs the command in a shell, use this if you use pipes. Defaults to false.
#
# - wait
# If true, waits for the handler to exit. Defaults to true.
#
# - no_pipe
# If true, disable piping data to handler's stdin, and use a slower temporary file instead if data is piped to rsop.
# Incompatible with 'wait = false'. Defaults to false.
#
# - stdin_arg
# When previewing or opening data from stdin, with what string to substitute '%i'. Defaults to "-", some programs require "".
#
[default_handler_preview]
command = "echo '🔍 MIME: %m'; hexyl --border none %i | head -n $((%l - 1))"
shell = true
stdin_arg = ""
[default_handler_open]
command = "hexyl %i | less -R"
shell = true
stdin_arg = ""
[handler_preview.archive]
command = "echo '🔍 MIME: %m'; bsdtar -tf %i | grep -v '/$' | tree -C --noreport --fromfile . | tail -n +2 | sed 's@^....@@' | head -n $((%l - 3))"
shell = true
[handler_open.archive]
command = "bsdtar -tf %i | grep -v /$ | fzf -m --preview=\"bsdtar -xOf %i {} | rsp\" --print0 | xargs -0r bsdtar -xOf %i | ifne rso"
shell = true
no_pipe = true
[handler_preview.audio]
command = "mediainfo %i | sed 's@ \\+: @: @' | column -s ':' -t -l 2 | sed 's@ *$@@'"
shell = true
[handler_open.audio]
command = "mpv %i"
wait = false
[handler_preview.binary]
command = "hexyl --border none %i | head -n %l"
shell = true
stdin_arg = ""
[handler_preview.certificate]
command = "openssl x509 -in %i -text"
[handler_open.certificate]
command = "openssl x509 -in %i -text | less -R"
shell = true
[handler_preview.deb]
command = "dpkg -c %i | head -n %l"
shell = true
[handler_preview.directory]
command = "lsd -alFh --tree --color=always --icon=always %i | head -n %l"
shell = true
[handler_open.directory]
command = "lsd -alFh --tree --color=always --icon=always %i | less -R"
shell = true
[handler_preview.dot]
command = "dot -Tdot %i | graph-easy --as=boxart 2> /dev/null"
shell = true
stdin_arg = ""
[handler_open.dot]
command = "dot -Tsvg %i | rso"
shell = true
stdin_arg = ""
[handler_edit.drawio]
command = "drawio %i"
no_pipe = true
[handler_open.epub]
command = "atril %i"
no_pipe = true
[handler_open.gif]
command = "mpv --loop %i"
wait = false
[handler_preview.graph]
command = "graph-easy --as=boxart %i"
stdin_arg = ""
[handler_open.graph]
command = "graph-easy --as=dot %i | dot -Tsvg | rso"
stdin_arg = ""
shell = true
[handler_open.guitar_tab]
command = "tuxguitar %i"
no_pipe = true
[handler_preview.html]
command = "w3m -dump %i"
no_pipe = true
[handler_open.html]
command = "firefox %i"
no_pipe = true
[handler_preview.image]
command = "chafa -s %cx%l %i"
[handler_open.image]
command = "imv %i"
wait = false
[handler_edit.image]
command = "gimp %i"
no_pipe = true
[handler_preview.jpeg]
command = "exiftran -a -o /dev/stdout %i | chafa -s %cx%l"
shell = true
stdin_arg = "/dev/stdin"
[handler_preview.markdown]
command = "mdcat %i"
[handler_edit.markdown]
command = "retext %i"
wait = false
[handler_open.mobi]
command = "FBReader %i"
no_pipe = true
[handler_preview.msdocument]
command = "pandoc -s -t markdown -- %i | mdcat"
shell = true
[handler_edit.msdocument]
command = "libreoffice %i"
no_pipe = true
[handler_preview.opendocument]
command = "odt2txt %i"
no_pipe = true
[handler_edit.opendocument]
command = "libreoffice %i"
no_pipe = true
[handler_preview.patch]
command = "cat %i | delta"
shell = true
[handler_preview.pcap]
command = "tshark -t a -r %i | head -n %l"
shell = true
[handler_open.pcap]
command = "wireshark %i"
no_pipe = true
[handler_preview.pdf]
command = "t=$(mktemp); pdftoppm -f 1 -l 1 -scale-to-x 800 -scale-to-y -1 -singlefile -jpeg -jpegopt quality=60 -tiffcompression jpeg -- %i \"${t}\" && chafa -s %cx%l \"${t}.jpg\"; rm \"${t}.jpg\""
shell = true
[handler_open.pdf]
command = "atril %i"
no_pipe = true
[handler_preview.scad]
command = "openscad -q --render --colorscheme=Solarized --imgsize=800,600 --export-format png -o - %i | chafa -s %cx%l -"
shell = true
no_pipe = true
[handler_edit.scad]
command = "openscad %i"
no_pipe = true
[handler_preview.socket]
command = "ss -alxp src unix:'%i'"
[handler_preview.sqlite]
command = "sqlite3 %i .dump | bat -P --color=always -n --terminal-width %c -r :%l -l sql"
shell = true
no_pipe = true
[handler_open.sqlite]
command = "sqlite3 %i .dump | bat --paging always --color=always -n --terminal-width %c -l sql"
shell = true
no_pipe = true
[handler_preview.svg]
command = "chafa -s %cx%l %i"
[handler_open.svg]
command = "firefox %i"
no_pipe = true
[handler_preview.text]
command = "bat -P --color=always -n --terminal-width %c -r :%l %i"
[handler_open.text]
command = "bat --paging always --color=always -n --terminal-width %c %i"
[handler_preview.torrent]
command = "transmission-show -- %i"
no_pipe = true
[handler_open.torrent]
command = "transmission-remote-gtk -- %i"
no_pipe = true
[handler_preview.video]
command = "s=$(ffprobe -hide_banner %i 2>&1 | grep -E '^ (Stream|Duration)' | sed 's@^ Stream [^ ]*:@@' | sed 's@ *@@'); l=$(echo \"$s\" | wc -l); ffmpegthumbnailer -s 800 -c jpg -q 6 -i %i -o - 2> /dev/null | chafa -s %cx$((%l - l)) -; echo \"$s\""
shell = true
no_pipe = true
[handler_open.video]
command = "mpv --loop %i"
no_pipe = true
[handler_preview.xsv]
command = "bat -P --color=always -n --terminal-width %c -r :%l -l csv %i"
[handler_open.xsv]
command = "libreoffice %i"
no_pipe = true
#
# Filters
#
# Filters are special handlers that process their input and send their output either to another filter or to a final handler.
# They are typically useful to transparently decompress files like .log.xz, .pcapng.gz, tar.gz, etc.
# but you can also use it for more specific needs like converting some document formats to markdown and then using your usual handler
# for markdown files to preview or open it.
# Filter configuration parameters are similar to handler, except wait that is implied as true.
#
[filter.bzip2]
command = "pbzip2 -dc %i"
[filter.gzip]
command = "pigz -dc %i"
[filter.motion_jpeg]
# https://linuxreviews.org/Google_Pixel_%22Motion_Photo%22
command = "tail -c +$(( $(grep -EUboa '(ftypisom|ftypmp42)' %i | cut -d ':' -f 1) - 3)) %i 2> /dev/null || cat %i"
shell = true
no_pipe = true
[filter.xz]
command = "xz -dc %i"
[filter.zstandard]
command = "zstd -dc %i"
#
# Scheme handlers
#
# Handlers for use in 'xdg-open' mode, with URLs instead of paths. URLs prefixed with 'file://' are handled by file handlers.
# Configuration is similar to file handlers, but only 'command' and 'shell' parameters are supported.
#
[handler_scheme.http]
command = "firefox %i"
[handler_scheme.https]
command = "firefox %i"