copy-scheme 608 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # script to be used when browsing xcolors_visual with ranger
  3. # script saves the .png and its associated color scheme to $SAVE_DIR
  4. #
  5. # bind this script to a key sequence in ~/.config/ranger/rc.conf, like this:
  6. #
  7. # map ss shell ../scripts/copyscheme %f
  8. SAVE_DIR="../saved"
  9. [[ $1 = "" ]] && exit
  10. # get the scheme name from the .png
  11. scheme="../xcolor_code/$(basename "$1" .png)"
  12. if [[ ! -f "$scheme" ]]; then
  13. echo "$scheme does not exist"
  14. else
  15. [[ ! -d $SAVE_DIR ]] && mkdir $SAVE_DIR
  16. cp "$scheme" $SAVE_DIR # save the scheme file
  17. cp "$1" $SAVE_DIR # save the .png file
  18. fi