59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
|
#!/bin/bash
|
||
|
# mbxinit - initialize/update config files needed by mbxutils
|
||
|
|
||
|
CNF_DIR="$HOME/.config/mbxutils"
|
||
|
CNF_FILE="$CNF_DIR/mbx.conf"
|
||
|
|
||
|
[ ! -d "$CNF_DIR" ] && mkdir -p "$CNF_DIR" && cp -r /usr/share/mbxutils/* "$CNF_DIR"/
|
||
|
mkdir -p "$CNF_DIR"/inc
|
||
|
|
||
|
check_fonts() {
|
||
|
search_fonts=(Ubuntu "DejaVu Serif" "Autour One" "Noto Sans" "Noto Sans Light" "JetBrains Mono" "Droid Sans" Roboto Helvetica Cantarell)
|
||
|
while read -r x
|
||
|
do
|
||
|
if ( dlm=$'\x1F' ; IFS="$dlm" ; [[ "$dlm${search_fonts[*]}$dlm" == *"$dlm${x}$dlm"* ]] ) ; then
|
||
|
fonts+=("${x}")
|
||
|
fi
|
||
|
done < <(fc-list| cut -d: -f2|cut -d, -f1,2 |tr , '\n'|sort|uniq)
|
||
|
printf '%s\n' "${fonts[@]}" > "$CNF_DIR"/inc/fonts.inc
|
||
|
}
|
||
|
|
||
|
check_terminals() {
|
||
|
search_terminals=(terminator lxterminal xfce4-terminal alacritty konsole qterminal )
|
||
|
for i in "${search_terminals[@]}"
|
||
|
do
|
||
|
if hash ${i} 2>/dev/null; then
|
||
|
terminals+=("${i}")
|
||
|
fi
|
||
|
done
|
||
|
printf '%s\n' "${terminals[@]}" > "$CNF_DIR"/inc/terminals.inc
|
||
|
}
|
||
|
|
||
|
check_browsers() {
|
||
|
search_browsers=(firefox chromium vivaldi opera midori)
|
||
|
for i in "${search_browsers[@]}"
|
||
|
do
|
||
|
if hash ${i} 2>/dev/null; then
|
||
|
browsers+=("${i}")
|
||
|
fi
|
||
|
done
|
||
|
printf '%s\n' "${browsers[@]}" > "$CNF_DIR"/inc/browsers.inc
|
||
|
}
|
||
|
|
||
|
check_file_managers() {
|
||
|
search_file_managers=(xdg-open pcmanfm thunar caja nautilus dolphin)
|
||
|
for i in "${search_file_managers[@]}"
|
||
|
do
|
||
|
if hash ${i} 2>/dev/null; then
|
||
|
file_managers+=("${i}")
|
||
|
fi
|
||
|
done
|
||
|
printf '%s\n' "${file_managers[@]}" > "$CNF_DIR"/inc/file_managers.inc
|
||
|
}
|
||
|
|
||
|
|
||
|
check_fonts
|
||
|
check_terminals
|
||
|
check_browsers
|
||
|
check_file_managers
|