Skip to content

Zen ZSH #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/install/dotfiles/before_restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ if [ -d ~/$dot_folder/.settings ] ;then
_move_folder ~/$dot_folder/.config/gtk/xsettings ~/$dot_folder/.config/xsettings
_move_file ~/$dot_folder/.config/gtk/.gtkrc-2.0 ~/$dot_folder/.gtkrc-2.0
_move_file ~/$dot_folder/.config/gtk/.Xresources ~/$dot_folder/.Xresources
_move_file ~/$dot_folder/.config/starship/starship.toml ~/$dot_folder/.config/starship.toml
_del_folder ~/$dot_folder/gtk
_del_folder ~/$dot_folder/eww
_del_folder ~/$dot_folder/starship

# Replace Quicklink
sed -i -e 's/dotfiles\/.settings/.config\/ml4w\/settings/g' ~/$dot_folder/.config/ml4w/settings/waybar-quicklinks.json
Expand Down
72 changes: 17 additions & 55 deletions lib/install/packages/aur.sh
Original file line number Diff line number Diff line change
@@ -1,74 +1,36 @@
# ------------------------------------------------------
# Check if yay is installed
# Select AUR Helper
# ------------------------------------------------------

yay_installed="false"
paru_installed="false"
aur_helper=""

_installYay() {
_installPackagesPacman "base-devel"
SCRIPT=$(realpath "$0")
temp_path=$(dirname "$SCRIPT")
git clone https://aur.archlinux.org/yay.git ~/Downloads/yay
cd ~/Downloads/yay
makepkg -si
cd $temp_path
echo ":: yay has been installed successfully."
}

_installParu() {
_installPackagesPacman "base-devel"
SCRIPT=$(realpath "$0")
temp_path=$(dirname "$SCRIPT")
git clone https://aur.archlinux.org/paru.git ~/Downloads/paru
cd ~/Downloads/paru
makepkg -si
cd $temp_path
echo ":: paru has been installed successfully."
}

_selectAURHelper() {
echo ":: Please select your preferred AUR Helper"
echo
aur_helper=$(gum choose "yay" "paru")
aur_helper=$(gum choose "yay" "paru" "pikaur" "trizen" "aurman" "pacaur" "pakku")
if [ -z $aur_helper ] ;then
_selectAURHelper
fi
}

_checkAURHelper() {
if [[ $(_checkCommandExists "yay") == "0" ]];then
echo ":: yay is installed"
yay_installed="true"
fi
if [[ $(_checkCommandExists "paru") == "0" ]];then
echo ":: paru is installed"
paru_installed="true"
fi
if [[ $yay_installed == "true" ]] && [[ $paru_installed == "false" ]] ;then
echo ":: Using AUR Helper yay"
aur_helper="yay"
elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "true" ]] ;then
echo ":: Using AUR Helper paru"
aur_helper="paru"
elif [[ $yay_installed == "false" ]] && [[ $paru_installed == "false" ]] ;then
if [[ $(_check_update) == "false" ]] ;then
_selectAURHelper
if [[ $aur_helper == "yay" ]] ;then
_installYay
else
_installParu
fi
fi
if command -v "$aur_helper" &> /dev/null; then
echo ":: $aur_helper is already installed."
return 0
else
_selectAURHelper
echo ":: Installing $aur_helper..."
cd $HOME
if [ -d "$HOME/$aur_helper" ]; then
rm -rf "$HOME/$aur_helper"
fi
git clone "https://aur.archlinux.org/$aur_helper.git" ~/$aur_helper || { echo ":: Failed to clone $aur_helper."; return 1; }
cd $HOME/"$aur_helper" || { echo ":: Failed to change directory to $aur_helper."; return 1; }
makepkg -si --noconfirm || { echo ":: Installation of $aur_helper failed."; return 1; }
cd $HOME
rm -rf "$aur_helper"
echo ":: $aur_helper installed successfully."
fi
}

echo -e "${GREEN}"
figlet -f smslant "AUR Helper"
echo -e "${NONE}"

_checkAURHelper

_selectAURHelper
14 changes: 8 additions & 6 deletions share/dotfiles/.config/bashrc/20-customization
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# CUSTOMIZATION
# -----------------------------------------------------

# -----------------------------------------------------
# Starship Prompt
# -----------------------------------------------------
eval "$(starship init bash)"
POSH=agnoster

# -----------------------------------------------------
# Pywal
# oh-my-posh promt
# -----------------------------------------------------
cat ~/.cache/wal/sequences
# Custom Theme
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)"

# Shipped Theme
# eval "$(oh-my-posh init zsh --config /usr/share/oh-my-posh/themes/$POSH.omp.json)"

6 changes: 6 additions & 0 deletions share/dotfiles/.config/bashrc/30-autostart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# AUTOSTART
# -----------------------------------------------------

# -----------------------------------------------------
# Pywal
# -----------------------------------------------------
cat ~/.cache/wal/sequences


# -----------------------------------------------------
# Fastfetch
# -----------------------------------------------------
Expand Down
135 changes: 119 additions & 16 deletions share/dotfiles/.config/ml4w/scripts/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,152 @@ if [[ $shell == "bash" ]] ;then
# -----------------------------------------------------
elif [[ $shell == "zsh" ]] ;then

# Change shell to shh
# Change shell to zsh
while ! chsh -s $(which zsh); do
echo "ERROR: Authentication failed. Please enter the correct password."
sleep 1
done
echo ":: Shell is now zsh."

# Installing oh-my-posh
yay -S --noconfirm oh-my-posh
# Check for plugins directory
if [ ! -d "$HOME/.config/zshrc/plugins" ]; then
echo ":: Making ZSH Plugin directory"
mkdir -p $HOME/.config/zshrc/plugins

# Installing oh-my-zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo ":: Installing oh-my-zsh"
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
cp ~/.config/ml4w/tpl/.zshrc ~/
else
echo ":: oh-my-zsh already installed"
echo ":: ZSH Plugin directory already exists"
fi

# Installing zsh-autosuggestions
if [ ! -d "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" ]; then
if [ ! -d "$HOME/.config/zshrc/plugins/zsh-autosuggestions" ]; then
echo ":: Installing zsh-autosuggestions"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.config/zshrc/plugins/zsh-autosuggestions
else
echo ":: zsh-autosuggestions already installed"
fi

# Installing zsh-syntax-highlighting
if [ ! -d "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ]; then
if [ ! -d "$HOME/.config/zshrc/plugins/zsh-syntax-highlighting" ]; then
echo ":: Installing zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.config/zshrc/plugins/zsh-syntax-highlighting
else
echo ":: zsh-syntax-highlighting already installed"
fi

# Installing fast-syntax-highlighting
if [ ! -d "$HOME/.oh-my-zsh/custom/plugins/fast-syntax-highlighting" ]; then
if [ ! -d "$HOME/.config/zshrc/plugins/fast-syntax-highlighting" ]; then
echo ":: Installing fast-syntax-highlighting"
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git $HOME/.config/zshrc/plugins/fast-syntax-highlighting
else
echo ":: fast-syntax-highlighting already installed"
fi

# Installing zsh-completions
if [ ! -d "$HOME/.config/zshrc/plugins/zsh-completions" ]; then
echo ":: Installing zsh-completions"
git clone https://github.com/zsh-users/zsh-completions.git $HOME/.config/zshrc/plugins/zsh-completions
else
echo ":: zsh-completions already installed"
fi

# Install zsh-plugin-git
if [ ! -f "$HOME/.config/zshrc/plugins/git.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-git"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/git/git.plugin.zsh -o $HOME/.config/zshrc/plugins/git.plugin.zsh
else
echo ":: zsh-plugin-git already installed"
fi

# Install zsh-plugin-sudo
if [ ! -f "$HOME/.config/zshrc/plugins/sudo.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-sudo"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/sudo/sudo.plugin.zsh -o $HOME/.config/zshrc/plugins/sudo.plugin.zsh
else
echo ":: zsh-plugin-sudo already installed"
fi

# Install zsh-plugin-web-search
if [ ! -f "$HOME/.config/zshrc/plugins/web-search.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-web-search"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/web-search/web-search.plugin.zsh -o $HOME/.config/zshrc/plugins/web-search.plugin.zsh
else
echo ":: zsh-plugin-web-search already installed"
fi

# Install zsh-plugin-archlinux
if [ ! -f "$HOME/.config/zshrc/plugins/archlinux.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-archlinux"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/archlinux/archlinux.plugin.zsh -o $HOME/.config/zshrc/plugins/archlinux.plugin.zsh
else
echo ":: zsh-plugin-archlinux already installed"
fi

# Install zsh-plugin-copyfile
if [ ! -f "$HOME/.config/zshrc/plugins/copyfile.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-copyfile"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/copyfile/copyfile.plugin.zsh -o $HOME/.config/zshrc/plugins/copyfile.plugin.zsh
else
echo ":: zsh-plugin-copyfile already installed"
fi

# Install zsh-plugin-copybuffer
if [ ! -f "$HOME/.config/zshrc/plugins/copybuffer.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-copybuffer"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/copybuffer/copybuffer.plugin.zsh -o $HOME/.config/zshrc/plugins/copybuffer.plugin.zsh
else
echo ":: zsh-plugin-copybuffer already installed"
fi

# Install zsh-plugin-dirhistory
if [ ! -f "$HOME/.config/zshrc/plugins/dirhistory.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-dirhistory"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/dirhistory/dirhistory.plugin.zsh -o $HOME/.config/zshrc/plugins/dirhistory.plugin.zsh
else
echo ":: zsh-plugin-dirhistory already installed"
fi

# Install zsh-plugin-colored-man-pages
if [ ! -f "$HOME/.config/zshrc/plugins/colored-man-pages.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-colored-man-pages"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/colored-man-pages/colored-man-pages.plugin.zsh -o $HOME/.config/zshrc/plugins/colored-man-pages.plugin.zsh
else
echo ":: zsh-plugin-colored-man-pages already installed"
fi

# Install zsh-plugin-command-not-found
if [ ! -f "$HOME/.config/zshrc/plugins/command-not-found.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-command-not-found"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/command-not-found/command-not-found.plugin.zsh -o $HOME/.config/zshrc/plugins/command-not-found.plugin.zsh
else
echo ":: zsh-plugin-command-not-found already installed"
fi

# Install zsh-plugin-extract
if [ ! -f "$HOME/.config/zshrc/plugins/extract.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-extract"
curl https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/refs/heads/master/plugins/extract/extract.plugin.zsh -o $HOME/.config/zshrc/plugins/extract.plugin.zsh
else
echo ":: zsh-plugin-extract already installed"
fi

# Install zsh-plugin-you-should-use
if [ ! -f "$HOME/.config/zshrc/plugins/you-should-use.plugin.zsh" ]; then
echo ":: Installing zsh-plugin-you-should-use"
curl https://raw.githubusercontent.com/MichaelAquilina/zsh-you-should-use/refs/heads/master/you-should-use.plugin.zsh -o $HOME/.config/zshrc/plugins/you-should-use.plugin.zsh
else
echo ":: zsh-plugin-you-should-use already installed"
fi

# Install pkgfile if needed (for command not found)
if ! command -v pkgfile &> /dev/null; then
echo ":: Installing pkgfile"
sudo pacman -S pkgfile
else
echo ":: pkgfile already installed"
fi

sudo pkgfile -u

gum spin --spinner dot --title "Please reboot your system." -- sleep 3

# -----------------------------------------------------
Expand All @@ -95,4 +198,4 @@ elif [[ $shell == "zsh" ]] ;then
else
echo ":: Changing shell canceled"
exit
fi
fi
Loading