-
-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathtmux-power.tmux
executable file
Β·172 lines (149 loc) Β· 5 KB
/
tmux-power.tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env bash
#===============================================================================
# Author: Wenxuan
# Email: [email protected]
# Created: 2018-04-05 17:37
#===============================================================================
# $1: option
# $2: default value
tmux_get() {
local value
value="$(tmux show -gqv "$1")"
[ -n "$value" ] && echo "$value" || echo "$2"
}
# $1: option
# $2: value
tmux_set() {
tmux set-option -gq "$1" "$2"
}
# Options
rarrow=$(tmux_get '@tmux_power_right_arrow_icon' 'ξ°')
larrow=$(tmux_get '@tmux_power_left_arrow_icon' 'ξ²')
upload_speed_icon=$(tmux_get '@tmux_power_upload_speed_icon' 'σ°')
download_speed_icon=$(tmux_get '@tmux_power_download_speed_icon' 'σ°')
session_icon="$(tmux_get '@tmux_power_session_icon' 'ο')"
user_icon="$(tmux_get '@tmux_power_user_icon' 'ο')"
time_icon="$(tmux_get '@tmux_power_time_icon' 'ο')"
date_icon="$(tmux_get '@tmux_power_date_icon' 'ο³')"
show_user="$(tmux_get @tmux_power_show_user true)"
show_host="$(tmux_get @tmux_power_show_host true)"
show_session="$(tmux_get @tmux_power_show_session true)"
show_upload_speed="$(tmux_get @tmux_power_show_upload_speed false)"
show_download_speed="$(tmux_get @tmux_power_show_download_speed false)"
show_web_reachable="$(tmux_get @tmux_power_show_web_reachable false)"
prefix_highlight_pos=$(tmux_get @tmux_power_prefix_highlight_pos)
time_format=$(tmux_get @tmux_power_time_format '%T')
date_format=$(tmux_get @tmux_power_date_format '%F')
# short for Theme-Colour
TC=$(tmux_get '@tmux_power_theme' 'gold')
case $TC in
'gold' )
TC='#ffb86c'
;;
'redwine' )
TC='#b34a47'
;;
'moon' )
TC='#00abab'
;;
'forest' )
TC='#228b22'
;;
'violet' )
TC='#9370db'
;;
'snow' )
TC='#fffafa'
;;
'coral' )
TC='#ff7f50'
;;
'sky' )
TC='#87ceeb'
;;
'everforest' )
TC='#a7c080'
;;
esac
G0=$(tmux_get @tmux_power_g0 "#262626")
G1=$(tmux_get @tmux_power_g1 "#303030")
G2=$(tmux_get @tmux_power_g2 "#3a3a3a")
G3=$(tmux_get @tmux_power_g3 "#444444")
G4=$(tmux_get @tmux_power_g4 "#626262")
# Status options
tmux_set status-interval 1
tmux_set status on
# Basic status bar colors
tmux_set status-bg "$G0"
tmux_set status-fg "$G4"
tmux_set status-attr none
# tmux-prefix-highlight
tmux_set @prefix_highlight_show_copy_mode 'on'
tmux_set @prefix_highlight_copy_mode_attr "fg=$TC,bg=$G0,bold"
tmux_set @prefix_highlight_output_prefix "#[fg=$TC]#[bg=$G0]$larrow#[bg=$TC]#[fg=$G0]"
tmux_set @prefix_highlight_output_suffix "#[fg=$TC]#[bg=$G0]$rarrow"
# ο ο ο½ ο ο
# Left side of status bar
tmux_set status-left-bg "$G0"
tmux_set status-left-length 150
# user@host
if "$show_user" && "$show_host"; then
LS="#[fg=$G0,bg=$TC,bold] $user_icon $(whoami)@#h #[fg=$TC,bg=$G2,nobold]$rarrow"
elif "$show_user"; then
LS="#[fg=$G0,bg=$TC,bold] $user_icon $(whoami) #[fg=$TC,bg=$G2,nobold]$rarrow"
elif "$show_host"; then
LS="#[fg=$G0,bg=$TC,bold] #h #[fg=$TC,bg=$G2,nobold]$rarrow"
fi
# session
if "$show_session"; then
LS="$LS#[fg=$TC,bg=$G2] $session_icon #S "
fi
# upload speed
if "$show_upload_speed"; then
LS="$LS#[fg=$G2,bg=$G1]$rarrow#[fg=$TC,bg=$G1] $upload_speed_icon #{upload_speed} #[fg=$G1,bg=$G0]$rarrow"
else
LS="$LS#[fg=$G2,bg=$G0]$rarrow"
fi
if [[ $prefix_highlight_pos == 'L' || $prefix_highlight_pos == 'LR' ]]; then
LS="$LS#{prefix_highlight}"
fi
tmux_set status-left "$LS"
# Right side of status bar
tmux_set status-right-bg "$G0"
tmux_set status-right-length 150
RS="#[fg=$G2]$larrow#[fg=$TC,bg=$G2] $time_icon $time_format #[fg=$TC,bg=$G2]$larrow#[fg=$G0,bg=$TC] $date_icon $date_format "
if "$show_download_speed"; then
RS="#[fg=$G1,bg=$G0]$larrow#[fg=$TC,bg=$G1] $download_speed_icon #{download_speed} $RS"
fi
if "$show_web_reachable"; then
RS=" #{web_reachable_status} $RS"
fi
if [[ $prefix_highlight_pos == 'R' || $prefix_highlight_pos == 'LR' ]]; then
RS="#{prefix_highlight}$RS"
fi
tmux_set status-right "$RS"
# Window status format
tmux_set window-status-format "#[fg=$G0,bg=$G2]$rarrow#[fg=$TC,bg=$G2] #I:#W#F #[fg=$G2,bg=$G0]$rarrow"
tmux_set window-status-current-format "#[fg=$G0,bg=$TC]$rarrow#[fg=$G0,bg=$TC,bold] #I:#W#F #[fg=$TC,bg=$G0,nobold]$rarrow"
# Window status style
tmux_set window-status-style "fg=$TC,bg=$G0,none"
tmux_set window-status-last-style "fg=$TC,bg=$G0,bold"
tmux_set window-status-activity-style "fg=$TC,bg=$G0,bold"
# Window separator
tmux_set window-status-separator ""
# Pane border
tmux_set pane-border-style "fg=$G3,bg=default"
# Active pane border
tmux_set pane-active-border-style "fg=$TC,bg=default"
# Pane number indicator
tmux_set display-panes-colour "$G3"
tmux_set display-panes-active-colour "$TC"
# Clock mode
tmux_set clock-mode-colour "$TC"
tmux_set clock-mode-style 24
# Message
tmux_set message-style "fg=$TC,bg=$G0"
# Command message
tmux_set message-command-style "fg=$TC,bg=$G0"
# Copy mode highlight
tmux_set mode-style "bg=$TC,fg=$G4"