mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-03-03 13:27:12 +00:00
feat(fastfetch-setup): shell integration setup (#1002)
* feat: add shell integration setup for fastfetch * Update fastfetch-setup.sh - improved logic * Update core/tabs/applications-setup/fastfetch-setup.sh Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * Update core/tabs/applications-setup/fastfetch-setup.sh Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * Update core/tabs/applications-setup/fastfetch-setup.sh Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * Update core/tabs/applications-setup/fastfetch-setup.sh Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * Update core/tabs/applications-setup/fastfetch-setup.sh Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * Update fastfetch-setup.sh - added support for other shells * Update fastfetch-setup.sh - fmt * Refactor fastfetch-setup.sh for consistent indentation and formatting --------- Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
parent
7f82c66475
commit
009c8b079a
|
@ -6,20 +6,20 @@ installFastfetch() {
|
|||
if ! command_exists fastfetch; then
|
||||
printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}"
|
||||
case "$PACKAGER" in
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
|
||||
;;
|
||||
apt-get|nala)
|
||||
curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb
|
||||
rm /tmp/fastfetch.deb
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add fastfetch
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
|
||||
;;
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch
|
||||
;;
|
||||
apt-get | nala)
|
||||
curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb
|
||||
rm /tmp/fastfetch.deb
|
||||
;;
|
||||
apk)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" add fastfetch
|
||||
;;
|
||||
*)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}"
|
||||
|
@ -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}"
|
||||
|
||||
current_shell=$(basename "$SHELL")
|
||||
rc_file=""
|
||||
|
||||
case "$current_shell" in
|
||||
"bash")
|
||||
rc_file="$HOME/.bashrc"
|
||||
;;
|
||||
"zsh")
|
||||
rc_file="$HOME/.zshrc"
|
||||
;;
|
||||
"fish")
|
||||
rc_file="$HOME/.config/fish/config.fish"
|
||||
;;
|
||||
"nu")
|
||||
rc_file="$HOME/.config/nushell/config.nu"
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}$current_shell is not supported. Update your shell configuration manually.${RC}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f "$rc_file" ]; then
|
||||
printf "%b\n" "${RED}Shell config file $rc_file not found${RC}"
|
||||
else
|
||||
if grep -q "fastfetch" "$rc_file"; then
|
||||
printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}"
|
||||
return 0
|
||||
else
|
||||
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 shell initialization\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
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installFastfetch
|
||||
setupFastfetchConfig
|
||||
setupFastfetchConfig
|
||||
setupFastfetchShell
|
||||
|
|
Loading…
Reference in New Issue
Block a user