dot

packages and services management
Log | Files | Refs | README

commit 3d676c6df7995630470b86e1caa2143d56e6b2a8
parent 81143947a46d258f4235feeb27f24760053c91d5
Author: josuah <mail@josuah.net>
Date:   Wed,  5 Oct 2016 11:53:25 -0400

Starting a tmux conf that rocks

Diffstat:
Mshell/.profile | 12+-----------
Mtmux/.tmux.conf | 30++++++++++++++++++------------
Mtmux/.tmux/new-session | 0
Atmux/.tmux/status | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+), 23 deletions(-)

diff --git a/shell/.profile b/shell/.profile @@ -10,7 +10,7 @@ # VARIABLES #------------------------------------------------------------------------------- -export PS1='$(ps1)' +export PS1="$(printf '\n\033[1;31m>\033[33m>\033[34m>\033[0m ')" export PS2='| ' export PATH="$CONFIG/bin:$LOCAL/bin:$PATH" @@ -73,10 +73,6 @@ ps1() printf '\n' - # Line separator - local p='────────────────────────────────────────' - printf '\033[30;1m%s\033[0m\r' "$p$p" - # Date printf "\033[74C %s\r" "$(date +'%H:%M')" @@ -97,12 +93,6 @@ ps1() # Error code [ "$code" -eq 0 ] || printf '\033[62C\033[31;1m %s \033[0m\r' "$code" - # Mails - local mail_count="$(find "$MAIL/new" -mindepth 1 2>/dev/null | wc -l)" - if [ "$mail_count" -gt 0 ] - then printf '\033[69C\033[32;1m %s \033[0m\r' "$mail_count" - fi - # Non printable: terminal status, bell, empty line at the bottom. printf '\a' #\n\n\033[2A' diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf @@ -44,7 +44,7 @@ bind C new-window # Sessions management bind -n C-z detach -bind S new-session\; send "~/.tmux/new-session\n" +bind S new-session\; send ". ~/.tmux/new-session\n" # Reload config bind r source ~/.tmux.conf\; display "Config loaded" @@ -52,6 +52,7 @@ bind r source ~/.tmux.conf\; display "Config loaded" # GLOBAL OPTIONS 2016-10-03 #------------------------------------------------------------------------------- + set -g base-index 1 set -g pane-base-index 1 set -g renumber-windows on @@ -64,19 +65,19 @@ set -g detach-on-destroy off #------------------------------------------------------------------------------- # Messages -set -g message-style bold,fg=white -set -g message-command-style bg=green +set -g message-style bold,fg=green +set -g message-command-style bold,fg=white # Display-panes mode set -g display-panes-colour white set -g display-panes-active-colour green # Clock mode -set -g clock-mode-colour green +set -g clock-mode-colour white set -g clock-mode-style 24 # Menus -set -g mode-style bold,bg=green,fg=black +set -g mode-style bg=white,fg=black # STATUS 2016-10-04 @@ -84,21 +85,26 @@ set -g mode-style bold,bg=green,fg=black # Layout set -g status-position top -set -g status-justify centre +set -g status-justify left # Global -set -g status-style '' +set -g status-style bg=black,fg=white # Left -set -g status-left " #S " +set -g status-left " #S #(#~/.tmux/status left)" +set -g status-left-length 30 set -g status-left-style bold,fg=white # Right -set -g status-right " %y-%m-%d #[bold] %R " +set -g status-right "#(#~/.tmux/status right)" set -g status-right-style fg=white set -g window-status-separator " " + +# WINDOWS +#------------------------------------------------------------------------------- + # Background windows set -g window-status-format \ " #{?window_zoomed_flag,[, }#I #W#{?window_zoomed_flag,], } " @@ -107,7 +113,7 @@ set -g window-status-style bold,fg=black # Foreground windows set -g window-status-current-format \ " #{?window_zoomed_flag,[, }#I #W#{?window_zoomed_flag,], } " -set -g window-status-current-style bold,fg=green +set -g window-status-current-style bold,fg=white # Urgent windows set -g window-status-bell-style fg=white,bg=red @@ -117,7 +123,7 @@ set -g window-status-activity-style fg=white,bg=yellow # BORDERS 2016-10-04 #------------------------------------------------------------------------------- -set -g pane-border-style bold,fg=white -set -g pane-active-border-style bold,fg=green +set -g pane-border-style fg=white +set -g pane-active-border-style bold,reverse,fg=white set -g pane-border-status top set -g pane-border-format " #{pane_index} #{pane_current_command} " diff --git a/tmux/.tmux/new-session b/tmux/.tmux/new-session diff --git a/tmux/.tmux/status b/tmux/.tmux/status @@ -0,0 +1,71 @@ +#!/bin/sh +# /\ /\ +# ____ / /_ _____ / /_ __ /\ ____ +# / __// ___\.'__ // ___\/ / / / / __/ +# __\ \ / / / /_/ // / / /_/ /__\ \ +# \___/ \/ \____/ \/ \____/ \___/ 2016-10-05 +#=============================================================================== +# Status line, with tmux color escape sequence + + +# VARIABLES 2016-10-05 +#------------------------------------------------------------------------------- + +BACKGROUND=black + + +# FUNCTIONS 2016-10-05 +#------------------------------------------------------------------------------- + +# Draw a segment +s() +{ + local segment="$1" color="$2" code + + $segment | { + code="$?" + + read -r label + read -r text + + if [ $code -eq 0 ] + then printf '#[bg=%s,fg=%s] %s #[bg=%s,fg=%s] %s #[default]' \ + "$color" "black" "$label" "$BACKGROUND" "$color" "$text" + fi + } +} + + +# SEGMENTS 2016-10-05 +#------------------------------------------------------------------------------- + +mails() +{ + local count="$(find "$MAIL/new" -mindepth 1 2>/dev/null | wc -l)" + + printf 'M\n%s\n' "$count" + + [ "$count" -gt 0 ] && return 0 || return 1 +} + +directory() +{ + local + printf 'M\n%s\n' "$count" + return 0 +} + + +date() +{ + printf '%s\n%s\n' "$(date +'%Y-%m-%d')" "$(date +'%H:%M')" + return 0 +} + +# ALGORYTHM 2016-10-05 +#------------------------------------------------------------------------------- + +case "$1" in +left ) s mail red; s date green ;; +right ) s date grey; s date grey ;; +esac | sed 's/ $//'