Skip to content
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

feat(fastfetch-setup): shell integration setup #1002

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
47 changes: 46 additions & 1 deletion core/tabs/applications-setup/fastfetch-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,52 @@ setupFastfetchConfig() {
curl -sSLo "${HOME}/.config/fastfetch/config.jsonc" https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/config.jsonc
}

setupFastfetchShell() {
printf "%b\n" "${YELLOW}Configuring shell integration...${RC}"

# Get current shell and RC file path
current_shell=$(basename "$SHELL")
rc_file=""

case "$current_shell" in
"bash")
rc_file="$HOME/.bashrc"
;;
"zsh")
rc_file="$HOME/.zshrc"
;;
*)
printf "%b\n" "${RED}Unsupported shell: $current_shell${RC}"
return 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't error out the whole script

;;
esac

# Check if RC file exists
if [ ! -f "$rc_file" ]; then
printf "%b\n" "${RED}Shell config file not found: $rc_file${RC}"
return 1
fi

# Check if fastfetch is already in RC file
if grep -q "fastfetch" "$rc_file"; then
printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}"
return 0
fi

# Ask for confirmation
printf "%b" "${GREEN}Would you like to add fastfetch to $rc_file? [y/N] ${RC}"
read -r response

if [ "$response" = "y" ] || [ "$response" = "Y" ]; then
printf "\n# Run fastfetch on terminal start\nfastfetch\n" >> "$rc_file"
printf "%b\n" "${GREEN}Added fastfetch to $rc_file${RC}"
else
printf "%b\n" "${YELLOW}Skipped adding fastfetch to shell config${RC}"
fi
}

checkEnv
checkEscalationTool
installFastfetch
setupFastfetchConfig
setupFastfetchConfig
setupFastfetchShell
Loading