126 lines
4 KiB
Bash
126 lines
4 KiB
Bash
#!/bin/sh
|
|
|
|
case $- in
|
|
*i*) ;;
|
|
*) return;;
|
|
esac
|
|
|
|
PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/scripts/menu/xclipmenu${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/scripts/sway${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/scripts/dwm${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/wrappers${PATH:+:${PATH}}"
|
|
PATH="$HOME/.config/scripts${PATH:+:${PATH}}"
|
|
PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
|
#PATH="/usr/local/plan9/bin${PATH:+:${PATH}}"
|
|
|
|
git_branch() {
|
|
GIT_BRANCH="$(git branch 2>/dev/null | sed '/\*/!d;s/^\*\s*//g;s/\s*$//g')"
|
|
[ -n "$GIT_BRANCH" ] && printf " %s " "$GIT_BRANCH"
|
|
}
|
|
|
|
padding() {
|
|
text="$@"
|
|
len="${#text}"
|
|
tput cuf 1
|
|
tput cub "$((len - 1))"
|
|
printf '%s' "$text"
|
|
tput cub "$len"
|
|
}
|
|
|
|
short_time() {
|
|
TIME="$(date)"
|
|
TIME="${TIME% CST*}"
|
|
TIME="${TIME% [AP]M*}"
|
|
TIME="${TIME##* }"
|
|
TIME="${TIME%:[0-9]*}"
|
|
printf '%s' "$TIME"
|
|
}
|
|
|
|
short_path() {
|
|
curr_path="$(pwd | sed 's/\/data\/data\/com.termux\/files\/home/~/g;s/\/home\/[A-Za-z]*/~/g')"
|
|
if [ "${#curr_path}" -gt 10 ] ; then
|
|
curr_path="${curr_path##*/}"
|
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; then
|
|
curr_proj="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
curr_proj="${curr_proj##*/}"
|
|
if [ "$curr_proj" ] && [ "$curr_path" != "$curr_proj" ] ; then
|
|
[ -d "../../$curr_proj/$curr_path" ] &&
|
|
curr_path="$curr_proj/$curr_path" ||
|
|
curr_path="$curr_proj/⋯/$curr_path"
|
|
fi
|
|
fi
|
|
curr_path="⋯/$curr_path"
|
|
fi
|
|
printf '%s' "$curr_path"
|
|
}
|
|
|
|
[ -e "/data/data/com.termux" ] && HOSTNAME=""
|
|
[ "${HOSTNAME:=$(hostname -s)}" = "laptop" ] && HOSTNAME=""
|
|
[ "${HOSTNAME:=$(hostname -s)}" = "desktop" ] && HOSTNAME=""
|
|
|
|
PS1='
|
|
$(tput setaf 240)╭─$(tput setaf 7)$(tput setab 7)$(tput setaf 238)$?\
|
|
$(tput setaf 7)$(tput setab 108)\
|
|
$(tput setaf 235)$(tput setab 108) \
|
|
${HOSTNAME} \
|
|
$(tput setaf 108)$(tput setab 66) \
|
|
$(tput setab 66)$(tput setaf 235)$(short_path) $(tput sgr0)\
|
|
$(tput setaf 66)\
|
|
$(tput sgr0)$(tput cr)$(tput cuf $(tput cols))\
|
|
$(tput setaf 236)$(padding " ")$(tput setab 236)$(tput setaf 240)$(padding " $(short_time) ")$(tput sgr0)\
|
|
$(tput bold)$(tput setab 236)$(tput setaf 5)$(padding " $(git_branch)")$(tput sgr0)\
|
|
$(tput setaf 236)$(tput sgr0)
|
|
$(tput setaf 240)╰─\$$(tput sgr0) \
|
|
'
|
|
|
|
alias \
|
|
wget="wget --hsts-file=$XDG_DATA_HOME/wget/wget-hsts"
|
|
|
|
! command -v sudo >/dev/null 2>&1 && alias sudo="doas"
|
|
|
|
alias \
|
|
src="cd $HOME/.local/src/ && ls" \
|
|
cfg="cd $HOME/.config/ && ls" \
|
|
tmp="cd $HOME/Desktop/temp/ && ls" \
|
|
dsk="cd $HOME/Desktop/ && ls" \
|
|
prj="cd $HOME/Desktop/projects/ && ls" \
|
|
doc="cd $HOME/Documents/ && ls" \
|
|
dow="cd $HOME/Downloads/ && ls" \
|
|
mus="cd $HOME/Music/ && ls" \
|
|
prt="cd $HOME/Pictures/Screenshots/ && ls" \
|
|
bkg="cd $HOME/Pictures/Backgrounds/ && ls" \
|
|
img="cd $HOME/Pictures/ && ls" \
|
|
vid="cd $HOME/Videos/ && ls" \
|
|
|
|
command -v exa >/dev/null 2>&1 && alias ls="exa -al --icons --group-directories-first --no-permissions --no-user --time-style=iso --git" \
|
|
command -v eza >/dev/null 2>&1 && alias ls="eza -al --icons --group-directories-first --no-permissions --no-user --time-style=iso --git" \
|
|
command -v trash >/dev/null 2>&1 && alias rm="trash" \
|
|
|
|
alias \
|
|
fzf="fzf --cycle --reverse" \
|
|
diff="diff --color=auto" \
|
|
grep="grep --color=auto" \
|
|
calc="bc -l" \
|
|
cp="cp -iv" \
|
|
mv="mv -iv" \
|
|
rm="trash" \
|
|
vim="nvim" \
|
|
mgr-all="mgr pacman_upgrade apt_upgrade flatpak_update distrobox_update pip_update configs passmgr" \
|
|
df-short="df -h | grep -v '\s/dev.*$\|\s/run.*$\|\s/boot.*$'" \
|
|
qr-png="qrencode -s 16 -o qr.png" \
|
|
qr="qrencode -t ansiutf8" \
|
|
clip="xsel -ib" \
|
|
|
|
[ -f ~/.config/shell/env ] && . ~/.config/shell/env
|
|
[ -f ~/.config/shell/kit ] && . ~/.config/shell/kit
|
|
|
|
if [ "$(tty)" = "/dev/tty1" ] ; then
|
|
sleep 0.5
|
|
amixer &
|
|
exec startx
|
|
# exec sway
|
|
fi
|
|
|
|
command -v fetch >/dev/null 2>&1 && fetch min
|