-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc
executable file
·53 lines (47 loc) · 1.28 KB
/
bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\[\e[1;36m\]\u\[\e[m\]@\[\e[1;32m\]\h \[\e[1;31m\]\W\[\e[m\]]$ '
if [[ -z $DISPLAY ]] && [[ "$(tty)" = /dev/tty1 ]]; then
sleep .3
exec systemd-cat --identifier=sway sway
else
neofetch --speed_shorthand on --cpu_temp C --cpu_cores logical --gtk_shorthand on
fi
export PATH="$PATH:/home/sheepymeh/.local/bin"
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
venv() {
if [ -z "$1" ]; then
if [ -d venv ]; then
venv_to_activate=venv
elif [ -d .venv ]; then
venv_to_activate=.venv
else
venv_paths=$(find . -maxdepth 2 -type d -name bin)
for venv_path in $venv_paths; do
if [ -f "$venv_path/activate" ]; then
venv_to_activate="$(dirname $venv_path)"
break
fi
done
fi
else
if [ -f "$1/bin/activate" ]; then
venv_to_activate="$1"
elif [ -d "$1" ]; then
echo "$1 is not a venv"
return 1
fi
fi
if [ -z "$venv_to_activate" ]; then
venv_path=${1:-venv}
echo "Creating venv in $venv_path"
python -m venv --system-site-packages --prompt "$(basename $(dirname $PWD/$venv_path))/$(basename $venv_path)" $venv_path
venv_to_activate=$venv_path
fi
source "$venv_to_activate/bin/activate"
unset venv_to_activate
}