5
5
#
6
6
# Copyright (c) 2021 - 2022 xShin
7
7
8
- version=1.0.2
8
+ version=1.0.5
9
9
10
10
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:- ${HOME} / .config}
11
11
config_file=" ${XDG_CONFIG_HOME} /awesomeshot/awesomeshot.conf"
@@ -24,17 +24,22 @@ COLOR_SKY="\e[34m"
24
24
read -rd ' ' config << 'EOF '
25
25
# Make sure when your phone screenshot the result file image
26
26
# 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,
28
28
# 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"
30
35
31
36
# This variable serves to function to backup original photo
32
37
# (screenshot result), change this value to blank or whatever for disable
33
38
# function and "yes" for enable function
34
39
backup="yes"
35
40
36
41
# This variable serves to set the original photo backup PATH
37
- path_backup="${HOME}/.config/awesomeshot/backup "
42
+ path_backup="/sdcard/DCIM/awesomeshot "
38
43
39
44
# Array Hex Color
40
45
hex_color=(
@@ -66,6 +71,10 @@ add_on_img=""
66
71
width_img=500
67
72
height_img=1000
68
73
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
+
69
78
# This variable serves to convert rounded corner, change this value
70
79
# to blank or whatever for disable convert and "yes" for enable function
71
80
convert_rounded="yes"
@@ -143,11 +152,6 @@ footer_foreground="${hex_color[1]}"
143
152
# change this value with hex color or use the one in the array list.
144
153
footer_background="none"
145
154
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
-
151
155
# This variable serves to open the result of image (when editing finished), change this value
152
156
# to blank or whatever for disable function and "yes" for enable function.
153
157
open_image=""
@@ -175,7 +179,7 @@ function getUserConfig() {
175
179
function generateDefaultConfig() {
176
180
if [ ! -f " ${config_file} " ]; then
177
181
if [ ! -d " ~/.config/awesomeshot" ]; then
178
- mkdir ~ /.config/awesomeshot
182
+ mkdir ~ /.config/awesomeshot 2> /dev/null
179
183
fi
180
184
printf ' %s\n' " $config " > " $config_file "
181
185
stat " SUCCESS" " Success" " Default config has been generated"
@@ -233,16 +237,22 @@ function autoRun() {
233
237
get_file_name=$( echo -e " ${get_file_name_result} " | awk ' {print $3}' )
234
238
if [[ " ${screenshot_result_path} /${get_file_name} " != " ${file_name} " || -z ${file_name} ]]; then
235
239
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
237
247
238
248
echo -e " "
239
249
240
250
if [ " ${convert_to_png} " == " yes" ]; then
241
- convertToPng " ${get_file_name} "
251
+ convertToPng
242
252
fi
243
253
244
254
if [ " ${backup} " == " yes" ]; then
245
- title " ${COLOR_SKY} [+] BACKUP${COLOR_DEFAULT} "
255
+ title " ${COLOR_SKY} [+] BACKUP IMAGE ${COLOR_DEFAULT} "
246
256
backupOriginalPhoto " ${get_file_name} "
247
257
fi
248
258
@@ -295,7 +305,7 @@ function manualRun() {
295
305
fi
296
306
297
307
if [ " ${backup} " == " yes" ]; then
298
- title " ${COLOR_SKY} [+] BACKUP${COLOR_DEFAULT} "
308
+ title " ${COLOR_SKY} [+] BACKUP IMAGE ${COLOR_DEFAULT} "
299
309
backupOriginalPhoto " ${get_file_name} "
300
310
fi
301
311
@@ -316,7 +326,7 @@ function manualRun() {
316
326
if [ " ${convert_border} " == " yes" ]; then
317
327
convertBorder
318
328
fi
319
-
329
+
320
330
if [ " ${convert_footer} " == " yes" ]; then
321
331
convertFooter
322
332
fi
@@ -353,6 +363,8 @@ function backupOriginalPhoto() {
353
363
check
354
364
355
365
fi
366
+ termux-media-scan -r " ${path_backup} " & > /dev/null
367
+ termux-media-scan " ${path_backup} /${change_filename_backup} " & > /dev/null
356
368
}
357
369
358
370
function convertToPng() {
@@ -397,7 +409,7 @@ function convertTitleBar(){
397
409
# 760x360
398
410
if [[ " ${add_on_img} " == " yes" ]]; then
399
411
magick $file_name -fill $b \
400
- -background $b \
412
+ -background ${titlebar_color} \
401
413
-gravity north \
402
414
-chop 0x$br \
403
415
-splice 0x$br \
@@ -407,7 +419,7 @@ function convertTitleBar(){
407
419
$file_name
408
420
else
409
421
magick $file_name -fill $b \
410
- -background $b \
422
+ -background ${titlebar_color} \
411
423
-gravity north -splice 0x$br \
412
424
-draw " fill ${r} circle ${arr[0,0]} ,${arr[0,1]} ${arr[0,2]} ,${arr[0,3]}
413
425
fill ${y} circle ${arr[1,0]} ,${arr[1,1]} ${arr[1,2]} ,${arr[1,3]}
0 commit comments