From 2c8660eb201bdad749130ceccc728ab35af8a9e8 Mon Sep 17 00:00:00 2001 From: donatien Date: Sat, 20 Jul 2024 13:40:40 +0200 Subject: [PATCH] bmosay.sh dosen't need to be called from within bmofetch/ anymore --- README.md | 2 +- small/bmofetch/bmofetch.conf | 2 +- small/bmofetch/bmosay.sh | 31 +++++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 6b6ca29..b88ff9b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Fun fact: This is called af++ or AxylFetch++ because this was actually based on **if you want to change the speech bubble text**, you can do so by running [bmosay.sh](https://github.com/Chick2D/neofetch-themes/blob/main/small/bmofetch/bmosay.sh) in your terminal: ```bash -cd ~/.config/neofetch/bmofetch/ && sh bmosay.sh "your text here" && cd + sh path_to_bmofetch/bmosay.sh "your text here" ``` NOTE: You will need to install any one Nerd font and use it in your terminal for the above theme to render the icons correctly. diff --git a/small/bmofetch/bmofetch.conf b/small/bmofetch/bmofetch.conf index d129e43..ffb19b1 100644 --- a/small/bmofetch/bmofetch.conf +++ b/small/bmofetch/bmofetch.conf @@ -4,7 +4,7 @@ print_info() { prin "___________ˎ" prin "llo there! |" - prin "¯¯¯¯¯¯¯¯¯¯¯´" + prin "ˉˉˉˉˉˉˉˉˉˉˉ´" info "$(color 1) USR" users info "$(color 2) OS " distro info "$(color 3) UP " uptime diff --git a/small/bmofetch/bmosay.sh b/small/bmofetch/bmosay.sh index e484c40..3e9f1b2 100755 --- a/small/bmofetch/bmosay.sh +++ b/small/bmofetch/bmosay.sh @@ -41,25 +41,21 @@ fi # clean up multiple spaces input=$(echo "$1" | tr -s ' ') -# get the length of the strinng -str_len=$((${#input}+2)) +# get the size of the speach bubble +bub_len=$((${#input}+2)) -#make the top line -tline=$(printf '_%.0s' $(seq 1 $str_len)) +# make the top line +tline=$(printf '_%.0s' $(seq 1 $bub_len)) top_line="ˏ$tlineˎ" # make center text center_text="\| $input \|" # make the bottom line -bline=$(printf 'ˉ%.0s' $(seq 1 $str_len)) +bline=$(printf 'ˉ%.0s' $(seq 1 $bub_len)) bottom_line="\`$bline\´" -# Path to the ASCII file and the configuration file -ascii_file="./bmo.txt" -conf_file="./bmofetch.conf" - -#default case for start part of the spank bubble (empty string) +#default case for start part of the spank bubble start_top_line="$top_line" start_center_text="$center_text" start_bottom_line="$bottom_line" @@ -69,7 +65,7 @@ end_center_line="" end_bottom_line="" #if input string was not empty -if [ "$str_len" -gt 2 ]; then +if [ "$bub_len" -gt 2 ]; then # get the 4 first chars of the lines start_top_line=${top_line:0:4} start_center_text=${center_text:0:5} @@ -80,20 +76,27 @@ if [ "$str_len" -gt 2 ]; then end_bottom_line=${bottom_line: 4} fi -# if the text part that gets rendered though the neofetch conf (using prin) has a leading spases, let it get rendered as ascii instead +# if the text part that gets rendered though the neofetch conf (using prin) +# has a leading space, let it get rendered as ascii instead (prin does not render leading spaces) if [[ $end_center_line =~ ^[[:space:]].* ]]; then start_center_text="$center_text" end_center_line="" fi -# make the first part of the speak bubble in the ascii file (2 chars long text) +# Get the path of the script +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +# Path to the ASCII file and the configuration file +ascii_file="$SCRIPTPATH/bmo.txt" +conf_file="$SCRIPTPATH/bmofetch.conf" + +# make the first part of the speak bubble in the ascii file (2 chars of the text) replace_string_in_file "$ascii_file" "1" "\\\u001b[1m $start_top_line" replace_string_in_file "$ascii_file" "2" "\\\033[36m ˏ________ˎ \\\033[39m$start_center_text" replace_string_in_file "$ascii_file" "3" "\\\033[36m \\/|\\\033[39m ______\\\033[36m | \\\033[39m \\/$start_bottom_line" -# make the end part of the speak bubble in the conf file (form char 3 to the end) +# make the end part of the speak bubble in the conf file (form the third text char to the end) replace_string_in_file "$conf_file" "5" " prin \"$end_top_line\"" replace_string_in_file "$conf_file" "6" " prin \"$end_center_line\"" replace_string_in_file "$conf_file" "7" " prin \"$end_bottom_line\""