Use POWERLINE_ROOT without additional lookups if set and valid

This commit is contained in:
2025-09-17 20:02:49 -07:00
parent eb6633fc7e
commit 8f2cbb62aa
4 changed files with 75 additions and 59 deletions
+19 -15
View File
@@ -3,10 +3,6 @@ if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -f "$HOME/.dotfiles-dir" ]; then
source "$HOME/.dotfiles-dir"
fi
if [ -f "$HOME/.bash_functions" ]; then
source "$HOME/.bash_functions"
fi
@@ -57,18 +53,26 @@ export EDITOR='vim'
# Powerline
if program_installed powerline; then
POWERLINE_BASH_SOURCES=( $(powerline_bash_sources) )
found=0
for file in "${POWERLINE_BASH_SOURCES[@]}"; do
if [[ -a $file ]]; then
source $file
found=1
break
if [ -n "$POWERLINE_ROOT" ] && \
[ -f "$POWERLINE_ROOT" ] && \
[ -f "$POWERLINE_ROOT/bindings/bash/powerline.sh" ]; then
# Skip lookup if location is known
source "$POWERLINE_ROOT/bindings/bash/powerline.sh"
else
POWERLINE_BASH_SOURCES=( $(powerline_bash_sources) )
found=0
for file in "${POWERLINE_BASH_SOURCES[@]}"; do
if [[ -a $file ]]; then
# TODO: Store the POWERLINE_ROOT in .profile.local if found
source $file
found=1
break
fi
done
if [ $found -eq 0 ]; then
echo "Powerline binding not found."
echo "Please set \$POWERLINE_ROOT in .profile.local"
fi
done
if [ $found -eq 0 ]; then
echo "Powerline binding not found."
echo "Please set \$POWERLINE_ROOT in .profile.local"
fi
fi
+35 -20
View File
@@ -13,32 +13,47 @@ dependencies=(
fortune
)
#PATHs
if [ -d "$HOME/bin" ]; then
export PATH="$PATH:/$HOME/bin"
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$PATH:/$HOME/.local/bin"
fi
if [ -d /usr/games ]; then
export PATH="$PATH:/usr/games"
fi
if [ -d /opt/homebrew/bin ]; then
export PATH="$PATH:/opt/homebrew/bin"
fi
if [ -d /opt/homebrew/opt/python@3.13/libexec/bin ]; then
export PATH="$PATH:/opt/homebrew/opt/python@3.13/libexec/bin"
fi
if [ -d /opt/homebrew/opt/coreutils/libexec/gnubin ]; then
export PATH="$PATH:/opt/homebrew/opt/coreutils/libexec/gnubin"
fi
# Load dotfiles directory into DOTFILES_DIR
# Dotfiles directory should be in environment or ~/.dotfiles-dir
if [ -f "$HOME/.dotfiles-dir" ]; then
source "$HOME/.dotfiles-dir"
fi
# PATHs
## Earlier paths in PATH checked first
if [ -d /usr/games ]; then
export PATH="/usr/games:$PATH"
fi
if [ -d /opt/homebrew/opt/coreutils/libexec/gnubin ]; then
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
fi
if [ -d /opt/homebrew/opt/python@3.13/libexec/bin ]; then
export PATH="/opt/homebrew/opt/python@3.13/libexec/bin:$PATH"
fi
if [ -d /opt/homebrew/bin ]; then
export PATH="/opt/homebrew/bin:$PATH"
fi
## Keep user bin directories first in PATH so they're preferred
if [ -d "$DOTFILES_DIR/bin" ]; then
export PATH="$DOTFILES_DIR/bin:$PATH"
fi
## OS-specific binaries
if [[ $OSTYPE == 'darwin'* ]]; then
if [[ -d "$DOTFILES_DIR/macbin" ]]; then
export PATH="$DOTFILES_DIR/macbin:$PATH"
fi
elif [[ $OSTYPE == 'linux'* ]]; then
if [[ -d "$DOTFILES_DIR/linbin" ]]; then
export PATH="$DOTFILES_DIR/linbin:$PATH"
fi
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -d "$HOME/bin" ]; then
export PATH="$HOME/bin:$PATH"
fi
source "$HOME/.bash_functions"
# Set up brew if on macOS
+21 -11
View File
@@ -158,18 +158,28 @@ if [ -n "$NO_GIT_CHECK" ] && [ ! "$NO_GIT_CHECK" -eq 1 ]; then
fi
fi
set_powerline_zsh_sources
found=0
for file in $POWERLINE_ZSH_SOURCES; do
if [[ -a $file ]]; then
# echo "Sourcing Powerline binding: $file"
source $file
found=1
break
# Powerline
if program_installed powerline; then
if [ -n "$POWERLINE_ROOT" ] && \
[ -f "$POWERLINE_ROOT" ] && \
[ -f "$POWERLINE_ROOT/bindings/zsh/powerline.zsh" ]; then
# Skip lookup if location is known
source "$POWERLINE_ROOT/bindings/zsh/powerline.zsh"
else
found=0
set_powerline_zsh_sources
for file in $POWERLINE_ZSH_SOURCES; do
if [[ -a $file ]]; then
# TODO: Store the POWERLINE_ROOT in .profile.local if found
source $file
found=1
break
fi
done
if [ $found -eq 0 ]; then
echo "Powerline binding not found.\nPlease set \$POWERLINE_ROOT in .profile.local"
fi
fi
done
if [ $found -eq 0 ]; then
echo "Powerline binding not found.\nPlease set \$POWERLINE_ROOT in .profile.local"
fi
# Tool options
-13
View File
@@ -119,9 +119,6 @@ local_home_templates="
zshrc_local
profile.local
"
bin="
startplasma-sway-wayland
"
systemd_services="
"
xsessions="
@@ -229,16 +226,6 @@ function link_dotfiles {
fi
fi
done
for file in $bin; do
if [[ -f bin/$file && -x $file ]]; then
if [[ -f /usr/local/bin/$file ]]; then
echo "Skipping: $file because /usr/local/bin/$file already exists"
else
echo "Copying: $file ($config_dir/bin/$file -> /usr/local/bin/$file)"
sudo cp $config_dir/bin/$file /usr/local/bin/$file
fi
fi
done
for file in $systemd_services; do
if [[ -f systemd/user/$file || -d systemd/user/$file ]]; then
if [[ -L "$HOME/.config/systemd/user/$file" ]]; then