Advertisement
constantin-net

sxiv-multi

Aug 27th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -eq 0 ]; then
  4.     echo "Usage: ${0##*/} PICTURES"
  5.     exit
  6. fi
  7.  
  8. [ "$1" = '--' ] && shift
  9.  
  10. abspath () {
  11.     case "$1" in
  12.         /*) printf "%s\n" "$1";;
  13.         *)  printf "%s\n" "$PWD/$1";;
  14.     esac
  15. }
  16.  
  17. listfiles () {
  18.     find -L "$(dirname "$target")" -maxdepth 1 -type f -print0 | sort -z
  19. }
  20.  
  21. target="$(abspath "$1")"
  22. count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
  23.  
  24. if [ -n "$count" ]; then
  25.     sxiv -t -A 12 -q -p "$PWD" -n "$count" -o -- > /tmp/sxiv-marked
  26.     python3 ~/.bin/add_item_gtk3.py
  27. else
  28.     sxiv -- "$@" # fallback
  29.  
  30. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement