refactor: fonts installer shell

This commit is contained in:
hesam-init 2024-03-22 00:01:45 +03:30
parent 8d78918ae1
commit 1202c0fc93
14 changed files with 30 additions and 23 deletions

View file

@ -1,10 +1,17 @@
#!/bin/bash #!/bin/bash
install_ttf_font() { source ./utils.sh
FONTS_DIR="../configs/host/ui/fonts"
install_ttf_fonts() {
sudo cp *.ttf /usr/share/fonts/TTF sudo cp *.ttf /usr/share/fonts/TTF
sudo fc-cache -f -v sudo fc-cache -f -v
log "Fonts installed successfully!"
} }
cd ../host/ui/fonts check_sudo
install_ttf_font cd $FONTS_DIR
install_ttf_fonts

View file

@ -26,13 +26,6 @@ declare SERVICES=(
exec 1> >(tee "../hyprland_setup_log") exec 1> >(tee "../hyprland_setup_log")
check_sudo() {
if [ "$(id -u)" != 0 ]; then
echo "Please run the script with sudo."
exit 1
fi
}
check() { check() {
if [ "$1" != 0 ]; then if [ "$1" != 0 ]; then
echo "$2 error : $1" | tee -a ../hyprland_setup_log echo "$2 error : $1" | tee -a ../hyprland_setup_log

View file

@ -6,3 +6,10 @@ log() {
echo -e "\n$message" echo -e "\n$message"
} }
check_sudo() {
if [ "$(id -u)" != 0 ]; then
echo "Please run the script with sudo."
exit 1
fi
}

26
stow.sh
View file

@ -2,11 +2,11 @@
source ./scripts/utils.sh source ./scripts/utils.sh
configs_dir="$(pwd)/configs" CONFIGS_DIR="$(pwd)/configs"
dotfiles_dir="$configs_dir/dotfiles" DOTFILES_DIR="$CONFIGS_DIR/dotfiles"
shell_dir="$configs_dir/shell" SHELL_DIR="$CONFIGS_DIR/shell"
shortcuts_dir="$configs_dir/shortcuts" SHORTCUTS_DIR="$CONFIGS_DIR/shortcuts"
hyprland_dir="$configs_dir/hyprland" HYPRLAND_DIR="$CONFIGS_DIR/hyprland"
display_help() { display_help() {
echo "Usage: [-s | -u] [-h]" echo "Usage: [-s | -u] [-h]"
@ -57,20 +57,20 @@ create_target_dir() {
} }
stow_shortcuts() { stow_shortcuts() {
create_symlinks $shortcuts_dir ~/.local/share/applications create_symlinks $SHORTCUTS_DIR ~/.local/share/applications
log "Shortcuts stowed successfully!" log "Shortcuts stowed successfully!"
} }
stow_dotfiles() { stow_dotfiles() {
create_symlinks $dotfiles_dir ~/.config create_symlinks $DOTFILES_DIR ~/.config
create_symlinks $shell_dir ~/ create_symlinks $SHELL_DIR ~/
log "Dotfiles stowed successfully!" log "Dotfiles stowed successfully!"
} }
stow_hyprland() { stow_hyprland() {
create_symlinks $hyprland_dir ~/.config create_symlinks $HYPRLAND_DIR ~/.config
log "Hyprland stowed successfully!" log "Hyprland stowed successfully!"
} }
@ -83,7 +83,7 @@ stow() {
} }
unstow_shell() { unstow_shell() {
for config in $shell_dir/.*; do for config in $SHELL_DIR/.*; do
if [ -f $config ]; then if [ -f $config ]; then
local file_name=$(basename $config) local file_name=$(basename $config)
local target_file=~/$file_name local target_file=~/$file_name
@ -111,9 +111,9 @@ unstow_shell() {
unstow() { unstow() {
unstow_shell unstow_shell
delete_symlinks $dotfiles_dir ~/.config delete_symlinks $DOTFILES_DIR ~/.config
delete_symlinks $shortcuts_dir ~/.local/share/applications delete_symlinks $SHORTCUTS_DIR ~/.local/share/applications
delete_symlinks $hyprland_dir ~/.config delete_symlinks $HYPRLAND_DIR ~/.config
log "All configs ustowed successfully !" log "All configs ustowed successfully !"
} }