From 869b4b0c857b72f7244ec6507a15dec853fa21ca Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:12:48 +0700 Subject: [PATCH 1/6] Fix bug screenshot filename '.pending' --- awesomeshot | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/awesomeshot b/awesomeshot index 0e3ceeb..48330df 100755 --- a/awesomeshot +++ b/awesomeshot @@ -5,7 +5,7 @@ # # Copyright (c) 2021 - 2022 xShin -version=1.0.2 +version=1.0.5 XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-${HOME}/.config} config_file="${XDG_CONFIG_HOME}/awesomeshot/awesomeshot.conf" @@ -233,12 +233,18 @@ function autoRun() { get_file_name=$(echo -e "${get_file_name_result}" | awk '{print $3}') if [[ "${screenshot_result_path}/${get_file_name}" != "${file_name}" || -z ${file_name} ]]; then subtitle "[+]*Execute*Program*" - file_name="${screenshot_result_path}/${get_file_name}" + + # Fix bug screenshot filename ".pending" + if [ ${get_file_name%%-*} == ".pending" ]; then + file_name="${screenshot_result_path}/${get_file_name##*-}" + else + file_name="${screenshot_result_path}/${get_file_name}" + fi echo -e "" if [ "${convert_to_png}" == "yes" ]; then - convertToPng "${get_file_name}" + convertToPng fi if [ "${backup}" == "yes" ]; then From 91bc2239964c3bf7bed03dd1d594a9a7391a1901 Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:13:02 +0700 Subject: [PATCH 2/6] change version --- awesomeshot.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awesomeshot.1 b/awesomeshot.1 index 0082304..2559b09 100644 --- a/awesomeshot.1 +++ b/awesomeshot.1 @@ -1,4 +1,4 @@ -.TH AWESOMESHOT 1 "Mar 2022" "Awesomeshot 1.0.2" "User Commands" +.TH AWESOMESHOT 1 "18 April 2022" "Awesomeshot 1.0.5" "User Commands" .SH NAME Awesomeshot .SH SYNOPSIS From f8b3c1bbdeab0924960eb923fbca6920d226192c Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:22:57 +0700 Subject: [PATCH 3/6] move titlebar color to config and change default screenshot_result_path --- awesomeshot | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/awesomeshot b/awesomeshot index 48330df..5b7bba7 100755 --- a/awesomeshot +++ b/awesomeshot @@ -24,9 +24,9 @@ COLOR_SKY="\e[34m" read -rd '' config <<'EOF' # Make sure when your phone screenshot the result file image # PATH is same with this variable. Default my phone result file -# image PATH on "/sdcard/Pictures/Screenshots". If not same, +# image PATH on "/sdcard/DCIM/Screenshots". If not same, # you can edit this variable value -screenshot_result_path="/sdcard/Pictures/Screenshots" +screenshot_result_path="/sdcard/DCIM/Screenshots" # This variable serves to function to backup original photo # (screenshot result), change this value to blank or whatever for disable @@ -66,6 +66,10 @@ add_on_img="" width_img=500 height_img=1000 +# This variable serves to set titlebar color, if you want to custom the color, you can +# change this value with hex color or use the one in the array list. +titlebar_color="${hex_color[0]}" + # This variable serves to convert rounded corner, change this value # to blank or whatever for disable convert and "yes" for enable function convert_rounded="yes" @@ -175,7 +179,7 @@ function getUserConfig() { function generateDefaultConfig() { if [ ! -f "${config_file}" ]; then if [ ! -d "~/.config/awesomeshot" ]; then - mkdir ~/.config/awesomeshot + mkdir ~/.config/awesomeshot 2> /dev/null fi printf '%s\n' "$config" > "$config_file" stat "SUCCESS" "Success" "Default config has been generated" @@ -403,7 +407,7 @@ function convertTitleBar(){ #760x360 if [[ "${add_on_img}" == "yes" ]]; then magick $file_name -fill $b \ - -background $b \ + -background ${titlebar_color} \ -gravity north \ -chop 0x$br \ -splice 0x$br \ @@ -413,7 +417,7 @@ function convertTitleBar(){ $file_name else magick $file_name -fill $b \ - -background $b \ + -background ${titlebar_color} \ -gravity north -splice 0x$br\ -draw "fill ${r} circle ${arr[0,0]},${arr[0,1]} ${arr[0,2]},${arr[0,3]} fill ${y} circle ${arr[1,0]},${arr[1,1]} ${arr[1,2]},${arr[1,3]} From da130584cfd0fbd15a02a4a62efdde0d39426592 Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:23:49 +0700 Subject: [PATCH 4/6] move position value config convert_to_png to top --- awesomeshot | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/awesomeshot b/awesomeshot index 5b7bba7..f6a7864 100755 --- a/awesomeshot +++ b/awesomeshot @@ -28,6 +28,11 @@ read -rd '' config <<'EOF' # you can edit this variable value screenshot_result_path="/sdcard/DCIM/Screenshots" +# This variable serves to set the convert image with file type non PNG, change this value +# to blank or whatever for disable function and "yes" for enable function. +# Convert to PNG if file not PNG +convert_to_png="yes" + # This variable serves to function to backup original photo # (screenshot result), change this value to blank or whatever for disable # function and "yes" for enable function @@ -147,11 +152,6 @@ footer_foreground="${hex_color[1]}" # change this value with hex color or use the one in the array list. footer_background="none" -# This variable serves to set the convert image with file type non PNG, change this value -# to blank or whatever for disable function and "yes" for enable function. -# Convert to PNG if file not PNG -convert_to_png="yes" - # This variable serves to open the result of image (when editing finished), change this value # to blank or whatever for disable function and "yes" for enable function. open_image="" From 2958855c23ae2dd2a05da73ddb3190f88e986dc2 Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:41:51 +0700 Subject: [PATCH 5/6] change default backup path to /sdcard/DCIM/awesomeshot --- awesomeshot | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/awesomeshot b/awesomeshot index f6a7864..fd45ad8 100755 --- a/awesomeshot +++ b/awesomeshot @@ -39,7 +39,7 @@ convert_to_png="yes" backup="yes" # This variable serves to set the original photo backup PATH -path_backup="${HOME}/.config/awesomeshot/backup" +path_backup="/sdcard/DCIM/awesomeshot" # Array Hex Color hex_color=( @@ -252,7 +252,7 @@ function autoRun() { fi if [ "${backup}" == "yes" ]; then - title "${COLOR_SKY}[+] BACKUP${COLOR_DEFAULT}" + title "${COLOR_SKY}[+] BACKUP IMAGE${COLOR_DEFAULT}" backupOriginalPhoto "${get_file_name}" fi @@ -305,7 +305,7 @@ function manualRun() { fi if [ "${backup}" == "yes" ]; then - title "${COLOR_SKY}[+] BACKUP${COLOR_DEFAULT}" + title "${COLOR_SKY}[+] BACKUP IMAGE${COLOR_DEFAULT}" backupOriginalPhoto "${get_file_name}" fi @@ -326,7 +326,7 @@ function manualRun() { if [ "${convert_border}" == "yes" ]; then convertBorder fi - + if [ "${convert_footer}" == "yes" ]; then convertFooter fi @@ -363,6 +363,8 @@ function backupOriginalPhoto() { check fi + termux-media-scan -r "${path_backup}" &> /dev/null + termux-media-scan "${path_backup}/${change_filename_backup}" &> /dev/null } function convertToPng() { From d27f322354d58eb4f33b9a87dc04c0de2acfcd3b Mon Sep 17 00:00:00 2001 From: nihsx Date: Mon, 18 Apr 2022 10:48:08 +0700 Subject: [PATCH 6/6] default config for awesomeshot --- awesomeshot.conf | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/awesomeshot.conf b/awesomeshot.conf index 51c264c..43f0c1f 100644 --- a/awesomeshot.conf +++ b/awesomeshot.conf @@ -1,8 +1,13 @@ # Make sure when your phone screenshot the result file image # PATH is same with this variable. Default my phone result file -# image PATH on "/sdcard/Pictures/Screenshots". If not same, +# image PATH on "/sdcard/DCIM/Screenshots". If not same, # you can edit this variable value -screenshot_result_path="/sdcard/Pictures/Screenshots" +screenshot_result_path="/sdcard/DCIM/Screenshots" + +# This variable serves to set the convert image with file type non PNG, change this value +# to blank or whatever for disable function and "yes" for enable function. +# Convert to PNG if file not PNG +convert_to_png="yes" # This variable serves to function to backup original photo # (screenshot result), change this value to blank or whatever for disable @@ -10,7 +15,7 @@ screenshot_result_path="/sdcard/Pictures/Screenshots" backup="yes" # This variable serves to set the original photo backup PATH -path_backup="${HOME}/.config/awesomeshot/backup" +path_backup="/sdcard/DCIM/awesomeshot" # Array Hex Color hex_color=( @@ -42,6 +47,10 @@ add_on_img="" width_img=500 height_img=1000 +# This variable serves to set titlebar color, if you want to custom the color, you can +# change this value with hex color or use the one in the array list. +titlebar_color="${hex_color[0]}" + # This variable serves to convert rounded corner, change this value # to blank or whatever for disable convert and "yes" for enable function convert_rounded="yes" @@ -119,11 +128,6 @@ footer_foreground="${hex_color[1]}" # change this value with hex color or use the one in the array list. footer_background="none" -# This variable serves to set the convert image with file type non PNG, change this value -# to blank or whatever for disable function and "yes" for enable function. -# Convert to PNG if file not PNG -convert_to_png="yes" - # This variable serves to open the result of image (when editing finished), change this value # to blank or whatever for disable function and "yes" for enable function. open_image=""