export SHELL_CONFIG="$SHELL_CONFIG:.bashrc" # # ~/.bashrc # # If not running interactively, don't do anything [[ $- != *i* ]] && return export HISTCONTROL=ignoreboth:erasedups [ -f "$HOME/.config/bash/gitstatus/gitstatus.prompt.sh" ] && . "$HOME/.config/bash/gitstatus/gitstatus.prompt.sh" PS1='\t \[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT}\n\[\033[01;$((31+!$?))m\]\$\[\033[00m\] \[\e]0;\u@\h: \w\a\]' # If there are multiple matches for completion, Tab should cycle through them bind TAB:menu-complete # Display a list of the matching files bind "set show-all-if-ambiguous on" # Perform partial (common) completion on the first Tab press, only start # cycling full results on the second Tab press (from bash version 5) bind "set menu-complete-display-prefix on" source ~/.profile export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # https://github.com/skywind3000/z.lua if command -v lua ; then eval "$(lua $HOME/.z.lua/z.lua --init bash enhanced once echo)" fi > /dev/null _mem_available=$(awk '/MemAvailable/ { printf "%.1f \n", $2/1024/1024 }' /proc/meminfo) _updates_available="$(wc -l $HOME/.checkupdates | cut -d' ' -f1)" [ -z $_updates_available ] && _updates_available="0" echo "Remember your commands:" echo " cheat vimv 'flameshot gui' mid3v2 zathura tesseract remmina" echo "" if [ ${_mem_available%.*} -lt 5 ] ; then echo -ne "Memory available: \033[0;33m" [ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0;31m" echo -n "${_mem_available}" echo -e "GB\033[0m" fi if [ $_updates_available -gt 0 ] ; then echo -n "Updates available: " [ $_updates_available -gt 15 ] && echo -ne "\033[0;33m" [ $_updates_available -gt 29 ] && echo -ne "\033[0;31m" echo -ne "$_updates_available\033[0m" echo "" fi echo "" . "$HOME/.config/bash/cheat.bash" if command -v checkupdates ; then (checkupdates > "$HOME/.checkupdates") & disown fi > /dev/null . "$HOME/.cargo/env" alias backup='sudo borgmatic create --verbosity 1 --files' # Function to check for TODO.md and echo its contents function check_todo() { if [ -f "TODO.md" ]; then echo echo -e "\e[91mTODO.md\e[0m" echo "---------------------------" mdcat TODO.md echo "---------------------------" echo fi } # Hook to execute check_todo when changing directories cd() { builtin cd "$@" check_todo } random-bg() { local color='xxx' while getopts ":mrgb" opt; do case $opt in m) muted=true ;; r) color="ffxx" ;; g) color="xffx" ;; b) color="xxff" ;; *) echo "Invalid option: -$OPTARG" >&2 return 1 ;; esac done if [ "$muted" = true ]; then # FIXME sometimes gives 7 digit value # note value of 30 works hue_range=360 # Restricted hue range (0-360 degrees) hue=$((RANDOM % $hue_range)) saturation_range="50-80" # Adjust as needed saturation=$((RANDOM % ($saturation_range + 1) + ${saturation_range%-*})) lightness_range="60-80" # Adjust as needed lightness=$((RANDOM % ($lightness_range + 1) + ${lightness_range%-*})) color=$(printf "%02x%02x%02x" "$hue" "$saturation" "$lightness") else # FIXME: each x is replaced with same value, need a different value for each x color=${color//x/$(openssl rand -hex 1)} fi echo "#$color" xsetroot -solid "#$color" }