65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# mbxinit - initialize/update config files needed by mbxutils
|
|
# TODO check for GUI package managers
|
|
# TODO generate favorites here
|
|
|
|
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 "Noto Sans" "Noto Sans Light" "DejaVu Serif" "Autour One" "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
|
|
mbx setvar "font=\'${fonts[0]}\'"
|
|
}
|
|
|
|
check_terminals() {
|
|
search_terminals=(terminator lxterminal xfce4-terminal alacritty gnome-terminal 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
|
|
mbx setvar terminal=${terminals[0]}
|
|
}
|
|
|
|
check_browsers() {
|
|
search_browsers=(firefox chromium vivaldi opera brave midori qutebrowser falkon)
|
|
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
|
|
mbx setvar wwwbrowser=${browsers[0]}
|
|
}
|
|
|
|
check_file_managers() {
|
|
search_file_managers=(xdg-open pcmanfm thunar pcmanfm-qt 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
|
|
mbx setvar filemanager=${file_managers[0]}
|
|
}
|
|
|
|
|
|
check_fonts
|
|
check_terminals
|
|
check_browsers
|
|
check_file_managers
|