dotfiles

My dotfiles used for LARBS
Log | Files | Refs | README | LICENSE

rifle.conf (11492B)


      1 # vim: ft=cfg
      2 #
      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.
      6 #
      7 # Syntax:
      8 #   <condition1> , <condition2> , ... = command
      9 #
     10 # The command can contain these environment variables:
     11 #   $1-$9 | The n-th selected file
     12 #   $@    | All selected files
     13 #
     14 # If you use the special command "ask", rifle will ask you what program to run.
     15 #
     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)
     24 #   env <variable> | The environment variable "variable" is non-empty
     25 #   file           | $1 is a file
     26 #   directory      | $1 is a directory
     27 #   number <n>     | change the number of this command to n
     28 #   terminal       | stdin, stderr and stdout are connected to a terminal
     29 #   X              | $DISPLAY is not empty (i.e. Xorg runs)
     30 #
     31 # There are also pseudo-conditions which have a "side effect":
     32 #   flag <flags>  | Change how the program is run. See below.
     33 #   label <label> | Assign a label or name to the command so it can
     34 #                 | be started with :open_with <label> in ranger
     35 #                 | or `rifle -p <label>` in the standalone executable.
     36 #   else          | Always true.
     37 #
     38 # Flags are single characters which slightly transform the command:
     39 #   f | Fork the program, make it run in the background.
     40 #     |   New command = setsid $command >& /dev/null &
     41 #   r | Execute the command with root permissions
     42 #     |   New command = sudo $command
     43 #   t | Run the program in a new terminal.  If $TERMCMD is not defined,
     44 #     | rifle will attempt to extract it from $TERM.
     45 #     |   New command = $TERMCMD -e $command
     46 # Note: The "New command" serves only as an illustration, the exact
     47 # implementation may differ.
     48 # Note: When using rifle in ranger, there is an additional flag "c" for
     49 # only running the current file even if you have marked multiple files.
     50 
     51 #-------------------------------------------
     52 # Websites
     53 #-------------------------------------------
     54 # Rarely installed browsers get higher priority; It is assumed that if you
     55 # install a rare browser, you probably use it.  Firefox/konqueror/w3m on the
     56 # other hand are often only installed as fallback browsers.
     57 
     58 ext x?html?, has waterfox,       X, flag f = waterfox -- "$@"
     59 ext x?html?, has surf,           X, flag f = surf -- file://"$1"
     60 ext x?html?, has vimprobable,    X, flag f = vimprobable -- "$@"
     61 ext x?html?, has vimprobable2,   X, flag f = vimprobable2 -- "$@"
     62 ext x?html?, has qutebrowser,	 X, flag f = qutebrowser -- "$@"
     63 ext x?html?, has dwb,            X, flag f = dwb -- "$@"
     64 ext x?html?, has jumanji,        X, flag f = jumanji -- "$@"
     65 ext x?html?, has luakit,         X, flag f = luakit -- "$@"
     66 ext x?html?, has uzbl,           X, flag f = uzbl -- "$@"
     67 ext x?html?, has uzbl-tabbed,    X, flag f = uzbl-tabbed -- "$@"
     68 ext x?html?, has uzbl-browser,   X, flag f = uzbl-browser -- "$@"
     69 ext x?html?, has uzbl-core,      X, flag f = uzbl-core -- "$@"
     70 ext x?html?, has midori,         X, flag f = midori -- "$@"
     71 ext x?html?, has chromium,       X, flag f = chromium -- "$@"
     72 ext x?html?, has opera,          X, flag f = opera -- "$@"
     73 ext x?html?, has firefox,        X, flag f = firefox -- "$@"
     74 ext x?html?, has dillo,          X, flag f = dillo -- "$@"
     75 ext x?html?, has seamonkey,      X, flag f = seamonkey -- "$@"
     76 ext x?html?, has iceweasel,      X, flag f = iceweasel -- "$@"
     77 ext x?html?, has epiphany,       X, flag f = epiphany -- "$@"
     78 ext x?html?, has konqueror,      X, flag f = konqueror -- "$@"
     79 ext x?html?, has elinks,          terminal = elinks "$@"
     80 ext x?html?, has links2,          terminal = links2 "$@"
     81 ext x?html?, has links,           terminal = links "$@"
     82 ext x?html?, has lynx,            terminal = lynx -- "$@"
     83 ext x?html?, has w3m,             terminal = w3m "$@"
     84 
     85 
     86 #Spreadsheets for scim
     87 ext sc|csv|sxc|xlsx?|xlt|xlw|gnm|gnumeric, = sc-im -- "$@"
     88 
     89 #-------------------------------------------
     90 # Misc
     91 #-------------------------------------------
     92 # Define the "editor" for text files as first action
     93 mime ^text,  label editor = $EDITOR -- "$@"
     94 mime ^text,  label pager  = "$PAGER" -- "$@"
     95 !mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
     96 !mime ^text, label pager,  ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
     97 
     98 ext 1                         = man "$1"
     99 ext s[wmf]c, has zsnes, X     = zsnes "$1"
    100 ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
    101 ext nes, has fceux, X         = fceux "$1"
    102 ext exe                       = wine "$1"
    103 name ^[mM]akefile$            = make
    104 ext asf, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
    105 
    106 #--------------------------------------------
    107 # Code
    108 #-------------------------------------------
    109 ext py  = python -- "$1"
    110 ext pl  = perl -- "$1"
    111 ext rb  = ruby -- "$1"
    112 ext js  = node -- "$1"
    113 ext sh  = sh -- "$1"
    114 ext php = php -- "$1"
    115 
    116 #--------------------------------------------
    117 # Video/Audio with a GUI
    118 #-------------------------------------------
    119 mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
    120 mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
    121 mime ^video,       has mpv,      X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
    122 mime ^video,       has mpv,      X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-video -- "$@"
    123 mime ^video,       has mpv,      X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@"
    124 mime ^video,       has mpv,      X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --loop -- "$@"
    125 mime ^video,       has mpv,      X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@"
    126 mime ^video,       has mplayer2, X, flag f = mplayer2 -- "$@"
    127 mime ^video,       has mplayer2, X, flag f = mplayer2 -fs -- "$@"
    128 mime ^video,       has mplayer,  X, flag f = mplayer -- "$@"
    129 mime ^video,       has mplayer,  X, flag f = mplayer -fs -- "$@"
    130 #	mime ^video|audio, has vlc,      X, flag f = vlc -- "$@"
    131 mime ^video|audio, has totem,    X, flag f = totem -- "$@"
    132 mime ^video|audio, has totem,    X, flag f = totem --fullscreen -- "$@"
    133 #--------------------------------------------
    134 # Audio without X
    135 #-------------------------------------------
    136 mime ^audio|ogg$, terminal, has mplayer  = mplayer -- "$@"
    137 mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
    138 mime ^audio|ogg$, terminal, has mpv      = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@"
    139 mime ^audio|ogg$   = tag "$@"
    140 mime ^audio|ogg$, terminal, has mpv      = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
    141 ext midi?,        terminal, has wildmidi = wildmidi -- "$@"
    142 
    143 
    144 #--------------------------------------------
    145 # Video without X:
    146 #-------------------------------------------
    147 mime ^video, terminal, !X, has mpv       = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
    148 mime ^video, terminal, !X, has mplayer2  = mplayer2 -- "$@"
    149 mime ^video, terminal, !X, has mplayer   = mplayer -- "$@"
    150 
    151 #-------------------------------------------
    152 # Documents
    153 #-------------------------------------------
    154 ext pdf, has llpp,     X, flag f = llpp "$@"
    155 ext pdf, has zathura,  X, flag f = zathura -- "$@"
    156 ext pdf, has mupdf,    X, flag f = mupdf "$@"
    157 ext pdf, has mupdf,    X, flag f = mupdf -I "$@"
    158 ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
    159 ext pdf, has apvlv,    X, flag f = apvlv -- "$@"
    160 ext pdf, has xpdf,     X, flag f = xpdf -- "$@"
    161 ext pdf, has evince,   X, flag f = evince -- "$@"
    162 ext pdf, has atril,    X, flag f = atril -- "$@"
    163 ext pdf, has okular,   X, flag f = okular -- "$@"
    164 ext pdf, has epdfview, X, flag f = epdfview -- "$@"
    165 ext pdf, has qpdfview, X, flag f = qpdfview "$@"
    166 
    167 ext epub, has zathura,  X, flag f = zathura -- "$@"
    168 ext epub, has mupdf, X, flag f = mupdf "$@"
    169 
    170 ext ps, has zathura,  X, flag f = zathura -- "$@"
    171 
    172 ext docx, has abiword, X, flag f = abiword "$@"
    173 
    174 ext docx?, has catdoc,       terminal = catdoc -- "$@" | "$PAGER"
    175 
    176 ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric,    X, flag f = gnumeric -- "$@"
    177 ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread,     X, flag f = kspread -- "$@"
    178 ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
    179 ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice,     X, flag f = soffice "$@"
    180 ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice,     X, flag f = ooffice "$@"
    181 
    182 ext djvu, has zathura,X, flag f = zathura -- "$@"
    183 ext djvu, has evince, X, flag f = evince -- "$@"
    184 ext djvu, has atril,  X, flag f = atril -- "$@"
    185 
    186 #-------------------------------------------
    187 # Image Viewing:
    188 #-------------------------------------------
    189 mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
    190 mime ^image/svg, has display,  X, flag f = display -- "$@"
    191 mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@"
    192 mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@"
    193 
    194 ext xcf,                    X, flag f = gimp -- "$@"
    195 mime ^image, has sxiv,      X, flag f = sxiv -a -- "$@"
    196 mime ^image, has feh,       X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@"
    197 mime ^image, has feh,       X, flag f = feh --scale-down --auto-zoom -- "$@"
    198 mime ^image, has mirage,    X, flag f = mirage -- "$@"
    199 mime ^image, has ristretto, X, flag f = ristretto "$@"
    200 mime ^image, has eog,       X, flag f = eog -- "$@"
    201 mime ^image, has eom,       X, flag f = eom -- "$@"
    202 mime ^image, has gimp,      X, flag f = gimp -- "$@"
    203 mime ^image, has pinta,	    X, flag f = pinta -- "$@"
    204 mime ^image, has mypaint,	    X, flag f = mypaint -- "$@"
    205 mime ^image, has kolourpaint,	    X, flag f = kolourpaint -- "$@"
    206 
    207 #-------------------------------------------
    208 # Archives
    209 #-------------------------------------------
    210 # This requires atool
    211 ext jar = java -jar "$@"
    212 
    213 ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz,  has als     = als -- "$@" | "$PAGER"
    214 ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als     = als -- "$@" | "$PAGER"
    215 ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz,  has aunpack = aunpack -- "$@"
    216 ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
    217 
    218 # Fallback:
    219 ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
    220 ext tar|gz, has tar = tar vvxf "$@"
    221 
    222 #-------------------------------------------
    223 # Misc
    224 #-------------------------------------------
    225 label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
    226 label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
    227 label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
    228 label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
    229 
    230 # Define the editor for non-text files + pager as last action
    231               !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms  = ask
    232 label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms  = $EDITOR -- "$@"
    233 label pager,  !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms  = "$PAGER" -- "$@"
    234 
    235 ext blend, has blender, X, flag f =  blender -- "$@"
    236 ext ms = $EDITOR -- "$@"