5
5
#
6
6
# Copyright (c) 2021 - 2022 xShin
7
7
8
- version=1.0.5
8
+ version=1.0.8
9
9
10
10
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:- ${HOME} / .config}
11
11
config_file=" ${XDG_CONFIG_HOME} /awesomeshot/awesomeshot.conf"
@@ -26,8 +26,8 @@ read -rd '' config <<'EOF'
26
26
# PATH is same with this variable. Default my phone result file
27
27
# image PATH on "/sdcard/DCIM/Screenshots". If not same,
28
28
# you can edit this variable value
29
- # screenshot_result_path="/sdcard/Pictures/ScreenMaster"
30
- screenshot_result_path="/sdcard/DCIM/Screenshots"
29
+ screenshot_result_path="/sdcard/Pictures/ScreenMaster"
30
+ # screenshot_result_path="/sdcard/DCIM/Screenshots"
31
31
32
32
# This variable serves to set the convert image with file type non PNG, change this value
33
33
# to blank or whatever for disable function and "yes" for enable function.
@@ -84,17 +84,30 @@ convert_rounded="yes"
84
84
# This variable serves to set how many rounded corners
85
85
border_radius=10
86
86
87
+ # This variable serves to convert tiny first border (background image) when editing the image,
88
+ # change this value to blank or whatever for disable convert and "yes" for enable function
89
+ convert_first_border="yes"
90
+
91
+ # This variable serves to set tiny first border color (background image), change this value
92
+ # to "none" for transparent background, if you want to custom the color, you can
93
+ # change this value with hex color or use the one in the array list.
94
+ first_border_color="${hex_color[0]}"
95
+
96
+ # This variable serves to set how many size of the first border
97
+ # NOTE: make sure this value is small, otherwise it will look weird
98
+ first_border_size=7
99
+
87
100
# This variable serves to convert border (background image) when editing the image,
88
101
# change this value to blank or whatever for disable convert and "yes" for enable function
89
- convert_border ="yes"
102
+ convert_second_border ="yes"
90
103
91
104
# This variable serves to set border color (background image), change this value
92
105
# to "none" for transparent background, if you want to custom the color, you can
93
106
# change this value with hex color or use the one in the array list.
94
- border_color ="${hex_color[0]}"
107
+ second_border_color ="${hex_color[0]}"
95
108
96
- # This variable serves to set how many size of the border
97
- border_size =50
109
+ # This variable serves to set how many size of the second border
110
+ second_border_size =50
98
111
99
112
# This variable serves to convert the shadow of image, change this value
100
113
# to blank or whatever for disable function and "yes" for enable function.
@@ -268,20 +281,25 @@ function autoRun() {
268
281
convertRounded
269
282
fi
270
283
284
+ if [ " ${convert_first_border} " == " yes" ]; then
285
+ convertFirstBorder
286
+ convertRounded
287
+ fi
288
+
271
289
if [ " ${convert_shadow} " == " yes" ]; then
272
290
convertShadow
273
291
fi
274
292
275
- if [ " ${convert_border } " == " yes" ]; then
276
- convertBorder
293
+ if [ " ${convert_second_border } " == " yes" ]; then
294
+ convertSecondBorder
277
295
fi
278
296
279
297
if [ " ${convert_footer} " == " yes" ]; then
280
298
convertFooter
281
299
fi
282
300
283
301
termux-media-scan " ${file_name} " & > /dev/null
284
- termux-toast -b " ${border_color } " -c " ${footer_foreground } " -g top " ${file_name##*/ } ✅"
302
+ termux-toast -b " ${hex_color[0] } " -c " ${hex_color[1] } " -g top " ${file_name##*/ } ✅"
285
303
termux-notification --action " termux-open '${file_name} '" --icon " camera_enhance" \
286
304
--image-path " ${file_name} " --priority " high" --title " 📸 Awesomeshot v${version} "
287
305
@@ -297,6 +315,10 @@ function autoRun() {
297
315
done
298
316
}
299
317
318
+ function getPwd() {
319
+ pwd=$( pwd)
320
+ }
321
+
300
322
function manualRun() {
301
323
getUserConfig
302
324
header
@@ -306,12 +328,12 @@ function manualRun() {
306
328
check
307
329
308
330
if [ " ${convert_to_png} " == " yes" ]; then
309
- convertToPng " ${get_file_name} "
331
+ convertToPng
310
332
fi
311
333
312
334
if [ " ${backup} " == " yes" ]; then
313
335
title " ${COLOR_SKY} [+] BACKUP IMAGE${COLOR_DEFAULT} "
314
- backupOriginalPhoto " ${get_file_name } "
336
+ backupOriginalPhoto " ${file_name } "
315
337
fi
316
338
317
339
title " ${COLOR_SKY} [+] EDITING IMAGE${COLOR_DEFAULT} "
@@ -324,20 +346,25 @@ function manualRun() {
324
346
convertRounded
325
347
fi
326
348
349
+ if [ " ${convert_first_border} " == " yes" ]; then
350
+ convertFirstBorder
351
+ convertRounded
352
+ fi
353
+
327
354
if [ " ${convert_shadow} " == " yes" ]; then
328
355
convertShadow
329
356
fi
330
357
331
- if [ " ${convert_border } " == " yes" ]; then
332
- convertBorder
358
+ if [ " ${convert_second_border } " == " yes" ]; then
359
+ convertSecondBorder
333
360
fi
334
361
335
362
if [ " ${convert_footer} " == " yes" ]; then
336
363
convertFooter
337
364
fi
338
365
339
366
termux-media-scan " ${file_name} " & > /dev/null
340
- termux-toast -b " ${border_color } " -c " ${footer_foreground } " -g top " ${file_name##*/ } ✅"
367
+ termux-toast -b " ${hex_color[0] } " -c " ${hex_color[1] } " -g top " ${file_name} ✅"
341
368
termux-notification --action " termux-open '${file_name} '" --icon " camera_enhance" \
342
369
--image-path " ${file_name} " --priority " high" --title " 📸 Awesomeshot v${version} "
343
370
@@ -354,14 +381,15 @@ function manualRun() {
354
381
355
382
function backupOriginalPhoto() {
356
383
change_filename_backup=$( echo $1 | sed ' s/.png/_backup.png/g' )
384
+ get_filename_suffix=${change_filename_backup##*/ }
357
385
358
386
if [ ! -d ${path_backup} ]; then
359
387
mkdir -p " ${path_backup} "
360
388
fi
361
389
362
- cp " ${file_name} " " ${path_backup} /${change_filename_backup } "
390
+ cp " ${file_name} " " ${path_backup} /${get_filename_suffix } "
363
391
364
- if [ -f ${path_backup} /${change_filename_backup } ]; then
392
+ if [ -f ${path_backup} /${get_filename_suffix } ]; then
365
393
366
394
subtitle " [+]*Backup*File*"
367
395
check
@@ -451,6 +479,13 @@ function convertRounded() {
451
479
check
452
480
}
453
481
482
+ function convertFirstBorder() {
483
+ subtitle " [+]*Set*Image*First*Border*Color*"
484
+
485
+ convert " $file_name " -bordercolor " ${first_border_color} " -border ${first_border_size} " $file_name "
486
+ check
487
+ }
488
+
454
489
function convertShadow() {
455
490
subtitle " [+]*Set*Image*Shadow*"
456
491
@@ -467,10 +502,10 @@ function convertShadow() {
467
502
check
468
503
}
469
504
470
- function convertBorder () {
471
- subtitle " [+]*Set*Image*Border*Color*"
505
+ function convertSecondBorder () {
506
+ subtitle " [+]*Set*Image*Second* Border*Color*"
472
507
473
- convert " $file_name " -bordercolor " ${border_color } " -border ${border_size } " $file_name "
508
+ convert " $file_name " -bordercolor " ${second_border_color } " -border ${second_border_size } " $file_name "
474
509
check
475
510
}
476
511
@@ -536,13 +571,125 @@ function help() {
536
571
awesomeshot [args] [file]
537
572
538
573
META OPTIONS:
539
- -h, --help Show list of command-line options
540
- -v, --version Show version of awesomeshot
574
+ -h, --help Show list of command-line options
575
+ -v, --version Show version of awesomeshot
541
576
542
577
RUN OPTIONS:
543
- -a, --auto Run awesomeshot with automatic while take screenshot
544
- -m, --manual Run awesomeshot with manual (this option require filename)
545
- -c, --config Generate default config awesomeshot.conf
578
+ -a, --auto Run awesomeshot with automatic while take screenshot
579
+ -m, --manual Run awesomeshot with manual (this option require filename)
580
+ -c, --config Generate default config awesomeshot.conf
581
+
582
+ CONFIG OPTIONS:
583
+ screenshot_result_path Make sure when your phone screenshot the result file image
584
+ PATH is same with this variable. Default my phone result file
585
+ image PATH on '/sdcard/DCIM/Screenshots'. If not same,
586
+ you can edit this variable value
587
+
588
+ convert_to_png This variable serves to set the convert image with file type non PNG, change this value
589
+ to blank or whatever for disable function and 'yes' for enable function.
590
+ Convert to PNG if file not PNG
591
+
592
+ backup This variable serves to function to backup original photo
593
+ (screenshot result), change this value to blank or whatever for disable
594
+ function and 'yes' for enable function
595
+
596
+ path_backup This variable serves to set the original photo backup PATH
597
+
598
+ hex_color Array Hex Color
599
+
600
+ convert_titlebar This variable serves to convert title bar when editing the image, change this value
601
+ to blank or whatever for disable convert and 'yes' for enable function
602
+
603
+ add_on_img This variable serves to set where the title bar place, if 'yes' the title bar add on image,
604
+ if blank or whatever the title bar will be added at out of image
605
+
606
+ width_img & height_img This variable serves to set the width and height size of title bar.
607
+ NOTE (Bug Found):
608
+ - Sometimes the title bar result is too big or too small
609
+ width_img=magick file_name - format '%w' info:
610
+ height_img=magick file_name - format '%h' info:
611
+ if (( width_img > height_img )); then
612
+ height_img=width_img
613
+ elif (( width_img < height_img )); then
614
+ width_img=height_img
615
+ fi
616
+
617
+ titlebar_color This variable serves to set titlebar color, if you want to custom the color, you can
618
+ change this value with hex color or use the one in the array list.
619
+
620
+ convert_rounded This variable serves to convert rounded corner, change this value
621
+ to blank or whatever for disable convert and 'yes' for enable function
622
+
623
+ border_radius This variable serves to set how many rounded corners
624
+
625
+ convert_first_border This variable serves to convert tiny first border (background image) when editing the image,
626
+ change this value to blank or whatever for disable convert and 'yes' for enable function
627
+
628
+ first_border_color This variable serves to set tiny first border color (background image), change this value
629
+ to 'none' for transparent background, if you want to custom the color, you can
630
+ change this value with hex color or use the one in the array list.
631
+
632
+ first_border_size This variable serves to set how many size of the first border
633
+ NOTE: make sure this value is small, otherwise it will look weird
634
+
635
+ convert_second_border This variable serves to convert border (background image) when editing the image,
636
+ change this value to blank or whatever for disable convert and 'yes' for enable function
637
+
638
+ second_border_color This variable serves to set border color (background image), change this value
639
+ to 'none' for transparent background, if you want to custom the color, you can
640
+ change this value with hex color or use the one in the array list.
641
+
642
+ second_border_size This variable serves to set how many size of the second border
643
+
644
+ convert_shadow This variable serves to convert the shadow of image, change this value
645
+ to blank or whatever for disable function and 'yes' for enable function.
646
+
647
+ shadow_color This variable serves to set shadow color, if you want to custom the color, you can
648
+ change this value with hex color or use the one in the array list.
649
+
650
+ shadow_size This variable serves to set shadow size, this variable has four values:
651
+ shadow_size='75x30+0+30'
652
+ that mean:
653
+ - bottom shadow is x75
654
+ - right shadow is +30
655
+ - top shadow is +0
656
+ - left shadow is +30
657
+
658
+ convert_footer This variable serves to convert the footer text, change this value
659
+ to blank or whatever for disable function and 'yes' for enable function.
660
+
661
+ footer_text This variable serves to set text of footer, if you want to use icon
662
+ you can search on Nerd Fonts Website (https://www.nerdfonts.com/cheat-sheet)
663
+ NOTE: if you use icon from Nerd Fonts, make sure 'footer_font' using nerd fonts to!
664
+
665
+ footer_position This variable serves to set text position of footer, the value contain 8 wind direction:
666
+ - NorthWest
667
+ - North
668
+ - West
669
+ - Center
670
+ - East
671
+ - SouthWest
672
+ - South
673
+ - SouthEast
674
+ NOTE: Default value is 'South'
675
+
676
+ footer_xy This variable serves to set position of 'X' and 'Y'
677
+
678
+ footer_font This variable serves to set the font used when converting, you can check the list font
679
+ available to use for ImageMagick by command:
680
+ magick convert -list font | grep -iE 'font:.*'
681
+
682
+ footer_font_size This variable serves to set font size
683
+
684
+ footer_foreground This variable serves to set the text color, if you want to custom the color, you can
685
+ change this value with hex color or use the one in the array list.
686
+
687
+ footer_background This variable serves to set footer background color (background text), change this value
688
+ to 'none' for transparent background, if you want to custom the color, you can
689
+ change this value with hex color or use the one in the array list.
690
+
691
+ open_image This variable serves to open the result of image (when editing finished), change this value
692
+ to blank or whatever for disable function and 'yes' for enable function.
546
693
"
547
694
}
548
695
@@ -559,7 +706,8 @@ case "${1}" in
559
706
;;
560
707
-m|--manual )
561
708
if [ ${2} ]; then
562
- file_name=" ${2} "
709
+ getPwd
710
+ file_name=" ${pwd} /${2} "
563
711
main manualRun
564
712
else
565
713
echo " "
0 commit comments