mirror of
https://github.com/samoshkin/tmux-config.git
synced 2026-01-03 00:08:01 +00:00
Finish with appearence and status bar. Integrate various plugins including tmux-plugin-sysstat
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,7 +5,7 @@
|
|||||||
.LSOverride
|
.LSOverride
|
||||||
|
|
||||||
# Icon must end with two \r
|
# Icon must end with two \r
|
||||||
Icon
|
Icon
|
||||||
|
|
||||||
# Thumbnails
|
# Thumbnails
|
||||||
._*
|
._*
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "plugins/sysstat"]
|
||||||
|
path = plugins/sysstat
|
||||||
|
url = git@github.com:samoshkin/tmux-plugin-sysstat.git
|
||||||
40
install.sh
40
install.sh
@@ -10,28 +10,40 @@ is_app_installed() {
|
|||||||
REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
|
REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
|
||||||
cd "$REPODIR";
|
cd "$REPODIR";
|
||||||
|
|
||||||
git submodule update --recursive --init --quiet;
|
|
||||||
|
|
||||||
if ! is_app_installed tmux; then
|
if ! is_app_installed tmux; then
|
||||||
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
|
printf "$(tput setaf 1)WARNING:$(tput sgr0) \"tmux\" command is not found. \
|
||||||
Install \"tmux\" yourself\n"
|
Install it first\n"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# .tmux may already exist (created by tmux plugin manager)
|
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
|
||||||
rsync -aq --backup ./tmux/ "$HOME"/.tmux
|
printf "$(tput setaf 1)WARNING:$(tput sgr0) Cannot found TPM (Tmux Plugin Manager) \
|
||||||
|
at default location: \$HOME/.tmux/plugins/tpm. Install it first\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e "$HOME/.tmux.conf" ]; then
|
if [ -e "$HOME/.tmux.conf" ]; then
|
||||||
printf "Found existing .tmux.conf in your \$HOME directory. Will backup it and overwrite with new .tmux.conf file? OK (y/n): "
|
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
|
||||||
read -r answer
|
|
||||||
if echo "$answer" | grep -iq "^n"; then
|
|
||||||
printf "Install config manually using command below:\n\n";
|
|
||||||
printf "\t cd && ln -sf .tmux/tmux.conf .tmux.conf\n";
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -sf --backup=numbered .tmux/tmux.conf "$HOME"/.tmux.conf;
|
git submodule init;
|
||||||
printf "$(tput setaf 2)OK:$(tput sgr0) Files are copied to \$HOME/.tmux and symlink at \$HOME/.tmux.conf is created\n"
|
|
||||||
|
rsync -aq ./tmux/ "$HOME"/.tmux
|
||||||
|
|
||||||
|
ln -sf --backup --suffix=.bak .tmux/tmux.conf "$HOME"/.tmux.conf;
|
||||||
|
|
||||||
|
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
|
||||||
|
|
||||||
|
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
plugins/sysstat
Submodule
1
plugins/sysstat
Submodule
Submodule plugins/sysstat added at 21a3fd61b4
@@ -1,43 +1,27 @@
|
|||||||
# TODO: extract colour to variables
|
|
||||||
|
|
||||||
# Status line
|
# =====================================
|
||||||
set -g status on
|
# === Theme ===
|
||||||
set -g status-interval 10
|
# =====================================
|
||||||
set -g status-justify centre
|
|
||||||
set -g status-left-length 70
|
|
||||||
set -g status-right-length 90
|
|
||||||
|
|
||||||
|
# Feel free to NOT use this variables at all (remove, rename)
|
||||||
|
# this are named colors, just for convenience
|
||||||
|
color_orange="colour166" # 208, 166
|
||||||
|
color_purple="colour134" # 135, 134
|
||||||
|
color_green="colour076" # 070
|
||||||
|
color_blue="colour39"
|
||||||
|
color_yellow="colour220"
|
||||||
|
color_red="colour160"
|
||||||
|
color_black="colour232"
|
||||||
|
color_white="white" # 015
|
||||||
|
|
||||||
wg_battery='#{battery_status_fg} #{battery_icon} #{battery_percentage} #{battery_remain}'
|
# This is a theme CONTRACT, you are required to define variables below
|
||||||
|
# Change values, but not remove/rename variables itself
|
||||||
wg_loadavg='#[fg=colour167,bg=colour235]#( \
|
color_dark="$color_black"
|
||||||
uptime | cut -d "," -f 3- | cut -d ":" -f2 | sed -e "s/^[ \t]*//" \
|
color_light="$color_white"
|
||||||
)#[default]'
|
color_session_text="$color_blue"
|
||||||
|
color_status_text="colour245"
|
||||||
wg_date='#[fg=colour167,bg=colour235] %h %d %H:%M #[default]'
|
color_main="$color_orange"
|
||||||
|
color_secondary="$color_purple"
|
||||||
wg_session='#[fg=green]#S:#[fg=default]#I.#P'
|
color_level_good="$color_green"
|
||||||
wg_host='#[fg=colour167,bg=colour235]#(echo $USER)@#H#[default]'
|
color_level_warn="$color_yellow"
|
||||||
|
color_lelel_achtung="$color_red"
|
||||||
wg_is_zoomed='#[fg=colour231,bg=colour04]#{?window_zoomed_flag,[Z],}#[default]'
|
|
||||||
wg_clients_attached='#[fg=cyan]#{?session_many_attached,~#{session_attached},}#[default]'
|
|
||||||
|
|
||||||
|
|
||||||
# CPU is updated to often, put stress on CPU
|
|
||||||
# wg_cpu='#{cpu_fg_color}#{cpu_percentage}'
|
|
||||||
# wg_cpu="#(iostat -c -y 5 1 | tail -n 2 | head -n 1)"
|
|
||||||
|
|
||||||
|
|
||||||
set -g status-style fg=white,bg=colour235
|
|
||||||
set -g status-right "$wg_loadavg $wg_battery $wg_host $wg_date #{online_status}"
|
|
||||||
set -g status-left "$wg_session $wg_clients_attached $wg_is_zoomed #{prefix_highlight}"
|
|
||||||
|
|
||||||
|
|
||||||
setw -g window-status-style fg=white,dim
|
|
||||||
setw -g window-status-current-style fg=brightwhite,nodim,bold,bg=brightred
|
|
||||||
setw -g window-status-activity-style fg=black,bg=cyan
|
|
||||||
|
|
||||||
|
|
||||||
# Appearence
|
|
||||||
setw -g pane-active-border-style fg=red
|
|
||||||
set -g message-style fg=green,bold,bg=black
|
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ set -g allow-rename off
|
|||||||
set -g default-terminal "screen"
|
set -g default-terminal "screen"
|
||||||
set -g remain-on-exit off
|
set -g remain-on-exit off
|
||||||
|
|
||||||
|
# aggressive-resize [on | off]
|
||||||
|
# alternate-screen [on | off]
|
||||||
|
|
||||||
|
|
||||||
# Change prefix key to C-a, easier to type, same to "screen"
|
# Change prefix key to C-a, easier to type, same to "screen"
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set -g prefix C-a
|
set -g prefix C-a
|
||||||
@@ -148,12 +152,85 @@ unbind -T copy-mode-vi MouseDragEnd1Pane
|
|||||||
bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X copy-selection
|
bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X copy-selection
|
||||||
|
|
||||||
|
|
||||||
# ===================================
|
# =====================================
|
||||||
# === Appearence and status bar ===
|
# === Appearence and status bar ===
|
||||||
# ===================================
|
# ======================================
|
||||||
|
|
||||||
|
# Load theme
|
||||||
|
source ~/.tmux/theme.conf
|
||||||
|
|
||||||
|
set -g mode-style "fg=default,bg=$color_main"
|
||||||
|
|
||||||
|
# command line style
|
||||||
|
set -g message-style "fg=$color_main,bg=$color_dark"
|
||||||
|
|
||||||
|
# status line style
|
||||||
|
set -g status-style "fg=$color_status_text,bg=$color_dark"
|
||||||
|
|
||||||
|
# window segments in status line
|
||||||
|
set -g window-status-separator ""
|
||||||
|
separator_powerline_left=""
|
||||||
|
separator_powerline_right=""
|
||||||
|
|
||||||
|
setw -g window-status-style "fg=$color_status_text,bg=$color_dark"
|
||||||
|
setw -g window-status-format " #I:#W "
|
||||||
|
setw -g window-status-current-style "fg=$color_light,bold,bg=$color_main"
|
||||||
|
setw -g window-status-current-format "#[fg=$color_dark,bg=$color_main]$separator_powerline_right#[default] #I:#W# #[fg=$color_main,bg=$color_dark]$separator_powerline_right#[default]"
|
||||||
|
|
||||||
|
# when window has monitoring notification
|
||||||
|
setw -g window-status-activity-style "fg=$color_main,bg=$color_dark"
|
||||||
|
|
||||||
|
# outline for active pane
|
||||||
|
setw -g pane-active-border-style "fg=$color_main"
|
||||||
|
|
||||||
|
# general status bar settings
|
||||||
|
set -g status on
|
||||||
|
set -g status-interval 5
|
||||||
|
set -g status-position top
|
||||||
|
set -g status-justify left
|
||||||
|
set -g status-right-length 140
|
||||||
|
|
||||||
|
# define widgets we're going to use in status bar
|
||||||
|
# note, that this is not the complete list, some of them are loaded from plugins
|
||||||
|
wg_session="#[fg=$color_session_text] #S #[default]"
|
||||||
|
wg_battery="#{battery_status_fg} #{battery_icon} #{battery_percentage}"
|
||||||
|
wg_date="#[fg=$color_secondary]%h %d %H:%M#[default]"
|
||||||
|
wg_host="#[fg=$color_secondary]#(echo $USER)#[default]@#H"
|
||||||
|
wg_is_zoomed="#[fg=$color_dark,bg=$color_secondary]#{?window_zoomed_flag,[Z],}#[default]"
|
||||||
|
|
||||||
|
set -g status-left "$wg_session"
|
||||||
|
set -g status-right "#{prefix_highlight} $wg_is_zoomed #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_host | $wg_date $wg_battery #{online_status}"
|
||||||
|
|
||||||
|
# online and offline icon for tmux-online-status
|
||||||
|
set -g @online_icon "#[fg=$color_level_good]●#[default]"
|
||||||
|
set -g @offline_icon "#[fg=$color_level_achtung]●#[default]"
|
||||||
|
|
||||||
|
# Configure view templates for tmux-plugin-sysstat "MEM" and "CPU" widget
|
||||||
|
set -g @sysstat_mem_size_unit "G"
|
||||||
|
set -g @sysstat_mem_view_tmpl '#[fg=#{mem.color}]MEM:#{mem.pused}#[default] (#{mem.used})'
|
||||||
|
set -g @sysstat_cpu_view_tmpl '#[fg=#{cpu.color}]CPU:#{cpu.pused}#[default]'
|
||||||
|
|
||||||
|
# Configure colors for tmux-plugin-sysstat "MEM" and "CPU" widget
|
||||||
|
set -g @sysstat_cpu_color_low "$color_level_good"
|
||||||
|
set -g @sysstat_cpu_color_medium "$color_level_warn"
|
||||||
|
set -g @sysstat_cpu_color_high "$color_level_achtung"
|
||||||
|
set -g @sysstat_mem_color_ok "$color_level_good"
|
||||||
|
set -g @sysstat_mem_color_stress "$color_level_achtung"
|
||||||
|
|
||||||
|
# Configure tmux-battery widget colors
|
||||||
|
set -g @batt_color_full_charge "#[fg=$color_level_good]"
|
||||||
|
set -g @batt_color_high_charge "#[fg=$color_level_good]"
|
||||||
|
set -g @batt_color_medium_charge "#[fg=$color_level_warn]"
|
||||||
|
set -g @batt_color_low_charge "#[fg=$color_level_achtung]"
|
||||||
|
|
||||||
|
# Configure tmux-prefix-highlight colors
|
||||||
|
set -g @prefix_highlight_output_prefix '['
|
||||||
|
set -g @prefix_highlight_output_suffix ']'
|
||||||
|
set -g @prefix_highlight_fg "$color_dark"
|
||||||
|
set -g @prefix_highlight_bg "$color_secondary"
|
||||||
|
set -g @prefix_highlight_show_copy_mode 'on'
|
||||||
|
set -g @prefix_highlight_copy_mode_attr "fg=$color_dark,bg=$color_secondary"
|
||||||
|
|
||||||
# TODO: Not ready yet
|
|
||||||
# source ~/.tmux/theme.conf
|
|
||||||
|
|
||||||
|
|
||||||
# ============================
|
# ============================
|
||||||
@@ -174,17 +251,9 @@ set -g @plugin 'tmux-plugins/tmux-online-status'
|
|||||||
set -g @plugin 'tmux-plugins/tmux-sidebar'
|
set -g @plugin 'tmux-plugins/tmux-sidebar'
|
||||||
set -g @plugin 'tmux-plugins/tmux-copycat'
|
set -g @plugin 'tmux-plugins/tmux-copycat'
|
||||||
set -g @plugin 'tmux-plugins/tmux-open'
|
set -g @plugin 'tmux-plugins/tmux-open'
|
||||||
|
set -g @plugin 'samoshkin/tmux-plugin-sysstat'
|
||||||
|
|
||||||
# Plugin properties
|
# Plugin properties
|
||||||
set -g @batt_remain_short true
|
|
||||||
|
|
||||||
set -g @prefix_highlight_show_copy_mode 'on'
|
|
||||||
set -g @prefix_highlight_output_prefix '['
|
|
||||||
set -g @prefix_highlight_output_suffix ']'
|
|
||||||
|
|
||||||
set -g @online_icon "#[fg=green]●#[default]"
|
|
||||||
set -g @offline_icon "#[fg=red]●#[default]"
|
|
||||||
|
|
||||||
set -g @sidebar-tree 't'
|
set -g @sidebar-tree 't'
|
||||||
set -g @sidebar-tree-focus 'T'
|
set -g @sidebar-tree-focus 'T'
|
||||||
set -g @sidebar-tree-command 'tree -C'
|
set -g @sidebar-tree-command 'tree -C'
|
||||||
|
|||||||
Reference in New Issue
Block a user