mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
ItsDrike
3b5ac91ae8
Without existence check, the `find` command prints a fail message to stderr, and leaves stdout empty. This means only the prefix `:` is appended to the `$PATH` variable. Leaving a trailing `:` in `$PATH` is however something we really don't want to be doing, as it makes the current directory get treated as a part of `$PATH`. While the `~/.local/bin` directory is generally going to exist, during installation and in some other edge cases, it might not yet be there, and we need to account for that.
31 lines
931 B
Bash
Executable file
31 lines
931 B
Bash
Executable file
#!/bin/zsh
|
|
|
|
# User .profile definition.
|
|
# This file is only sourced once, after login, Unlike
|
|
# .zshrc/.bashrc, which will run whenever a new terminal
|
|
# is opened.
|
|
|
|
# Add all folders in ~/.local/bin into PATH
|
|
# Some window managers require this line to be in profile
|
|
# not in .zshenv
|
|
if [ -d "$HOME/.local/bin" ]; then
|
|
PATH+=":${$(find -L ~/.local/bin -type d | tr '\n' ':')%%:}"
|
|
fi
|
|
|
|
if [ -d "$HOME/.local/share/pyenv/shims" ]; then
|
|
PATH+=":$HOME/.local/share/pyenv/shims"
|
|
fi
|
|
|
|
if [ -d "$HOME/.local/share/npm/bin" ]; then
|
|
PATH+=":$HOME/.local/share/npm/bin"
|
|
fi
|
|
|
|
# Start graphical session automatically on tty1 if Hyprland or startx is available
|
|
if [ "$(tty)" = "/dev/tty1" ] && [ "$UID" != 0 ]; then
|
|
if command -v Hyprland >/dev/null; then
|
|
! pidof -s Hyprland >/dev/null 2>&1 && launch-hypr
|
|
elif command -v startx >/dev/null; then
|
|
! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
|
|
fi
|
|
fi
|