bmosay.sh dosen't need to be called from within bmofetch/ anymore

This commit is contained in:
donatien
2024-07-20 13:40:40 +02:00
parent 1845c2c69e
commit 2c8660eb20
3 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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
+16 -13
View File
@@ -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))
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\""