diff --git a/setup/arch/config.py b/setup/arch/config.py index e504f86..5f4dbf7 100644 --- a/setup/arch/config.py +++ b/setup/arch/config.py @@ -15,20 +15,23 @@ DIRECTORIES_TO_REMOVE = [ APPS = [ 'element-desktop', 'fisher', - 'flatpak', 'freecad', + 'gimp', + 'inkscape', 'libreoffice-fresh', 'librewolf-bin', + 'localsend', 'neovim', + 'okular', 'proton-mail-bin', 'proton-vpn-gtk-app', + 'prusa-slicer', 'rtorrent', 'steam', 'stow', 'tmux', + 'torbrowser-launcher', 'wl-clipboard', - 'gimp', - 'inkscape', ] DOTFILES = [ diff --git a/setup/arch/install.py b/setup/arch/install.py index 67f7599..6a5affb 100644 --- a/setup/arch/install.py +++ b/setup/arch/install.py @@ -6,46 +6,53 @@ from pathlib import Path def sym_link_dir(): confirm_link = input("Do you want to link home directories to external storage? (Y/n): ") - if confirm_link.lower() in ("y", "yes", ""): - target_dir = input("Specify the full path to the external storage: ") + if confirm_link.lower() not in ("y", "yes", ""): + return - if Path(target_dir).is_dir(): - for dir in config.DIRECTORIES: - DIR_ITEM = Path(f"{Path.home()}/{dir}") + target_dir = Path(input("Specify the full path to the external storage: ")) - if not DIR_ITEM.is_symlink(): - if DIR_ITEM.is_dir(): - DIR_ITEM.rmdir() - DIR_ITEM.symlink_to(f"{target_dir}/{dir}") + if not target_dir.is_dir(): + return - for dir in config.DIRECTORIES_TO_REMOVE: - DIR_ITEM = Path(f"{Path.home()}/{dir}") + for subdir in config.DIRECTORIES: + dir_item = Path.home() / subdir - if DIR_ITEM.is_dir() and not DIR_ITEM.is_symlink(): - DIR_ITEM.rmdir() + if not dir_item.is_symlink(): + if dir_item.is_dir(): + dir_item.rmdir() + dir_item.symlink_to(target_dir / subdir) + + for subdir in config.DIRECTORIES_TO_REMOVE: + dir_item = Path.home() / subdir + + if dir_item.is_dir() and not dir_item.is_symlink(): + dir_item.rmdir() def install_apps(): - for app in config.APPS: - subprocess.run([ - 'sudo', 'pacman', '-S', f"{app}", '--noconfirm' - ], check=True) + subprocess.run( + ['sudo', 'pacman', '-S', '--noconfirm', *config.APPS], + check=True + ) - subprocess.run([ - "fish", "-c", "fisher install jorgebucaran/nvm.fish" - ], check=True) + subprocess.run( + ["fish", "-c", "fisher install jorgebucaran/nvm.fish"], + check=True + ) - subprocess.run([ - "fish", "-c", "nvm install lts" - ], check=True) + subprocess.run( + ["fish", "-c", "nvm install lts"], + check=True + ) def stow_dot_files(): - dotfiles_root = Path.home()/'.dotfiles' - for dotfile in config.DOTFILES: - subprocess.run([ - 'stow', '-d', str(dotfiles_root), dotfile, '--adopt' - ], check=True) + dotfiles_root = Path.home() / '.dotfiles' + + subprocess.run( + ['stow', '-d', str(dotfiles_root), *config.DOTFILES, '--adopt'], + check=True + ) subprocess.run( ['git', 'checkout', '--', *config.DOTFILES],