Skip to content

Commit 14f33ff

Browse files
authored
awesomeshot: update v.1.0.8 (#10)
* add first border function * update new config for awesomeshot v.1.0.6 * update help argument for awesomeshot v.1.0.7 * update man (manual) page version * fix backup original photo v.1.0.8 * update man (manual) page v1.0.8 * update man (manual) page v1.0.8 | without new line
1 parent b653839 commit 14f33ff

File tree

3 files changed

+420
-36
lines changed

3 files changed

+420
-36
lines changed

awesomeshot

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

8-
version=1.0.5
8+
version=1.0.8
99

1010
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-${HOME}/.config}
1111
config_file="${XDG_CONFIG_HOME}/awesomeshot/awesomeshot.conf"
@@ -26,8 +26,8 @@ read -rd '' config <<'EOF'
2626
# PATH is same with this variable. Default my phone result file
2727
# image PATH on "/sdcard/DCIM/Screenshots". If not same,
2828
# 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"
3131
3232
# This variable serves to set the convert image with file type non PNG, change this value
3333
# to blank or whatever for disable function and "yes" for enable function.
@@ -84,17 +84,30 @@ convert_rounded="yes"
8484
# This variable serves to set how many rounded corners
8585
border_radius=10
8686
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+
87100
# This variable serves to convert border (background image) when editing the image,
88101
# change this value to blank or whatever for disable convert and "yes" for enable function
89-
convert_border="yes"
102+
convert_second_border="yes"
90103
91104
# This variable serves to set border color (background image), change this value
92105
# to "none" for transparent background, if you want to custom the color, you can
93106
# 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]}"
95108
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
98111
99112
# This variable serves to convert the shadow of image, change this value
100113
# to blank or whatever for disable function and "yes" for enable function.
@@ -268,20 +281,25 @@ function autoRun() {
268281
convertRounded
269282
fi
270283

284+
if [ "${convert_first_border}" == "yes" ]; then
285+
convertFirstBorder
286+
convertRounded
287+
fi
288+
271289
if [ "${convert_shadow}" == "yes" ]; then
272290
convertShadow
273291
fi
274292

275-
if [ "${convert_border}" == "yes" ]; then
276-
convertBorder
293+
if [ "${convert_second_border}" == "yes" ]; then
294+
convertSecondBorder
277295
fi
278296

279297
if [ "${convert_footer}" == "yes" ]; then
280298
convertFooter
281299
fi
282300

283301
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##*/}"
285303
termux-notification --action "termux-open '${file_name}'" --icon "camera_enhance" \
286304
--image-path "${file_name}" --priority "high" --title "📸 Awesomeshot v${version}"
287305

@@ -297,6 +315,10 @@ function autoRun() {
297315
done
298316
}
299317

318+
function getPwd() {
319+
pwd=$(pwd)
320+
}
321+
300322
function manualRun() {
301323
getUserConfig
302324
header
@@ -306,12 +328,12 @@ function manualRun() {
306328
check
307329

308330
if [ "${convert_to_png}" == "yes" ]; then
309-
convertToPng "${get_file_name}"
331+
convertToPng
310332
fi
311333

312334
if [ "${backup}" == "yes" ]; then
313335
title "${COLOR_SKY}[+] BACKUP IMAGE${COLOR_DEFAULT}"
314-
backupOriginalPhoto "${get_file_name}"
336+
backupOriginalPhoto "${file_name}"
315337
fi
316338

317339
title "${COLOR_SKY}[+] EDITING IMAGE${COLOR_DEFAULT}"
@@ -324,20 +346,25 @@ function manualRun() {
324346
convertRounded
325347
fi
326348

349+
if [ "${convert_first_border}" == "yes" ]; then
350+
convertFirstBorder
351+
convertRounded
352+
fi
353+
327354
if [ "${convert_shadow}" == "yes" ]; then
328355
convertShadow
329356
fi
330357

331-
if [ "${convert_border}" == "yes" ]; then
332-
convertBorder
358+
if [ "${convert_second_border}" == "yes" ]; then
359+
convertSecondBorder
333360
fi
334361

335362
if [ "${convert_footer}" == "yes" ]; then
336363
convertFooter
337364
fi
338365

339366
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}"
341368
termux-notification --action "termux-open '${file_name}'" --icon "camera_enhance" \
342369
--image-path "${file_name}" --priority "high" --title "📸 Awesomeshot v${version}"
343370

@@ -354,14 +381,15 @@ function manualRun() {
354381

355382
function backupOriginalPhoto() {
356383
change_filename_backup=$(echo $1 | sed 's/.png/_backup.png/g')
384+
get_filename_suffix=${change_filename_backup##*/}
357385

358386
if [ ! -d ${path_backup} ]; then
359387
mkdir -p "${path_backup}"
360388
fi
361389

362-
cp "${file_name}" "${path_backup}/${change_filename_backup}"
390+
cp "${file_name}" "${path_backup}/${get_filename_suffix}"
363391

364-
if [ -f ${path_backup}/${change_filename_backup} ]; then
392+
if [ -f ${path_backup}/${get_filename_suffix} ]; then
365393

366394
subtitle "[+]*Backup*File*"
367395
check
@@ -451,6 +479,13 @@ function convertRounded() {
451479
check
452480
}
453481

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+
454489
function convertShadow() {
455490
subtitle "[+]*Set*Image*Shadow*"
456491

@@ -467,10 +502,10 @@ function convertShadow() {
467502
check
468503
}
469504

470-
function convertBorder() {
471-
subtitle "[+]*Set*Image*Border*Color*"
505+
function convertSecondBorder() {
506+
subtitle "[+]*Set*Image*Second*Border*Color*"
472507

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"
474509
check
475510
}
476511

@@ -536,13 +571,125 @@ function help() {
536571
awesomeshot [args] [file]
537572
538573
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
541576
542577
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.
546693
"
547694
}
548695

@@ -559,7 +706,8 @@ case "${1}" in
559706
;;
560707
-m|--manual )
561708
if [ ${2} ]; then
562-
file_name="${2}"
709+
getPwd
710+
file_name="${pwd}/${2}"
563711
main manualRun
564712
else
565713
echo ""

0 commit comments

Comments
 (0)