diff --git a/clipimg.sh b/clipimg.sh index 94864b8..f0f47bc 100755 --- a/clipimg.sh +++ b/clipimg.sh @@ -12,10 +12,15 @@ ############################################################################## EmojiPath="/home/steven/images2/emojis/" ReactionPath="/home/steven/images2/static_reaction/" +IconPath="/home/steven/.icons/" +ClipartPath="/home/steven/documents/resources/" FD_FIND=$(which fdfind) TempSearchPath="" Emoji="true" Reaction="true" +Icon="false" +Clipart="false" +CliOnly="true" Choices="" ############################################################################## @@ -25,7 +30,9 @@ display_help(){ echo "###################################################################" echo "# copyimage.sh [-h|-c]" echo "# -h show help " - echo "# -c cli/tui interface only. Default is GUI. " + echo "# -g GUI interface only. Default is CLI/TUI. " + echo "# -a select clipart only. Not selected by default. " + echo "# -a select icon only. Not selected by default. " echo "# -e select emoji only. Default is both. " echo "# -r select reaction only. Default is both. " echo "###################################################################" @@ -53,12 +60,24 @@ build_search_items() { case $option in -h) display_help exit - shift ;; - -r) Emoji="false" #this is actually a negative selector + shift ;; + #this is actually a negative selector + -r) Emoji="false" shift ;; -e) Reaction="false" shift ;; - -c) CliOnly="true" + # these are positive selectors, since they're not default + -a) Clipart="true" + Emoji="false" + Reaction="false" + Icon="false" + shift ;; + -i) Clipart="false" + Emoji="false" + Reaction="false" + Icon="true" + shift ;; + -g) CliOnly="false" shift ;; esac done @@ -66,6 +85,7 @@ build_search_items() { # Creating the search items by just adding more. You can see how more # switches and directories can be added here. + # This could maybe be fancier, but it would be more complicated if [ "$Emoji" == "true" ];then TempSearchPath="$EmojiPath" build_search_items @@ -74,8 +94,21 @@ build_search_items() { TempSearchPath="$ReactionPath" build_search_items fi - - SortTemp=$(echo -e "$Choices" | sort -t '/' -k 6) + if [ "$Clipart" == "true" ];then + TempSearchPath="$ClipartPath" + build_search_items + fi + if [ "$Icon" == "true" ];then + TempSearchPath="$IconPath" + build_search_items + fi + + if [ "$Reaction" == "true" ] || [ "$Emjoi" == "true" ] || [ "$Clipart" == "true" ];then + SortTemp=$(echo -e "$Choices" | sort -t '/' -k 6) + elif [ "$Icon" == "true" ];then + SortTemp=$(echo -e "$Choices" | sort -t '/' -k 5) + fi + Choices="$SortTemp" @@ -97,6 +130,7 @@ build_search_items() { SelectedImage=$(echo -e "$Choices" | rofi -i -dmenu -p "Which Reaction?" -theme DarkBlue | realpath -p) fi + ############################################################################## # Slap that sucker on the clipboard and select it ############################################################################## @@ -109,4 +143,10 @@ if [ -f "$SelectedImage" ];then #if you use copyq you need these lines to have it offer up the selection /usr/bin/copyq write 0 "$mime" - < "$SelectedImage" /usr/bin/copyq select 0 -fi \ No newline at end of file +fi + +# putting the filename in the second position +if [ "$Icon" == "true" ] || [ "$Clipart" == "true" ];then + /usr/bin/copyq insert 1 "$SelectedImage" + /usr/bin/copyq select 0 +fi