dot

packages and services management
Log | Files | Refs | README

commit 7296e6d87726838ba25304f8ef00c39b4bf76ee7
parent c010c54df7e266b6c9973bcdbb807b744f859dc9
Author: josuah <mail@josuah.net>
Date:   Wed,  5 Oct 2016 18:24:58 -0400

Somewhat working.  Blink makes tty background gray!

Diffstat:
Mshell/.profile | 14+++++++++-----
Mtmux/.config/tmux/status | 40++++++++++++++++++++++------------------
Mtmux/.tmux.conf | 11+++++------
3 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/shell/.profile b/shell/.profile @@ -11,11 +11,6 @@ # VARIABLES #------------------------------------------------------------------------------- -export PS1="$(printf '\n \033[1;31m>\033[33m>\033[34m>\033[0m ')" -export PS2='| ' - -export PATH="$CONFIG/bin:$LOCAL/bin:$PATH" - # Black Red Green Yellow # Blue Magenta Cyan White @@ -43,6 +38,14 @@ $(sed -r '/^ *#/ d; /^ *$/ d; s/@/$/g; s/ *([^ ]*) *[^ ]*=/\1=/' \ ~/.pam_environment) EOF +export PS1="$( + printf '\n \033[1;31m>\033[33m>\033[34m>\033[0m ' + tmux set status off; tmux set status on +)" +export PS2='| ' + +export PATH="$CONFIG/bin:$LOCAL/bin:$PATH" + # ALIAS #------------------------------------------------------------------------------- @@ -53,6 +56,7 @@ alias la='l -A' alias lla='l -Alh' alias v='$VISUAL' alias p='$PAGER' +alias t='tmux' alias f='find . -type f ! -path "*/.git/*" | fzf' alias d='find . -type d ! -path "*/.git/*" | fzf' alias c='cd "$(find . -maxdepth 4 -mindepth 1 -type d | fzf)"' diff --git a/tmux/.config/tmux/status b/tmux/.config/tmux/status @@ -14,7 +14,7 @@ help='USAGE: ~/.tmux/status segmentname1 segmentname2 ...' PWD="$(tmux display -p '#{pane_current_path}')" -BG_COLOR=black +BACKGROUND=black,blink SEPARATOR="${SEPARATOR- }" @@ -32,43 +32,45 @@ SEPARATOR="${SEPARATOR- }" # Either of 2 and 3 can be empty, and any can contain aditionnal tmux color # escape sequences: #[fg=color1,bg=color2,bold] -mails() +segment_mail() { local count='' inbox='' count="$(find "$MAIL/new" -mindepth 1 2>/dev/null | wc -l)" - [ "$count" -le 0 ] && count='' || inbox='mail' + [ "$count" -le 0 ] && count='' || mail='mail' - printf '%s\n' red mail "$count" + printf '%s\n' red "$mail" "$count" } -directory() +segment_dir() { - local color='' pwd='' + local pwd='' [ "${PWD##$HOME**}" ] && pwd="$PWD" || pwd="~${PWD#$HOME}" - printf '%s\n' "$color" "" "$pwd" + printf '%s\n' white "" "$pwd" } -git() +segment_git() { - local branch='' status='' + local color='' branch='' status='' + cd "$PWD" if git rev-parse &> /dev/null then + git='±' branch="$(git branch | sed -n 's/^\* // p')" status="$(git status --porcelain | wc -l)" + [ "$status" -gt 0 ] && color=red || color=green - else color='black,bold' branch='-' fi - printf '%s\n' "$color" "$branch" "${status#0}" + printf '%s\n' "$color" "$git" "$branch ${status#0}" | tee ~/log } -clock() +segment_clock() { - printf '%s\n' white '' "$(date +'%Y-%m-%d #[reverse]%H:%M')" + printf '%s\n' white '' "$(date +'%Y-%m-%d #[reverse] %H:%M')" } @@ -77,17 +79,19 @@ clock() for segment in $@ do - $1 | { + "segment_$1" | { read color read label read text - if [ "$text" ] - then printf '#[bg=%s,fg=%s] %s #[default]' "$c" "black" "$l" + if [ "$label" ] + then printf '#[bg=%s,fg=%s] %s #[default]' \ + "$color" black "$label" fi - if [ "$label" ] - then printf '#[bg=%s,fg=%s] %s #[default]' "$BG_COLOR" "$c" "$t" + if [ "$text" ] + then printf '#[bg=%s,fg=%s] %s #[default]' \ + "$BACKGROUND" "$color" "$text" fi } diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf @@ -89,25 +89,24 @@ set -g status-justify left set -g status-style bg=black,fg=white # Left -set -g status-left \ - "#[fg=black,bg=white] #S #[default]#(#~/.config/tmux/status left) " set -g status-left-length 30 set -g status-left-style fg=white +set -g status-left "#[fg=black,bg=white] #S #[default] " # Right -set -g status-right " #(#~/.config/tmux/status right) " +set -g status-right-length 50 set -g status-right-style fg=white +set -g status-right " #(~/.config/tmux/status dir git clock)" set -g window-status-separator " " - # Background windows -set -g window-status-format " #I #W " set -g window-status-style bold,fg=black +set -g window-status-format " #I #W " # Foreground windows -set -g window-status-current-format " #I #W " set -g window-status-current-style bold,fg=white +set -g window-status-current-format " #I #W " # Urgent windows set -g window-status-bell-style fg=white,bg=red