style: format shell scripts

This commit is contained in:
github-actions[bot] 2025-02-27 03:28:24 +00:00
parent 8575e2e376
commit e8389b3bd7
9 changed files with 287 additions and 287 deletions

View file

@ -22,154 +22,154 @@ mkdir -p "${HOME}/.local/share/fcitx5/themes"
# Function for downloading files # Function for downloading files
download_file() { download_file() {
local url="$1" local url="$1"
local output_path="$2" local output_path="$2"
local output_dir local output_dir
# Extract directory from output path # Extract directory from output path
output_dir=$(dirname "$output_path") output_dir=$(dirname "$output_path")
# Create directory if it doesn't exist # Create directory if it doesn't exist
if [ ! -d "$output_dir" ]; then if [ ! -d "$output_dir" ]; then
mkdir -p "$output_dir" mkdir -p "$output_dir"
fi fi
# Print status message # Print status message
echo "Downloading: $url" echo "Downloading: $url"
echo " to: $output_path" echo " to: $output_path"
# Download with curl (using -L to follow redirects) # Download with curl (using -L to follow redirects)
if ! curl -L -s --fail "$url" -o "$output_path"; then if ! curl -L -s --fail "$url" -o "$output_path"; then
echo "Error: Failed to download $url" >&2 echo "Error: Failed to download $url" >&2
return 1 return 1
fi fi
# Verify file was downloaded # Verify file was downloaded
if [ ! -f "$output_path" ]; then if [ ! -f "$output_path" ]; then
echo "Error: File was not created at $output_path" >&2 echo "Error: File was not created at $output_path" >&2
return 1 return 1
fi fi
echo "Download successful." echo "Download successful."
return 0 return 0
} }
# Function to check if command exists # Function to check if command exists
command_exists() { command_exists() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
# Install Bat themes # Install Bat themes
if command_exists bat; then if command_exists bat; then
BAT_CONFIG_DIR=$(bat --config-dir 2>/dev/null || echo "${HOME}/.config/bat") BAT_CONFIG_DIR=$(bat --config-dir 2>/dev/null || echo "${HOME}/.config/bat")
mkdir -p "${BAT_CONFIG_DIR}/themes" mkdir -p "${BAT_CONFIG_DIR}/themes"
echo "Installing Bat themes..." echo "Installing Bat themes..."
THEMES=("Latte" "Frappe" "Macchiato" "Mocha") THEMES=("Latte" "Frappe" "Macchiato" "Mocha")
for theme in "${THEMES[@]}"; do for theme in "${THEMES[@]}"; do
download_file "https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20${theme}.tmTheme" \ download_file "https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20${theme}.tmTheme" \
"${BAT_CONFIG_DIR}/themes/Catppuccin ${theme}.tmTheme" "${BAT_CONFIG_DIR}/themes/Catppuccin ${theme}.tmTheme"
done done
echo "Rebuilding Bat cache..." echo "Rebuilding Bat cache..."
bat cache --build || echo "WARNING: Failed to rebuild Bat cache" >&2 bat cache --build || echo "WARNING: Failed to rebuild Bat cache" >&2
else else
echo "Bat not found, skipping Bat themes installation" >&2 echo "Bat not found, skipping Bat themes installation" >&2
fi fi
# Install Tmux plugin # Install Tmux plugin
if command_exists tmux; then if command_exists tmux; then
echo "Installing Tmux plugin..." echo "Installing Tmux plugin..."
TMUX_PLUGIN_DIR="${HOME}/.config/tmux/plugins/catppuccin" TMUX_PLUGIN_DIR="${HOME}/.config/tmux/plugins/catppuccin"
rm -rf "${TMUX_PLUGIN_DIR}" rm -rf "${TMUX_PLUGIN_DIR}"
mkdir -p "${TMUX_PLUGIN_DIR}" mkdir -p "${TMUX_PLUGIN_DIR}"
if command_exists git; then if command_exists git; then
if ! git clone -b v2.1.2 --depth=1 https://github.com/catppuccin/tmux.git "${TMUX_PLUGIN_DIR}/tmux" 2>/dev/null; then if ! git clone -b v2.1.2 --depth=1 https://github.com/catppuccin/tmux.git "${TMUX_PLUGIN_DIR}/tmux" 2>/dev/null; then
echo "WARNING: Failed to clone Tmux plugin repository" >&2 echo "WARNING: Failed to clone Tmux plugin repository" >&2
fi
else
echo "Git not found, skipping Tmux plugin installation" >&2
fi fi
else
echo "Git not found, skipping Tmux plugin installation" >&2
fi
else else
echo "Tmux not found, skipping Tmux plugin installation" >&2 echo "Tmux not found, skipping Tmux plugin installation" >&2
fi fi
# Install Yazi theme # Install Yazi theme
if command_exists yazi; then if command_exists yazi; then
echo "Installing Yazi theme..." echo "Installing Yazi theme..."
download_file "https://raw.githubusercontent.com/catppuccin/yazi/main/themes/mocha/catppuccin-mocha-lavender.toml" \ download_file "https://raw.githubusercontent.com/catppuccin/yazi/main/themes/mocha/catppuccin-mocha-lavender.toml" \
"${HOME}/.config/yazi/theme.toml" "${HOME}/.config/yazi/theme.toml"
else else
echo "Yazi not found, skipping Yazi theme installation" >&2 echo "Yazi not found, skipping Yazi theme installation" >&2
fi fi
# Install BTopa themes # Install BTopa themes
if command_exists btop; then if command_exists btop; then
echo "Installing BTopa themes..." echo "Installing BTopa themes..."
download_file "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_mocha.theme" \ download_file "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_mocha.theme" \
"${HOME}/.config/btop/themes/catppuccin_mocha.theme" "${HOME}/.config/btop/themes/catppuccin_mocha.theme"
download_file "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_latte.theme" \ download_file "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_latte.theme" \
"${HOME}/.config/btop/themes/catppuccin_latte.theme" "${HOME}/.config/btop/themes/catppuccin_latte.theme"
else else
echo "BTopa not found, skipping BTopa themes installation" >&2 echo "BTopa not found, skipping BTopa themes installation" >&2
fi fi
# Install Delta config # Install Delta config
echo "Installing Delta config..." echo "Installing Delta config..."
download_file "https://raw.githubusercontent.com/catppuccin/delta/main/catppuccin.gitconfig" \ download_file "https://raw.githubusercontent.com/catppuccin/delta/main/catppuccin.gitconfig" \
"${HOME}/.config/git/catppuccin-delta.gitconfig" "${HOME}/.config/git/catppuccin-delta.gitconfig"
# Configure FZF # Configure FZF
if command_exists fzf; then if command_exists fzf; then
echo "Configuring FZF..." echo "Configuring FZF..."
# Check shell type to determine how to set environment variables # Check shell type to determine how to set environment variables
if [ -n "${FISH_VERSION:-}" ] || command_exists fish; then if [ -n "${FISH_VERSION:-}" ] || command_exists fish; then
# For Fish shell # For Fish shell
fish -c 'set -U FZF_DEFAULT_OPTS "--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 --color=selected-bg:#45475a --multi"' || fish -c 'set -U FZF_DEFAULT_OPTS "--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 --color=selected-bg:#45475a --multi"' \
echo "WARNING: Failed to set FZF options for Fish shell" >&2 || echo "WARNING: Failed to set FZF options for Fish shell" >&2
else else
# For Bash/Zsh - add to both .bashrc and .zshrc if they exist # For Bash/Zsh - add to both .bashrc and .zshrc if they exist
FZF_CONFIG="export FZF_DEFAULT_OPTS=\"--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 --color=selected-bg:#45475a --multi\"" FZF_CONFIG="export FZF_DEFAULT_OPTS=\"--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc --color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 --color=selected-bg:#45475a --multi\""
# Add to .bashrc if it exists # Add to .bashrc if it exists
if [ -f "${HOME}/.bashrc" ]; then if [ -f "${HOME}/.bashrc" ]; then
if ! grep -q "FZF_DEFAULT_OPTS.*catppuccin" "${HOME}/.bashrc"; then if ! grep -q "FZF_DEFAULT_OPTS.*catppuccin" "${HOME}/.bashrc"; then
echo "${FZF_CONFIG}" >>"${HOME}/.bashrc" echo "${FZF_CONFIG}" >>"${HOME}/.bashrc"
echo "Added FZF configuration to .bashrc" echo "Added FZF configuration to .bashrc"
fi fi
fi
# Add to .zshrc if it exists
if [ -f "${HOME}/.zshrc" ]; then
if ! grep -q "FZF_DEFAULT_OPTS.*catppuccin" "${HOME}/.zshrc"; then
echo "${FZF_CONFIG}" >>"${HOME}/.zshrc"
echo "Added FZF configuration to .zshrc"
fi
fi
fi fi
# Add to .zshrc if it exists
if [ -f "${HOME}/.zshrc" ]; then
if ! grep -q "FZF_DEFAULT_OPTS.*catppuccin" "${HOME}/.zshrc"; then
echo "${FZF_CONFIG}" >>"${HOME}/.zshrc"
echo "Added FZF configuration to .zshrc"
fi
fi
fi
else else
echo "FZF not found, skipping FZF configuration" >&2 echo "FZF not found, skipping FZF configuration" >&2
fi fi
# Install LSD themes # Install LSD themes
if command_exists lsd; then if command_exists lsd; then
echo "Installing LSD themes..." echo "Installing LSD themes..."
download_file "https://raw.githubusercontent.com/catppuccin/lsd/main/themes/catppuccin-mocha/colors.yaml" \ download_file "https://raw.githubusercontent.com/catppuccin/lsd/main/themes/catppuccin-mocha/colors.yaml" \
"${HOME}/.config/lsd/colors.yaml" "${HOME}/.config/lsd/colors.yaml"
download_file "https://raw.githubusercontent.com/catppuccin/lsd/main/themes/catppuccin-latte/colors.yaml" \ download_file "https://raw.githubusercontent.com/catppuccin/lsd/main/themes/catppuccin-latte/colors.yaml" \
"${HOME}/.config/lsd/colors-light.yaml" "${HOME}/.config/lsd/colors-light.yaml"
else else
echo "LSD not found, skipping LSD themes installation" >&2 echo "LSD not found, skipping LSD themes installation" >&2
fi fi
# Install Midnight Commander skin # Install Midnight Commander skin
echo "Installing Midnight Commander skin..." echo "Installing Midnight Commander skin..."
download_file "https://raw.githubusercontent.com/catppuccin/mc/main/catppuccin.ini" \ download_file "https://raw.githubusercontent.com/catppuccin/mc/main/catppuccin.ini" \
"${HOME}/.local/share/mc/skins/catppuccin.ini" "${HOME}/.local/share/mc/skins/catppuccin.ini"
# Print MC configuration hint # Print MC configuration hint
echo "Note: To use the Midnight Commander theme:" echo "Note: To use the Midnight Commander theme:"
@ -179,51 +179,51 @@ echo " - Save setup through F9 > Options > Save setup"
# Install PowerShell module # Install PowerShell module
if command_exists pwsh; then if command_exists pwsh; then
echo "Installing PowerShell module..." echo "Installing PowerShell module..."
PS_MODULE_PATH=$(pwsh -C 'Write-Output $Env:PSModulePath.split(":")[0]' 2>/dev/null) PS_MODULE_PATH=$(pwsh -C 'Write-Output $Env:PSModulePath.split(":")[0]' 2>/dev/null)
if [ -n "${PS_MODULE_PATH}" ]; then if [ -n "${PS_MODULE_PATH}" ]; then
if command_exists git; then if command_exists git; then
if ! git clone --depth=1 https://github.com/catppuccin/powershell.git "${PS_MODULE_PATH}/Catppuccin" 2>/dev/null; then if ! git clone --depth=1 https://github.com/catppuccin/powershell.git "${PS_MODULE_PATH}/Catppuccin" 2>/dev/null; then
echo "WARNING: Failed to clone PowerShell module repository" >&2 echo "WARNING: Failed to clone PowerShell module repository" >&2
fi fi
else
echo "Git not found, skipping PowerShell module installation" >&2
fi
else else
echo "PowerShell module path not found, skipping PowerShell module installation" >&2 echo "Git not found, skipping PowerShell module installation" >&2
fi fi
else
echo "PowerShell module path not found, skipping PowerShell module installation" >&2
fi
else else
echo "PowerShell not found, skipping PowerShell module installation" >&2 echo "PowerShell not found, skipping PowerShell module installation" >&2
fi fi
# Install Fish themes # Install Fish themes
if command_exists fish; then if command_exists fish; then
echo "Installing Fish themes..." echo "Installing Fish themes..."
download_file "https://raw.githubusercontent.com/catppuccin/fish/main/themes/Catppuccin%20Mocha.theme" \ download_file "https://raw.githubusercontent.com/catppuccin/fish/main/themes/Catppuccin%20Mocha.theme" \
"${HOME}/.config/fish/themes/Catppuccin Mocha.theme" "${HOME}/.config/fish/themes/Catppuccin Mocha.theme"
download_file "https://raw.githubusercontent.com/catppuccin/fish/main/themes/Catppuccin%20Latte.theme" \ download_file "https://raw.githubusercontent.com/catppuccin/fish/main/themes/Catppuccin%20Latte.theme" \
"${HOME}/.config/fish/themes/Catppuccin Latte.theme" "${HOME}/.config/fish/themes/Catppuccin Latte.theme"
else else
echo "Fish not found, skipping Fish themes installation" >&2 echo "Fish not found, skipping Fish themes installation" >&2
fi fi
# Install Fcitx5 themes # Install Fcitx5 themes
if command_exists fcitx5; then if command_exists fcitx5; then
echo "Installing Fcitx5 themes..." echo "Installing Fcitx5 themes..."
rm -rf "${TEMP_DIR}/fcitx5" rm -rf "${TEMP_DIR}/fcitx5"
if command_exists git; then if command_exists git; then
if git clone --depth=1 https://github.com/catppuccin/fcitx5.git "${TEMP_DIR}/fcitx5" 2>/dev/null; then if git clone --depth=1 https://github.com/catppuccin/fcitx5.git "${TEMP_DIR}/fcitx5" 2>/dev/null; then
cp -r "${TEMP_DIR}/fcitx5/src/"* "${HOME}/.local/share/fcitx5/themes/" cp -r "${TEMP_DIR}/fcitx5/src/"* "${HOME}/.local/share/fcitx5/themes/"
else
echo "WARNING: Failed to clone Fcitx5 repository" >&2
fi
else else
echo "Git not found, skipping Fcitx5 themes installation" >&2 echo "WARNING: Failed to clone Fcitx5 repository" >&2
fi fi
else
echo "Git not found, skipping Fcitx5 themes installation" >&2
fi
else else
echo "Fcitx5 not found, skipping Fcitx5 themes installation" >&2 echo "Fcitx5 not found, skipping Fcitx5 themes installation" >&2
fi fi
# Clean up temporary directory # Clean up temporary directory

View file

@ -29,74 +29,74 @@ test -d ~/.local/state/zsh || mkdir -p ~/.local/state/zsh
declare -A linkDots declare -A linkDots
linkDots=( linkDots=(
["$DOTFILES/common/condarc.yaml"]="$XDG_CONFIG_HOME/conda/.condarc" ["$DOTFILES/common/condarc.yaml"]="$XDG_CONFIG_HOME/conda/.condarc"
# ["$DOTFILES/common/gitconfig"]="$XDG_CONFIG_HOME/git/config" # ["$DOTFILES/common/gitconfig"]="$XDG_CONFIG_HOME/git/config"
["$DOTFILES/common/glow.yaml"]="$HOME/.config/glow/config.yml" ["$DOTFILES/common/glow.yaml"]="$HOME/.config/glow/config.yml"
["$DOTFILES/common/haskeline"]="$HOME/.haskeline" ["$DOTFILES/common/haskeline"]="$HOME/.haskeline"
["$DOTFILES/common/ideavimrc"]="$XDG_CONFIG_HOME/ideavim/ideavimrc" ["$DOTFILES/common/ideavimrc"]="$XDG_CONFIG_HOME/ideavim/ideavimrc"
["$DOTFILES/common/lazygit.yaml"]="$XDG_CONFIG_HOME/lazygit/config.yml" ["$DOTFILES/common/lazygit.yaml"]="$XDG_CONFIG_HOME/lazygit/config.yml"
["$DOTFILES/common/lesskey"]="$XDG_CONFIG_HOME/lesskey" ["$DOTFILES/common/lesskey"]="$XDG_CONFIG_HOME/lesskey"
["$DOTFILES/common/npmrc"]="$NPM_CONFIG_USERCONFIG" ["$DOTFILES/common/npmrc"]="$NPM_CONFIG_USERCONFIG"
["$DOTFILES/common/NuGet.Config"]="$XDG_CONFIG_HOME/NuGet/NuGet.Config" ["$DOTFILES/common/NuGet.Config"]="$XDG_CONFIG_HOME/NuGet/NuGet.Config"
["$DOTFILES/common/pip.conf"]="$XDG_CONFIG_HOME/pip/pip.conf" ["$DOTFILES/common/pip.conf"]="$XDG_CONFIG_HOME/pip/pip.conf"
["$DOTFILES/common/starship.toml"]="$HOME/.config/starship.toml" ["$DOTFILES/common/starship.toml"]="$HOME/.config/starship.toml"
["$DOTFILES/common/tmux.conf"]="$XDG_CONFIG_HOME/tmux/tmux.conf" ["$DOTFILES/common/tmux.conf"]="$XDG_CONFIG_HOME/tmux/tmux.conf"
["$DOTFILES/common/vimrc"]="$XDG_CONFIG_HOME/vim/vimrc" ["$DOTFILES/common/vimrc"]="$XDG_CONFIG_HOME/vim/vimrc"
["$DOTFILES/common/zellij.config.kdl"]="$HOME/.config/zellij/config.kdl" ["$DOTFILES/common/zellij.config.kdl"]="$HOME/.config/zellij/config.kdl"
# ["$DOTFILES/tools/emacs.d"]="$HOME/.emacs.d" # ["$DOTFILES/tools/emacs.d"]="$HOME/.emacs.d"
["$DOTFILES/tools/doom"]="$HOME/.config/doom" ["$DOTFILES/tools/doom"]="$HOME/.config/doom"
["$DOTFILES/tools/fish"]="$HOME/.config/fish" ["$DOTFILES/tools/fish"]="$HOME/.config/fish"
["$DOTFILES/tools/ipython"]="$XDG_CONFIG_HOME/ipython" ["$DOTFILES/tools/ipython"]="$XDG_CONFIG_HOME/ipython"
["$DOTFILES/tools/nvim"]="$XDG_CONFIG_HOME/nvim" ["$DOTFILES/tools/nvim"]="$XDG_CONFIG_HOME/nvim"
["$DOTFILES/tools/yazi"]="$HOME/.config/yazi" ["$DOTFILES/tools/yazi"]="$HOME/.config/yazi"
["$DOTFILES/tools/zsh/zshrc"]="$ZDOTDIR/.zshrc" ["$DOTFILES/tools/zsh/zshrc"]="$ZDOTDIR/.zshrc"
["$DOTFILES/tools/zsh/zshenv"]="$ZDOTDIR/.zshenv" ["$DOTFILES/tools/zsh/zshenv"]="$ZDOTDIR/.zshenv"
["$DOTFILES/platforms/mac/pwshProfile.ps1"]="$HOME/.config/powershell/Microsoft.PowerShell_profile.ps1" ["$DOTFILES/platforms/mac/pwshProfile.ps1"]="$HOME/.config/powershell/Microsoft.PowerShell_profile.ps1"
) )
if [ $(uname) = "Darwin" ]; then if [ $(uname) = "Darwin" ]; then
echo "[INFO] Running on macOS" echo "[INFO] Running on macOS"
linkDots+=( linkDots+=(
["$DOTFILES/platforms/mac/karabiner"]="$HOME/.config/karabiner" ["$DOTFILES/platforms/mac/karabiner"]="$HOME/.config/karabiner"
["$DOTFILES/platforms/mac/skhdrc"]="$XDG_CONFIG_HOME/skhd/skhdrc" ["$DOTFILES/platforms/mac/skhdrc"]="$XDG_CONFIG_HOME/skhd/skhdrc"
["$DOTFILES/platforms/mac/sketchybarrc"]="$XDG_CONFIG_HOME/sketchybar/sketchybarrc" ["$DOTFILES/platforms/mac/sketchybarrc"]="$XDG_CONFIG_HOME/sketchybar/sketchybarrc"
["$DOTFILES/platforms/mac/yabairc"]="$XDG_CONFIG_HOME/yabai/yabairc" ["$DOTFILES/platforms/mac/yabairc"]="$XDG_CONFIG_HOME/yabai/yabairc"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm" ["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/zed"]="$HOME/.config/zed" ["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek" ["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek"
) )
else else
echo "[INFO] Running on Linux" echo "[INFO] Running on Linux"
linkDots+=(
["$DOTFILES/common/inputrc"]="$HOME/.inputrc"
)
# WSL1 : Microsoft
# WSL2 : microsoft
# if [ "$(uname -r)" = *icrosoft* ]; then
# echo "[INFO] Running on WSL"
# : # NOP
if [ "$GUI_SETUP" -eq 1 ]; then
echo "[INFO] Setting up Linux GUI Applications"
linkDots+=( linkDots+=(
["$DOTFILES/common/inputrc"]="$HOME/.inputrc" ["$DOTFILES/platforms/linux/awesome"]="$HOME/.config/awesome"
["$DOTFILES/platforms/linux/hypr"]="$HOME/.config/hypr"
["$DOTFILES/platforms/linux/waybar"]="$HOME/.config/waybar"
["$DOTFILES/platforms/linux/wlogout"]="$HOME/.config/wlogout"
["$DOTFILES/platforms/linux/mako-config"]="$HOME/.config/mako/config"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek"
) )
# WSL1 : Microsoft for kde in "$DOTFILES/platforms/linux/kde/"*; do
# WSL2 : microsoft linkDots+=["$kde"]="$HOME/.config/kde/$(basename "$kde")"
# if [ "$(uname -r)" = *icrosoft* ]; then # echo "Linking $kde to $HOME/.config/kde/$(basename $kde)"
# echo "[INFO] Running on WSL" done
# : # NOP if [ "$WHEEL" -eq 1 ]; then
if [ "$GUI_SETUP" -eq 1 ]; then echo "[INFO] Setting up system environment variables"
echo "[INFO] Setting up Linux GUI Applications" echo "[ACTION] Elevation required!"
linkDots+=( sudo cp "$DOTFILES/platforms/linux/etc/environment" "/etc/environment"
["$DOTFILES/platforms/linux/awesome"]="$HOME/.config/awesome"
["$DOTFILES/platforms/linux/hypr"]="$HOME/.config/hypr"
["$DOTFILES/platforms/linux/waybar"]="$HOME/.config/waybar"
["$DOTFILES/platforms/linux/wlogout"]="$HOME/.config/wlogout"
["$DOTFILES/platforms/linux/mako-config"]="$HOME/.config/mako/config"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek"
)
for kde in "$DOTFILES/platforms/linux/kde/"*; do
linkDots+=["$kde"]="$HOME/.config/kde/$(basename "$kde")"
# echo "Linking $kde to $HOME/.config/kde/$(basename $kde)"
done
if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Setting up system environment variables"
echo "[ACTION] Elevation required!"
sudo cp "$DOTFILES/platforms/linux/etc/environment" "/etc/environment"
fi
fi fi
fi
fi fi
echo "[INFO] Copying example files" echo "[INFO] Copying example files"

View file

@ -8,17 +8,17 @@ echo "[ACTION] Press any key to proceed"
read -n 1 read -n 1
if [ "$WHEEL" -eq 1 ]; then if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Setting up system-wide zsh configuration" echo "[INFO] Setting up system-wide zsh configuration"
echo "[ACTION] Elevation required" echo "[ACTION] Elevation required"
test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zsh/zshenv" test -f "/etc/zsh/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zsh/zshenv"
test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv" test -f "/etc/zshenv" && sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv"
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv" sudo cp "$DOTFILES/tools/zsh/global.zshenv" "/etc/zshenv"
fi fi
else else
echo "[INFO] Setting up user zsh configuration" echo "[INFO] Setting up user zsh configuration"
# A fallback case to set $ZDOTDIR in ~/.zshenv if the user cannot access global zshenv # A fallback case to set $ZDOTDIR in ~/.zshenv if the user cannot access global zshenv
ln -sf "$DOTFILES/tools/zsh/zshenv" "$HOME/.zshenv" ln -sf "$DOTFILES/tools/zsh/zshenv" "$HOME/.zshenv"
fi fi
echo "[INFO] Installing zsh plugins" echo "[INFO] Installing zsh plugins"

View file

@ -7,6 +7,6 @@ wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/AM-INSTALLER && chmod
APPMAN_PATH="$HOME/.local/bin/appman" APPMAN_PATH="$HOME/.local/bin/appman"
if command -v "$APPMAN_PATH" >/dev/null 2>&1; then if command -v "$APPMAN_PATH" >/dev/null 2>&1; then
$APPMAN_PATH install wezterm $APPMAN_PATH install wezterm
$APPMAN_PATH install nvim $APPMAN_PATH install nvim
fi fi

View file

@ -13,34 +13,34 @@ ELECTRON_FLAG=$DOTFILES/platforms/linux/electron-flags.conf
# Browser Flags # Browser Flags
browser_flags_path=( browser_flags_path=(
"$XDG_CONFIG_HOME/chromium-flags.conf" # Chromium "$XDG_CONFIG_HOME/chromium-flags.conf" # Chromium
"$XDG_CONFIG_HOME/chrome-flags.conf" # Google Chrome "$XDG_CONFIG_HOME/chrome-flags.conf" # Google Chrome
"$XDG_CONFIG_HOME/thorium-flags.conf" # Thorium "$XDG_CONFIG_HOME/thorium-flags.conf" # Thorium
"$XDG_CONFIG_HOME/vivaldi-flags.conf" # Vivaldi "$XDG_CONFIG_HOME/vivaldi-flags.conf" # Vivaldi
"$XDG_CONFIG_HOME/vivaldi-stable.conf" # Vivaldi "$XDG_CONFIG_HOME/vivaldi-stable.conf" # Vivaldi
) )
electron_flags_path=( electron_flags_path=(
"$XDG_CONFIG_HOME/electron-flags.conf" # General "$XDG_CONFIG_HOME/electron-flags.conf" # General
"$XDG_CONFIG_HOME/code-flags.conf" # VSCode "$XDG_CONFIG_HOME/code-flags.conf" # VSCode
"$XDG_CONFIG_HOME/qq-electron-flags.conf" # Slack "$XDG_CONFIG_HOME/qq-electron-flags.conf" # Slack
) )
for path in "${browser_flags_path[@]}"; do for path in "${browser_flags_path[@]}"; do
if [ -f "$path" ]; then if [ -f "$path" ]; then
echo "[INFO] Found Browser Flags: $path" echo "[INFO] Found Browser Flags: $path"
else else
echo "[INFO] Creating Browser Flags: $path" echo "[INFO] Creating Browser Flags: $path"
ln -s "$BROWSER_FLAG" "$path" ln -s "$BROWSER_FLAG" "$path"
fi fi
done done
for path in "${electron_flags_path[@]}"; do for path in "${electron_flags_path[@]}"; do
if [ -f "$path" ]; then if [ -f "$path" ]; then
echo "[INFO] Found Electron Flags: $path" echo "[INFO] Found Electron Flags: $path"
else else
echo "[INFO] Creating Electron Flags: $path" echo "[INFO] Creating Electron Flags: $path"
ln -s "$ELECTRON_FLAG" "$path" ln -s "$ELECTRON_FLAG" "$path"
fi fi
done done

View file

@ -14,9 +14,9 @@ WHEEL=0
groups "$(whoami)" | grep -E -q '\b(sudo|wheel)\b' && WHEEL=1 groups "$(whoami)" | grep -E -q '\b(sudo|wheel)\b' && WHEEL=1
if [ "$WHEEL" -eq 1 ]; then if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Running as sudo or wheel group" echo "[INFO] Running as sudo or wheel group"
else else
echo "[INFO] Not running as sudo or wheel group" echo "[INFO] Not running as sudo or wheel group"
fi fi
export WHEEL export WHEEL
@ -29,19 +29,19 @@ PACKAGE_MANAGER=""
# NOTE: This is NOT a POSIX-compliant way, for POSIX-compliant way, use case/esac # NOTE: This is NOT a POSIX-compliant way, for POSIX-compliant way, use case/esac
if [[ "$(uname -r)" = *Microsoft* ]]; then if [[ "$(uname -r)" = *Microsoft* ]]; then
echo "[INFO] Running on WSL1 Skipping GUI setup" echo "[INFO] Running on WSL1 Skipping GUI setup"
IS_WSL=1 IS_WSL=1
WINDOWS_USER="$(cmd.exe /c "echo %USERNAME%" | tr -d '\r')" WINDOWS_USER="$(cmd.exe /c "echo %USERNAME%" | tr -d '\r')"
else else
read -p "[ACTION] Do you want to setup Linux GUI? (y/N) " -r choice read -p "[ACTION] Do you want to setup Linux GUI? (y/N) " -r choice
case "$choice" in case "$choice" in
y | Y) y | Y)
GUI_SETUP=1 GUI_SETUP=1
;; ;;
*) *)
echo "[INFO] Skipping GUI setup" echo "[INFO] Skipping GUI setup"
;; ;;
esac esac
fi fi
export GUI_SETUP export GUI_SETUP
@ -49,45 +49,45 @@ export GUI_SETUP
# base-devel # base-devel
if [ "$WHEEL" -eq 1 ]; then if [ "$WHEEL" -eq 1 ]; then
echo "[INFO] Installing basic build tools" echo "[INFO] Installing basic build tools"
if command -v apt >/dev/null 2>&1; then if command -v apt >/dev/null 2>&1; then
sudo apt update sudo apt update
sudo apt install -y build-essential sudo apt install -y build-essential
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
elif command -v pacman >/dev/null 2>&1; then elif command -v pacman >/dev/null 2>&1; then
sudo pacman -Syu --noconfirm sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm base-devel sudo pacman -S --noconfirm base-devel
PACKAGE_MANAGER="pacman" PACKAGE_MANAGER="pacman"
else else
echo "[ERROR] Unsupported package manager" echo "[ERROR] Unsupported package manager"
exit 1 exit 1
fi fi
fi fi
echo "[INFO] Cloning Dotfiles" echo "[INFO] Cloning Dotfiles"
if [ -d "$DOTFILES" ]; then if [ -d "$DOTFILES" ]; then
echo "[INFO] Dotfiles already cloned" echo "[INFO] Dotfiles already cloned"
elif [ "$IS_WSL" -eq 1 ]; then elif [ "$IS_WSL" -eq 1 ]; then
ln -sf "/mnt/c/Users/$WINDOWS_USER/.dotfiles" "$DOTFILES" ln -sf "/mnt/c/Users/$WINDOWS_USER/.dotfiles" "$DOTFILES"
elif command -v git >/dev/null 2>&1; then elif command -v git >/dev/null 2>&1; then
git clone https://github.com/js0ny/dotfiles.git "$DOTFILES" --depth 1 git clone https://github.com/js0ny/dotfiles.git "$DOTFILES" --depth 1
else else
echo "[ERROR] Git is not installed" echo "[ERROR] Git is not installed"
exit 1 exit 1
fi fi
if [ "$WHEEL" -eq 0 ]; then if [ "$WHEEL" -eq 0 ]; then
read -p "[ACTION] Do you want to install some AppImages (by AppMan)? (y/N) " -r choice read -p "[ACTION] Do you want to install some AppImages (by AppMan)? (y/N) " -r choice
case "$choice" in case "$choice" in
y | Y) y | Y)
source "$DOTFILES/bootstrap/linux/appman.bash" source "$DOTFILES/bootstrap/linux/appman.bash"
;; ;;
*) *)
echo "[INFO] Skipping AppMan installation" echo "[INFO] Skipping AppMan installation"
: :
;; ;;
esac esac
fi fi
echo "[INFO] Setting up symbolic links" echo "[INFO] Setting up symbolic links"
@ -95,8 +95,8 @@ echo "[INFO] Setting up symbolic links"
source "$DOTFILES"/bootstrap/linux/symlinks.bash source "$DOTFILES"/bootstrap/linux/symlinks.bash
if [ "$WHEEL" -eq 1 ]; then if [ "$WHEEL" -eq 1 ]; then
source "$DOTFILES"/tools/bash/xdg-compact.sh source "$DOTFILES"/tools/bash/xdg-compact.sh
source "$DOTFILES"/tools/bash/global.bashrc source "$DOTFILES"/tools/bash/global.bashrc
fi fi
source "$DOTFILES"/tools/bash/profile source "$DOTFILES"/tools/bash/profile
source "$DOTFILES"/tools/bash/bashrc source "$DOTFILES"/tools/bash/bashrc
@ -104,29 +104,29 @@ source "$DOTFILES"/tools/bash/bash_aliases
if command -v zsh >/dev/null 2>&1; then if command -v zsh >/dev/null 2>&1; then
read -p "[ACTION] Do you want to setup zsh? (Y/n) " -r choice read -p "[ACTION] Do you want to setup zsh? (Y/n) " -r choice
case "$choice" in case "$choice" in
n | N) n | N)
: :
;; ;;
*) *)
source "$DOTFILES"/bootstrap/components/zsh.sh source "$DOTFILES"/bootstrap/components/zsh.sh
;; ;;
esac esac
fi fi
if [ "$WHEEL" -eq 0 ]; then if [ "$WHEEL" -eq 0 ]; then
echo "Done!" echo "Done!"
exit 0 exit 0
fi fi
# TODO: Add this part # TODO: Add this part
read -p "[ACTION] Do you want to use other package managers? (y/N) " -r choice read -p "[ACTION] Do you want to use other package managers? (y/N) " -r choice
case "$choice" in case "$choice" in
y | Y) y | Y)
: :
;; ;;
*) *)
: :
;; ;;
esac esac
@ -137,18 +137,18 @@ source "$DOTFILES"/bootstrap/components/emacs.sh
# TODO: Untestest # TODO: Untestest
if [ "$IS_WSL" -eq 1 ]; then if [ "$IS_WSL" -eq 1 ]; then
ln -sf "/mnt/c/Users/$WINDOWS_USER" "$HOME/winhome" ln -sf "/mnt/c/Users/$WINDOWS_USER" "$HOME/winhome"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Downloads" "$HOME/Downloads" ln -sf "/mnt/c/Users/$WINDOWS_USER/Downloads" "$HOME/Downloads"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Documents" "$HOME/Documents" ln -sf "/mnt/c/Users/$WINDOWS_USER/Documents" "$HOME/Documents"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Desktop" "$HOME/Desktop" ln -sf "/mnt/c/Users/$WINDOWS_USER/Desktop" "$HOME/Desktop"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Pictures" "$HOME/Pictures" ln -sf "/mnt/c/Users/$WINDOWS_USER/Pictures" "$HOME/Pictures"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Music" "$HOME/Music" ln -sf "/mnt/c/Users/$WINDOWS_USER/Music" "$HOME/Music"
ln -sf "/mnt/c/Users/$WINDOWS_USER/Videos" "$HOME/Videos" ln -sf "/mnt/c/Users/$WINDOWS_USER/Videos" "$HOME/Videos"
fi fi
if [ "$GUI_SETUP" -eq 0 ]; then if [ "$GUI_SETUP" -eq 0 ]; then
echo "Done!" echo "Done!"
exit 0 exit 0
fi fi
# Wayland # Wayland

View file

@ -14,16 +14,16 @@ read -r -n1 -s
echo "[INFO] Setting up symbolic links" echo "[INFO] Setting up symbolic links"
for src in "${!linkDots[@]}"; do for src in "${!linkDots[@]}"; do
dest="${linkDots[$src]}" dest="${linkDots[$src]}"
echo "Linking $src to $dest" echo "Linking $src to $dest"
if [ -d "$src" ]; then if [ -d "$src" ]; then
test -d "$dest" && mv "$dest" "$dest.bak" test -d "$dest" && mv "$dest" "$dest.bak"
ln -sf "$src" "$dest" ln -sf "$src" "$dest"
elif [ -f "$src" ]; then elif [ -f "$src" ]; then
dest_parent=$(dirname "$dest") dest_parent=$(dirname "$dest")
test -d "$dest_parent" || mkdir -p "$dest_parent" test -d "$dest_parent" || mkdir -p "$dest_parent"
ln -sf "$src" "$dest" ln -sf "$src" "$dest"
else else
echo "[ERROR] $src does not exist" echo "[ERROR] $src does not exist"
fi fi
done done

View file

@ -0,0 +1 @@

View file

@ -3,14 +3,13 @@
# Author: js0ny # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# Define __CD_CMD as "cd" by default # Define __CD_CMD as "cd" by default
__CD_CMD="cd" __CD_CMD="cd"
# If zoxide is available, use it # If zoxide is available, use it
if command -v zoxide >/dev/null; then if command -v zoxide >/dev/null; then
__CD_CMD="z" __CD_CMD="z"
eval "$(zoxide init zsh)" eval "$(zoxide init zsh)"
fi fi
# Define aliases for quick navigation # Define aliases for quick navigation
@ -25,7 +24,7 @@ alias - "$__CD_CMD -"
# Define zls function for cd + ls # Define zls function for cd + ls
zls() { zls() {
"$__CD_CMD" "$1" && ls "$__CD_CMD" "$1" && ls
} }
alias cdls=zls alias cdls=zls