summary refs log tree commit diff stats
path: root/examples/plugin_hello_world.py
Commit message (Expand)AuthorAgeFilesLines
* Add two blank lines where is expectedstepshal2016-06-161-0/+2
* Should I dual ranger/cleric or wait for the THAC0 bonus? v1.7.0hut2015-04-141-1/+1
* moved "doc/examples" to "examples" for more visibilityhut2015-04-131-0/+23
* move examples to doc/exampleshut2013-03-091-23/+0
* Added version info to exampleshut2013-03-011-0/+2
* use 4-space-indents in files that had 2-space-indentshut2013-02-221-5/+5
* added examples/plugin_hello_world.pyhut2012-12-041-0/+21
ut@lavabit.com> 2012-08-06 06:39:26 +0200 added the examples from the man page to the examples directory' href='/akspecs/ranger/commit/examples/rifle_sxiv.sh?h=v1.9.3&id=796074b541aaca459c594fe517c11d275778eef6'>796074b5 ^
dcbc83fe ^
796074b5 ^
dcbc83fe ^
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








                                                                                 
                                                                  




                            
                                                                
                                                     




                                                              
                                            
    
                           
  
#!/bin/bash
#
# This script searches image files in a directory, opens them all with sxiv
# and sets the first argument to the first image displayed by sxiv.
#
# This is supposed to be used in rifle.conf as a workaround for the fact that
# sxiv takes no file name arguments for the first image, just the number.
# Copy this file somewhere into your $PATH and add this at the top of rifle.conf:
#
#   mime ^image, has sxiv, X, flag f = path/to/this/script -- "$@"
#

[ "$1" == '--' ] && shift
target="$(realpath -s "$1")"
function listfiles {
    find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
      '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
}

count="$(listfiles | grep -m 1 -Zznx "$target" | cut -d: -f1)"

if [ -n "$count" ]; then
    listfiles | xargs -0 sxiv -n "$count" --
else
    sxiv -- "$@" # fallback
fi