diff options
author | Jakob Odersky <jakob@odersky.com> | 2018-06-11 08:44:24 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-06-11 08:45:07 -0700 |
commit | 575e39cf8d4ff56f40ad02567dc7b83f8f9c1109 (patch) | |
tree | b91d6d2e9821445f65f57082022aad9de19929aa | |
parent | 38325926877c1eecf431f2a501c92bda769103a9 (diff) | |
download | dotfiles-575e39cf8d4ff56f40ad02567dc7b83f8f9c1109.tar.gz dotfiles-575e39cf8d4ff56f40ad02567dc7b83f8f9c1109.tar.bz2 dotfiles-575e39cf8d4ff56f40ad02567dc7b83f8f9c1109.zip |
Clean up initial bash scripts
-rw-r--r-- | home/.bashrc.d/jwt.sh | 6 | ||||
-rw-r--r-- | home/.bashrc.d/prompt.sh | 24 | ||||
-rw-r--r-- | home/.bashrc.d/wayland.sh | 8 | ||||
-rw-r--r-- | home/.config/i3/config | 2 |
4 files changed, 15 insertions, 25 deletions
diff --git a/home/.bashrc.d/jwt.sh b/home/.bashrc.d/jwt.sh index b2b47c2..8f95e5d 100644 --- a/home/.bashrc.d/jwt.sh +++ b/home/.bashrc.d/jwt.sh @@ -3,14 +3,14 @@ decode_base64_url() { local len=$((${#1} % 4)) local result="$1" - if [ $len -eq 2 ]; then result="$1"'==' - elif [ $len -eq 3 ]; then result="$1"'=' + if [[ $len -eq 2 ]]; then result="$1"'==' + elif [[ $len -eq 3 ]]; then result="$1"'=' fi echo "$result" | tr '_-' '/+' | openssl enc -d -base64 } decode_jwt(){ - decode_base64_url $(echo -n $2 | cut -d "." -f $1) | jq . + decode_base64_url "$(echo -n "$2" | cut -d "." -f "$1")" | jq . } # Decode JWT header diff --git a/home/.bashrc.d/prompt.sh b/home/.bashrc.d/prompt.sh index a50ad25..71f38c7 100644 --- a/home/.bashrc.d/prompt.sh +++ b/home/.bashrc.d/prompt.sh @@ -4,7 +4,7 @@ function __prompt_command() { local exit="$?" PS1="" # set title for terminal emulators - PS1+="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]" + PS1+="\\[\\e]0;${debian_chroot:+($debian_chroot)}\\u@\\h: \\w\\a\\]" local red='\[\e[31m\]' local green='\[\e[32m\]' @@ -24,26 +24,22 @@ function __prompt_command() { # PS1+="[$(kubectl config current-context)] " # fi - PS1+="${debian_chroot:+($debian_chroot)}${light_green}\u@\h${reset}:${light_blue}\W${reset}" + PS1+="${debian_chroot:+($debian_chroot)}${light_green}\\u@\\h${reset}:${light_blue}\\W${reset}" ### Add Git Status ### ## Inspired by http://www.terminally-incoherent.com/blog/2013/01/14/whats-in-your-bash-prompt/ if [[ $(command -v git) ]]; then - local git_status="$(git status --porcelain -b 2>/dev/null | tr '\n' ':')" - - if [ "$git_status" ]; then - local git_color="${reset}" - ### Test For Changes ### - ## Change this to test for 'ahead' or 'behind'! - local git_changed="$(echo ${git_status} | tr ':' '\n' | grep -v "^$" | grep -v "^\#\#" | wc -l | tr -d ' ')" - if [ "$git_changed" == "0" ]; then + local git_status + if git_status="$(git status --porcelain 2>/dev/null)"; then + if [[ -z $git_status ]]; then git_color="${green}" else git_color="${red}" fi - - ### Find Branch ### - local git_branch="$(echo ${git_status} | tr ':' '\n' | grep "^##" | cut -c4-)" + local git_branch + git_branch="$(git status --porcelain --branch 2>/dev/null \ + | grep '^##' \ + | cut -c4-)" PS1+=" ${git_color}[${git_branch}]${reset}" fi fi @@ -52,5 +48,5 @@ function __prompt_command() { PS1+=" ${red}(exit $exit)${reset}" fi - PS1+="\n╰\$ ${reset}" + PS1+="\\n╰\$ ${reset}" } diff --git a/home/.bashrc.d/wayland.sh b/home/.bashrc.d/wayland.sh deleted file mode 100644 index ec9aa62..0000000 --- a/home/.bashrc.d/wayland.sh +++ /dev/null @@ -1,8 +0,0 @@ -# Update PATH to include custom directories. This is a workaround for -# gnome-wayland, which does not load /etc/profile - -export PATH=/usr/local/sbin:/usr/sbin:/sbin:"$PATH" - -if [ -n "$HOME" ] && [ -d "$HOME/bin" ]; then - export PATH="$HOME/bin:$PATH" -fi diff --git a/home/.config/i3/config b/home/.config/i3/config index 0756924..673c9ac 100644 --- a/home/.config/i3/config +++ b/home/.config/i3/config @@ -278,6 +278,8 @@ bindsym $mod+r mode "resize" exec --no-startup-id xss-lock -- i3lock -n -i $background_image -e # utility applications +# disable audible bell +exec set -b # enable tap to click on touchpad exec xinput set-prop 12 280 1 # increase pointer acceleration on touchpad |