Skip to content

Commit 0fc3084

Browse files
authored
Merge pull request #8 from mayTermux/dev
Fix bug screenshot filename '.pending' and change other stuff configuration
2 parents ee2633f + d27f322 commit 0fc3084

File tree

3 files changed

+42
-26
lines changed

3 files changed

+42
-26
lines changed

awesomeshot

+29-17
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Copyright (c) 2021 - 2022 xShin
77

8-
version=1.0.2
8+
version=1.0.5
99

1010
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-${HOME}/.config}
1111
config_file="${XDG_CONFIG_HOME}/awesomeshot/awesomeshot.conf"
@@ -24,17 +24,22 @@ COLOR_SKY="\e[34m"
2424
read -rd '' config <<'EOF'
2525
# Make sure when your phone screenshot the result file image
2626
# PATH is same with this variable. Default my phone result file
27-
# image PATH on "/sdcard/Pictures/Screenshots". If not same,
27+
# image PATH on "/sdcard/DCIM/Screenshots". If not same,
2828
# you can edit this variable value
29-
screenshot_result_path="/sdcard/Pictures/Screenshots"
29+
screenshot_result_path="/sdcard/DCIM/Screenshots"
30+
31+
# This variable serves to set the convert image with file type non PNG, change this value
32+
# to blank or whatever for disable function and "yes" for enable function.
33+
# Convert to PNG if file not PNG
34+
convert_to_png="yes"
3035
3136
# This variable serves to function to backup original photo
3237
# (screenshot result), change this value to blank or whatever for disable
3338
# function and "yes" for enable function
3439
backup="yes"
3540
3641
# This variable serves to set the original photo backup PATH
37-
path_backup="${HOME}/.config/awesomeshot/backup"
42+
path_backup="/sdcard/DCIM/awesomeshot"
3843
3944
# Array Hex Color
4045
hex_color=(
@@ -66,6 +71,10 @@ add_on_img=""
6671
width_img=500
6772
height_img=1000
6873
74+
# This variable serves to set titlebar color, if you want to custom the color, you can
75+
# change this value with hex color or use the one in the array list.
76+
titlebar_color="${hex_color[0]}"
77+
6978
# This variable serves to convert rounded corner, change this value
7079
# to blank or whatever for disable convert and "yes" for enable function
7180
convert_rounded="yes"
@@ -143,11 +152,6 @@ footer_foreground="${hex_color[1]}"
143152
# change this value with hex color or use the one in the array list.
144153
footer_background="none"
145154
146-
# This variable serves to set the convert image with file type non PNG, change this value
147-
# to blank or whatever for disable function and "yes" for enable function.
148-
# Convert to PNG if file not PNG
149-
convert_to_png="yes"
150-
151155
# This variable serves to open the result of image (when editing finished), change this value
152156
# to blank or whatever for disable function and "yes" for enable function.
153157
open_image=""
@@ -175,7 +179,7 @@ function getUserConfig() {
175179
function generateDefaultConfig() {
176180
if [ ! -f "${config_file}" ]; then
177181
if [ ! -d "~/.config/awesomeshot" ]; then
178-
mkdir ~/.config/awesomeshot
182+
mkdir ~/.config/awesomeshot 2> /dev/null
179183
fi
180184
printf '%s\n' "$config" > "$config_file"
181185
stat "SUCCESS" "Success" "Default config has been generated"
@@ -233,16 +237,22 @@ function autoRun() {
233237
get_file_name=$(echo -e "${get_file_name_result}" | awk '{print $3}')
234238
if [[ "${screenshot_result_path}/${get_file_name}" != "${file_name}" || -z ${file_name} ]]; then
235239
subtitle "[+]*Execute*Program*"
236-
file_name="${screenshot_result_path}/${get_file_name}"
240+
241+
# Fix bug screenshot filename ".pending"
242+
if [ ${get_file_name%%-*} == ".pending" ]; then
243+
file_name="${screenshot_result_path}/${get_file_name##*-}"
244+
else
245+
file_name="${screenshot_result_path}/${get_file_name}"
246+
fi
237247

238248
echo -e ""
239249

240250
if [ "${convert_to_png}" == "yes" ]; then
241-
convertToPng "${get_file_name}"
251+
convertToPng
242252
fi
243253

244254
if [ "${backup}" == "yes" ]; then
245-
title "${COLOR_SKY}[+] BACKUP${COLOR_DEFAULT}"
255+
title "${COLOR_SKY}[+] BACKUP IMAGE${COLOR_DEFAULT}"
246256
backupOriginalPhoto "${get_file_name}"
247257
fi
248258

@@ -295,7 +305,7 @@ function manualRun() {
295305
fi
296306

297307
if [ "${backup}" == "yes" ]; then
298-
title "${COLOR_SKY}[+] BACKUP${COLOR_DEFAULT}"
308+
title "${COLOR_SKY}[+] BACKUP IMAGE${COLOR_DEFAULT}"
299309
backupOriginalPhoto "${get_file_name}"
300310
fi
301311

@@ -316,7 +326,7 @@ function manualRun() {
316326
if [ "${convert_border}" == "yes" ]; then
317327
convertBorder
318328
fi
319-
329+
320330
if [ "${convert_footer}" == "yes" ]; then
321331
convertFooter
322332
fi
@@ -353,6 +363,8 @@ function backupOriginalPhoto() {
353363
check
354364

355365
fi
366+
termux-media-scan -r "${path_backup}" &> /dev/null
367+
termux-media-scan "${path_backup}/${change_filename_backup}" &> /dev/null
356368
}
357369

358370
function convertToPng() {
@@ -397,7 +409,7 @@ function convertTitleBar(){
397409
#760x360
398410
if [[ "${add_on_img}" == "yes" ]]; then
399411
magick $file_name -fill $b \
400-
-background $b \
412+
-background ${titlebar_color} \
401413
-gravity north \
402414
-chop 0x$br \
403415
-splice 0x$br \
@@ -407,7 +419,7 @@ function convertTitleBar(){
407419
$file_name
408420
else
409421
magick $file_name -fill $b \
410-
-background $b \
422+
-background ${titlebar_color} \
411423
-gravity north -splice 0x$br\
412424
-draw "fill ${r} circle ${arr[0,0]},${arr[0,1]} ${arr[0,2]},${arr[0,3]}
413425
fill ${y} circle ${arr[1,0]},${arr[1,1]} ${arr[1,2]},${arr[1,3]}

awesomeshot.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH AWESOMESHOT 1 "Mar 2022" "Awesomeshot 1.0.2" "User Commands"
1+
.TH AWESOMESHOT 1 "18 April 2022" "Awesomeshot 1.0.5" "User Commands"
22
.SH NAME
33
Awesomeshot
44
.SH SYNOPSIS

awesomeshot.conf

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# Make sure when your phone screenshot the result file image
22
# PATH is same with this variable. Default my phone result file
3-
# image PATH on "/sdcard/Pictures/Screenshots". If not same,
3+
# image PATH on "/sdcard/DCIM/Screenshots". If not same,
44
# you can edit this variable value
5-
screenshot_result_path="/sdcard/Pictures/Screenshots"
5+
screenshot_result_path="/sdcard/DCIM/Screenshots"
6+
7+
# This variable serves to set the convert image with file type non PNG, change this value
8+
# to blank or whatever for disable function and "yes" for enable function.
9+
# Convert to PNG if file not PNG
10+
convert_to_png="yes"
611

712
# This variable serves to function to backup original photo
813
# (screenshot result), change this value to blank or whatever for disable
914
# function and "yes" for enable function
1015
backup="yes"
1116

1217
# This variable serves to set the original photo backup PATH
13-
path_backup="${HOME}/.config/awesomeshot/backup"
18+
path_backup="/sdcard/DCIM/awesomeshot"
1419

1520
# Array Hex Color
1621
hex_color=(
@@ -42,6 +47,10 @@ add_on_img=""
4247
width_img=500
4348
height_img=1000
4449

50+
# This variable serves to set titlebar color, if you want to custom the color, you can
51+
# change this value with hex color or use the one in the array list.
52+
titlebar_color="${hex_color[0]}"
53+
4554
# This variable serves to convert rounded corner, change this value
4655
# to blank or whatever for disable convert and "yes" for enable function
4756
convert_rounded="yes"
@@ -119,11 +128,6 @@ footer_foreground="${hex_color[1]}"
119128
# change this value with hex color or use the one in the array list.
120129
footer_background="none"
121130

122-
# This variable serves to set the convert image with file type non PNG, change this value
123-
# to blank or whatever for disable function and "yes" for enable function.
124-
# Convert to PNG if file not PNG
125-
convert_to_png="yes"
126-
127131
# This variable serves to open the result of image (when editing finished), change this value
128132
# to blank or whatever for disable function and "yes" for enable function.
129133
open_image=""

0 commit comments

Comments
 (0)