mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Merge pull request #75 from jtmusselman/add-zsh-install
Add ZSH install option
This commit is contained in:
commit
528e1ec86e
51
src/commands/applications-setup/zsh-setup.sh
Normal file
51
src/commands/applications-setup/zsh-setup.sh
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./common-script.sh
|
||||
|
||||
# Function to install zsh
|
||||
install_zsh() {
|
||||
echo "Install ZSH if not already installed..."
|
||||
if ! command_exists zsh; then
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
sudo "$PACKAGER" -Sy --noconfirm zsh
|
||||
;;
|
||||
*)
|
||||
sudo "$PACKAGER" install -y zsh
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "ZSH is already installed."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to setup zsh configuration
|
||||
setup_zsh_config() {
|
||||
CONFIG_DIR="$HOME/.config/zsh"
|
||||
ZSHRC_FILE="$CONFIG_DIR/.zshrc"
|
||||
|
||||
if [ ! -d "$CONFIG_DIR" ]; then
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
# Write the configuration to .zshrc
|
||||
cat <<EOL >"$ZSHRC_FILE"
|
||||
HISTFILE=~/.config/zsh/.histfile
|
||||
HISTSIZE=5000
|
||||
SAVEHIST=100000
|
||||
setopt autocd extendedglob
|
||||
unsetopt beep
|
||||
bindkey -v
|
||||
|
||||
# Configure the prompt with embedded Solarized color codes
|
||||
PROMPT='%F{32}%n%f%F{166}@%f%F{64}%m:%F{166}%~%f%F{15}$%f '
|
||||
RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
|
||||
EOL
|
||||
|
||||
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
||||
echo 'export ZDOTDIR="$HOME/.config/zsh"' | sudo tee -a /etc/zsh/zshenv
|
||||
}
|
||||
|
||||
checkEnv
|
||||
setup_zsh_config
|
||||
install_zsh
|
|
@ -111,6 +111,10 @@ impl CustomList {
|
|||
ListNode {
|
||||
name: "Rofi",
|
||||
command: Command::LocalFile("applications-setup/rofi-setup.sh"),
|
||||
},
|
||||
ListNode {
|
||||
name: "ZSH Prompt",
|
||||
command: Command::LocalFile("applications-setup/zsh-setup.sh"),
|
||||
}
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user