From 647601a7431b5af2462fdcfeb3e603ec73c67d63 Mon Sep 17 00:00:00 2001 From: pika Date: Fri, 23 May 2025 16:31:47 +0200 Subject: [PATCH] structural changes --- install.sh | 225 ++++++++++++++++++++++------------------------------- 1 file changed, 91 insertions(+), 134 deletions(-) diff --git a/install.sh b/install.sh index 58f52b6..5a5a73d 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ command_exists() { command -v "$@" >/dev/null 2>&1 } -getImports() { +source-script() { local url="$1" local import="$(mktemp)" if command_exists curl; then @@ -22,39 +22,41 @@ getImports() { rm "$import" echo "imported $url" } + __pre_stow__() { - echo_note "__pre_stow__" + pen blue "Getting things ready.." + sleep 2 conf="$HOME/.config" bak_dir="$HOME/.bak" dirs=( "btop" "gBar" - "yazi" "fastfetch" + "foot" "hypr" "tmux" "kitty" "neovide" "rofi" + "tofi" "waybar" "wlogout" "wob" + "yazi" "zellij" ) - pen yellow "Trying to clean the environment.." - if [ ! -d "$bak_dir" ]; then - repen yellow "backup dir created at $bak_dir" && + pen grey "backup dir created at $bak_dir" && silentexec mkdir "$bak_dir" else - pen bold yellow "Backup dir already present, clearing now" && + pen bold grey "Backup dir already present, clearing now" && rm -rf "${bak_dir:?}/*" fi for _dirs in "${dirs[@]}"; do if [ -d "$conf/$_dirs" ]; then - repen moved $_dirs + pen grey "moved $_dirs" mv -f "$conf/$_dirs" "$bak_dir" fi done @@ -62,19 +64,21 @@ __pre_stow__() { h_files=( ".zshrc" ".zshenv" + ".bashrc" + ".bash_alias" ".wezterm.lua" ) for _f in "${h_files[@]}"; do if [ -f "$HOME/$_f" ]; then - repen moved $_f + pen "moved $_f" mv -f "$HOME/$_f" "$bak_dir" && echo_info "Moved $_f to $bak_dir" fi done for _d in ".zsh .tmux .fzf"; do if [ -d "$HOME/$_d" ]; then - repen moved $_d + pen "moved $_d" mv -f "$HOME/$_d" "$bak_dir" && echo_info "Moved $_d to $bak_dir" fi done @@ -112,32 +116,21 @@ askThings() { __optional__=false - if confirm askOptional "Do you also want to install optional packages?" >"$HOME/.monitors.conf" + if [[ -n $res ]]; then + echo "monitor = eDP-1, ${res}, 0x0, 1" >>"$HOME/.monitors.conf" + else + echo "monitor = preferred,, 0x0, 1" >>"$HOME/.monitors.conf" + fi fi } @@ -292,64 +264,44 @@ pkg_optional() { "trash-cli" ) - case "$_ops" in - Y | y | yes) - for _o_ in "${_ops[@]}"; do - if command_exists "$_o_"; then - echo_note "$_o_ - is already installed" - else - echo_info "Installing $_o_" - pkg-install "$_o_" - fi - done - ;; - *) - echo default - ;; - esac + for pkg in "${_opts[@]}"; do + spin "Installing $pkg" + if ! command_exists $pkg; then + run pkg-install $pkg && check "$pkg installed" || throw "Error installing $pkg" + fi + done } __stow__() { local err spin grey "Linking dotfiles.." - if run --err err stow --verbose --target="$HOME" --defer=.gitmodules --restow */; then - check "Linked dotfiles!" - else - throw "Could not use stow to link dofiles.." + run --err err stow --verbose --target="$HOME" --defer=.gitmodules --restow */ && check "Linked dotfiles!" || + throw "Could not use stow to link dofiles.." && echo_error "${err:-}" - fi } c_fonts() { local err local dirFonts="$HOME/.local/share/fonts/" if [[ ! -d "$dirFonts" ]]; then - if choose "Seems like you may miss some fonts.. Do you want to clone them now to <$HOME/.local/share/fonts/>" ? [y|n]" && read -r ask_fonts - - # case "$ask_fonts" in - # [Yy]) + if choose "Seems like you may miss some fonts.. Do you want to clone them now into $(pen blue bold $HOME/.local/share/fonts)" ?"