more fixed environment and simplify prompt

This commit is contained in:
Felix Van der Jeugt 2020-12-04 14:39:48 +01:00
parent 3ef84f0e1e
commit 60402f641f
No known key found for this signature in database
GPG Key ID: 58B209295023754D
2 changed files with 5 additions and 14 deletions

View File

@ -7,6 +7,7 @@ export XDG_CACHE_HOME="$HOME/.cache"
export XDG_RUNTIME_DIR="/tmp/runtime-$(whoami)" export XDG_RUNTIME_DIR="/tmp/runtime-$(whoami)"
mkdir -p "$XDG_RUNTIME_DIR" mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR" chmod 0700 "$XDG_RUNTIME_DIR"
export XDG_DOWNLOAD_DIR="/tmp"
# Local scripts # Local scripts
export CABAL_HOME="$HOME/.cabal" export CABAL_HOME="$HOME/.cabal"
@ -25,6 +26,7 @@ export FZF_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files)
export SKIM_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null' export SKIM_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null'
export LC_ALL=en_US.utf8 export LC_ALL=en_US.utf8
export BOGOFILTER_DIR="$XDG_DATA_HOME/bogofilter" export BOGOFILTER_DIR="$XDG_DATA_HOME/bogofilter"
export TERMINAL=st
# Select Dock sound card if it's there # Select Dock sound card if it's there
#(it's broken) #(it's broken)
@ -33,10 +35,3 @@ if [ -e /proc/asound/Dock ]; then
fi fi
#stty -ixon # disable <C-s> #stty -ixon # disable <C-s>
# Start X if we're in tty1
if tty | grep -q '/dev/tty1'; then
startx 2>&1 || vlock
#sudo poweroff
#sleep infinity
fi

10
yashrc
View File

@ -21,8 +21,8 @@ prompt_git() {
porcelain="$(git status --branch --porcelain 2>/dev/null)" porcelain="$(git status --branch --porcelain 2>/dev/null)"
if test "$?" = 0; then if test "$?" = 0; then
local branch="$(printf '%s' "$porcelain" | sed -n 's/\.\.\..*//;1s/## //p')" local branch="$(printf '%s' "$porcelain" | sed -n 's/\.\.\..*//;1s/## //p')"
local behind="$(printf '%s' "$porcelain" | sed -n '1s/## .*behind \([0-9]*\).*/\1/p')" local behind="$(printf '%s' "$porcelain" | sed -n '1s/## .*behind \([0-9]*\).*/-\1/p')"
local ahead="$(printf '%s' "$porcelain" | sed -n '1s/## .*ahead \([0-9]*\).*/\1/p')" local ahead="$(printf '%s' "$porcelain" | sed -n '1s/## .*ahead \([0-9]*\).*/+\1/p')"
local status="$({ echo OK; printf '%s' "$porcelain" | sed '/##/d;s/\(..\).*/\1/'; } | tail -1)" local status="$({ echo OK; printf '%s' "$porcelain" | sed '/##/d;s/\(..\).*/\1/'; } | tail -1)"
echo " (${branch}${behind}${ahead}|${status})" echo " (${branch}${behind}${ahead}|${status})"
@ -34,10 +34,6 @@ prompt_pwd() {
prompt_agent() { prompt_agent() {
[ -z "$SSH_AGENT_PID" ] || echo " (A)" [ -z "$SSH_AGENT_PID" ] || echo " (A)"
} }
prompt_mail() {
unread="$(notmuch count tag:unread)"
[ "$unread" = "0" ] || echo " ($unread mails)"
}
prompt_status() { prompt_status() {
if [ "$?" = "0" ] if [ "$?" = "0" ]
then echo "$" then echo "$"
@ -50,7 +46,7 @@ prompt_date() {
BOLD="\fo." BOLD="\fo."
GREEN="\fg." GREEN="\fg."
RESET="\fD." RESET="\fD."
PS1="$BOLD[\$(ks prompt_date)]$RESET $GREEN\$(ks prompt_pwd)$RESET\$(ks prompt_git)\$(ks prompt_agent)\$(ks prompt_mail) \$(prompt_status) " PS1="$BOLD[\$(ks prompt_date)]$RESET $GREEN\$(ks prompt_pwd)$RESET\$(ks prompt_git)\$(ks prompt_agent) \$(prompt_status) "
unset BOLD unset BOLD
unset GREEN unset GREEN
unset RESET unset RESET