diff options
Diffstat (limited to 'scriptlets/findlast.sh')
-rwxr-xr-x | scriptlets/findlast.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scriptlets/findlast.sh b/scriptlets/findlast.sh new file mode 100755 index 0000000..32d5c92 --- /dev/null +++ b/scriptlets/findlast.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# THUNAR CUSTOM ACTION + +# Name: Set Art lookup directory +# Description: Set the current directory as the one findlast.sh will check + +# Command: $HOME/stuf/scripts/scriptlets/findlast.sh --set-artdir +# Keyboard Shortcut: Shift+F2 +# Icon: shupogaki.png + +# Appearance Conditions -> Check "Directories **" + +if [[ "$1" = "--set-artdir" ]]; then + echo $(pwd) > $HOME/stuf/artdir.txt + $HOME/stuf/scripts/notification_wrapper.sh "Set $(pwd) as the new artdir." "FINDLAST" +else + ARTDIR="$( head -n1 "$HOME/stuf/artdir.txt" )" + SELECTION="$( xclip -o -sel primary | sed -r "s|\.[a-zA-Z]+||g" )" + [[ -z $SELECTION ]] && exit -1 + + $HOME/stuf/scripts/notification_wrapper.sh "$( find "$ARTDIR" -type f -iregex ".*/${SELECTION}[0-9]+[a-zA-Z]*\.[a-zA-Z]+" | sort -V | tail -n1 )" "FINDLAST" +fi |