3 # This is the configuration file of "rifle", ranger's file executor/opener.
4 # Each line consists of conditions and a command. For each line the conditions
5 # are checked and if they are met, the respective command is run.
8 # <condition1> , <condition2> , ... = command
10 # The command can contain these environment variables:
11 # $1-$9 | The n-th selected file
12 # $@ | All selected files
14 # If you use the special command "ask", rifle will ask you what program to run.
16 # Prefixing a condition with "!" will negate its result.
17 # These conditions are currently supported:
18 # match <regexp> | The regexp matches $1
19 # ext <regexp> | The regexp matches the extension of $1
20 # mime <regexp> | The regexp matches the mime type of $1
21 # name <regexp> | The regexp matches the basename of $1
22 # path <regexp> | The regexp matches the absolute path of $1
23 # has <program> | The program is installed (i.e. located in $PATH)
25 # directory | $1 is a directory
26 # number <n> | change the number of this command to n
27 # terminal | stdin, stderr and stdout are connected to a terminal
28 # X | $DISPLAY is not empty (i.e. Xorg runs)
30 # There are also pseudo-conditions which have a "side effect":
31 # flag <flags> | Change how the program is run. See below.
32 # label <label> | Assign a label or name to the command so it can
33 # | be started with :open_with <label> in ranger
34 # | or `rifle -p <label>` in the standalone executable.
37 # Flags are single characters which slightly transform the command:
38 # f | Fork the program, make it run in the background.
39 # | New command = setsid $command >& /dev/null &
40 # r | Execute the command with root permissions
41 # | New command = sudo $command
42 # t | Run the program in a new terminal. If $TERMCMD is not defined,
43 # | rifle will attempt to extract it from $TERM.
44 # | New command = $TERMCMD -e $command
45 # Note: The "New command" serves only as an illustration, the exact
46 # implementation may differ.
47 # Note: When using rifle in ranger, there is an additional flag "c" for
48 # only running the current file even if you have marked multiple files.
50 #-------------------------------------------
52 #-------------------------------------------
53 # Rarely installed browsers get higher priority; It is assumed that if you
54 # install a rare browser, you probably use it. Firefox/konqueror/w3m on the
55 # other hand are often only installed as fallback browsers.
56 ext x?html?, has dwb, X, flag f = dwb -- "$@"
57 ext x?html?, has luakit, X, flag f = luakit -- "$@"
58 ext x?html?, has chromium, X, flag f = chromium -- "$@"
59 ext x?html?, has elinks, terminal = elinks "$@"
60 ext x?html?, has lynx, terminal = lynx -- "$@"
61 ext x?html?, has w3m, terminal = w3m "$@"
63 #-------------------------------------------
65 #-------------------------------------------
66 # Define the "editor" for text files as first action
67 mime ^text, label editor = "$EDITOR" -- "$@"
68 mime ^text, label pager = "$PAGER" -- "$@"
69 !mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@"
70 !mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@"
73 ext s[wmf]c, has zsnes, X = zsnes "$1"
74 ext nes, has fceux, X = fceux "$1"
76 name ^[mM]akefile$ = make
78 #--------------------------------------------
80 #-------------------------------------------
81 ext py = python -- "$1"
87 #--------------------------------------------
89 #-------------------------------------------
90 mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
91 mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
92 ext midi?, terminal, has wildmidi = wildmidi -- "$@"
94 #--------------------------------------------
95 # Video/Audio with a GUI
96 #-------------------------------------------
97 mime ^video|audio, has umpv, X, flag f = umpv -- "$@"
98 mime ^video|audio, has mpv, X, flag f = mpv -- "$@"
99 mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
100 mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
101 mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
102 mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
103 mime ^video, has mplayer, X, flag f = mplayer -- "$@"
104 mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
105 mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
106 mime ^video|audio, has totem, X, flag f = totem -- "$@"
107 mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
109 #--------------------------------------------
111 #-------------------------------------------
112 mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
113 mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
115 #-------------------------------------------
117 #-------------------------------------------
118 ext svg, has inkscape, X, flag f = inkscape -- "$@"
119 mime ^image, has eog, X, flag f = eog -- "$@"
120 mime ^image, has sxiv, X, flag f = sxiv -- "$@"
121 mime ^image, has feh, X, flag f = feh -- "$@"
122 mime ^image, has mirage, X, flag f = mirage -- "$@"
123 mime ^image, has gimp, X, flag f = gimp -- "$@"
124 ext xcf, has gimp, X, flag f = gimp -- "$@"
126 #-------------------------------------------
128 #-------------------------------------------
129 ext pdf, has llpp, X, flag f = llpp "$@"
130 ext pdf, has zathura, X, flag f = zathura -- "$@"
131 ext pdf, has mupdf, X, flag f = mupdf -- "$@"
132 ext pdf, has apvlv, X, flag f = apvlv -- "$@"
133 ext pdf, has xpdf, X, flag f = xpdf -- "$@"
134 ext pdf, has evince, X, flag f = evince -- "$@"
135 ext pdf, has okular, X, flag f = okular -- "$@"
136 ext pdf, has epdfview, X, flag f = epdfview -- "$@"
138 ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
140 ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
141 ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
142 ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
143 ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
144 ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
146 ext djvu, has evince, X, flag f = evince -- "$@"
148 #-------------------------------------------
150 #-------------------------------------------
151 # This requires atool
152 ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER"
153 ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER"
154 ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
155 ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
158 ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
159 ext tar|gz, has tar = tar vvxf "$@"
161 #-------------------------------------------
163 #-------------------------------------------
164 label wallpaper, number 11, mime ^image, X = feh --bg-scale "$1"
165 label wallpaper, number 12, mime ^image, X = feh --bg-tile "$1"
166 label wallpaper, number 13, mime ^image, X = feh --bg-center "$1"
167 label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1"
169 # Define the editor for non-text files + pager as last action
170 !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask
171 label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@"
172 label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@"