Skip to content

Commit 83464a1

Browse files
Merge branch 'master' into patch2
2 parents 784106d + 2c5913d commit 83464a1

File tree

6 files changed

+82
-48
lines changed

6 files changed

+82
-48
lines changed

INSTALL.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ programs.tmux = {
4444

4545
#### Configuration
4646

47-
To enable plugins set up the `@dracula-plugins` option in you `.tmux.conf` file, separate plugin by space.
47+
To enable plugins set up the `@dracula-plugins` option in your `.tmux.conf` file, separate plugin by space.
4848
The order that you define the plugins will be the order on the status bar left to right.
4949

5050
```bash
@@ -117,6 +117,15 @@ Hide empty plugins
117117
set -g @dracula-show-empty-plugins false
118118
```
119119

120+
Make the powerline background transparent
121+
122+
```bash
123+
set -g @dracula-powerline-bg-transparent true
124+
125+
# the left separator symbol is inversed with a transparent background, you can modify it with any symbol you like
126+
set -g @dracula-inverse-divider 
127+
```
128+
120129
#### cpu-usage options
121130

122131
Customize label

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
3333
- When prefix is enabled, a smiley face turns from green to yellow
3434
- When charging, 'AC' is displayed
3535
- Alternatively show battery level and whether its charging next to percentage by setting:
36-
`set -g @dracula-battery-label false`
37-
`set -g @dracula-show-battery-status true`
36+
```
37+
set -g @dracula-battery-label false
38+
set -g @dracula-no-battery-label false
39+
set -g @dracula-show-battery-status true
40+
```
3841
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
3942
- Info if the Panes are synchronized
4043
- Spotify playback (needs the tool spotify-tui installed). max-len can be configured.

scripts/battery.sh

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ linux_acpi() {
99
arg=$1
1010
BAT=$(ls -d /sys/class/power_supply/*)
1111
if [ ! -x "$(which acpi 2> /dev/null)" ];then
12-
case "$arg" in
13-
status)
14-
cat $BAT/status
15-
;;
16-
17-
percent)
18-
cat $BAT/capacity
19-
;;
20-
21-
*)
22-
;;
23-
esac
12+
for DEV in $BAT; do
13+
case "$arg" in
14+
status)
15+
[ -f "$DEV/status" ] && cat "$DEV/status"
16+
;;
17+
percent)
18+
[ -f "$DEV/capacity" ] && cat "$DEV/capacity"
19+
;;
20+
*)
21+
;;
22+
esac
23+
done
2424
else
2525
case "$arg" in
2626
status)
@@ -106,7 +106,7 @@ battery_status()
106106
)
107107
echo "${battery_labels[$((bat_perc/10*10))]:-󰂃}"
108108
;;
109-
high|Full)
109+
high|charged|Full)
110110
echo "󰁹"
111111
;;
112112
charging|Charging)
@@ -151,10 +151,15 @@ battery_status()
151151
main()
152152
{
153153
bat_label=$(get_tmux_option "@dracula-battery-label" "")
154-
if [ "$bat_label" ]; then
154+
if [ "$bat_label" == false ]; then
155155
bat_label=""
156156
fi
157157

158+
no_bat_label=$(get_tmux_option "@dracula-no-battery-label" "AC")
159+
if [ "$no_bat_label" == false ]; then
160+
no_bat_label=""
161+
fi
162+
158163
show_bat_label=$(get_tmux_option "@dracula-show-battery-status" false)
159164
if $show_bat_label; then
160165
bat_stat=$(battery_status)
@@ -167,7 +172,7 @@ main()
167172
if [ -z "$bat_stat" ]; then # Test if status is empty or not
168173
echo "$bat_label $bat_perc"
169174
elif [ -z "$bat_perc" ]; then # In case it is a desktop with no battery percent, only AC power
170-
echo ""
175+
echo "$no_bat_label"
171176
else
172177
echo "$bat_label$bat_stat $bat_perc"
173178
fi

scripts/dracula.sh

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ main()
1818
show_location=$(get_tmux_option "@dracula-show-location" true)
1919
fixed_location=$(get_tmux_option "@dracula-fixed-location")
2020
show_powerline=$(get_tmux_option "@dracula-show-powerline" false)
21+
transparent_powerline_bg=$(get_tmux_option "@dracula-transparent-powerline-bg" false)
2122
show_flags=$(get_tmux_option "@dracula-show-flags" false)
2223
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
2324
show_left_icon_padding=$(get_tmux_option "@dracula-left-icon-padding" 1)
@@ -26,6 +27,7 @@ main()
2627
show_timezone=$(get_tmux_option "@dracula-show-timezone" true)
2728
show_left_sep=$(get_tmux_option "@dracula-show-left-sep")
2829
show_right_sep=$(get_tmux_option "@dracula-show-right-sep")
30+
show_inverse_divider=$(get_tmux_option "@dracula-inverse-divider")
2931
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
3032
show_day_month=$(get_tmux_option "@dracula-day-month" false)
3133
show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5)
@@ -37,17 +39,30 @@ main()
3739
show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true)
3840

3941
# Dracula Color Pallette
40-
white='#f8f8f2'
41-
gray='#44475a'
42-
dark_gray='#282a36'
43-
light_purple='#bd93f9'
44-
dark_purple='#6272a4'
45-
cyan='#8be9fd'
46-
green='#50fa7b'
47-
orange='#ffb86c'
48-
red='#ff5555'
49-
pink='#ff79c6'
50-
yellow='#f1fa8c'
42+
white=$(get_tmux_option "@dracula-color-white" "#f8f8f2")
43+
gray=$(get_tmux_option "@dracula-color-gray" "#44475a")
44+
dark_gray=$(get_tmux_option "@dracula-color-dark_gray" "#282a36")
45+
light_purple=$(get_tmux_option "@dracula-color-light_purple" "#bd93f9")
46+
dark_purple=$(get_tmux_option "@dracula-color-dark_purple" "#6272a4")
47+
cyan=$(get_tmux_option "@dracula-color-cyan" "#8be9fd")
48+
green=$(get_tmux_option "@dracula-color-green" "#50fa7b")
49+
orange=$(get_tmux_option "@dracula-color-orange" "#ffb86c")
50+
red=$(get_tmux_option "@dracula-color-red" "#ff5555")
51+
pink=$(get_tmux_option "@dracula-color-pink" "#ff79c6")
52+
yellow=$(get_tmux_option "@dracula-color-yellow" "#f1fa8c")
53+
54+
# Set transparency variables - Colors and window dividers
55+
if $transparent_powerline_bg; then
56+
bg_color="default"
57+
window_sep_fg=${dark_purple}
58+
window_sep_bg=default
59+
window_sep="$show_inverse_divider"
60+
else
61+
bg_color=${gray}
62+
window_sep_fg=${gray}
63+
window_sep_bg=${dark_purple}
64+
window_sep="$show_left_sep"
65+
fi
5166

5267
# Handle left icon configuration
5368
case $show_left_icon in
@@ -123,12 +138,12 @@ main()
123138
tmux set-option -g message-style "bg=${gray},fg=${white}"
124139

125140
# status bar
126-
tmux set-option -g status-style "bg=${gray},fg=${white}"
141+
tmux set-option -g status-style "bg=${bg_color},fg=${white}"
127142

128143
# Status left
129144
if $show_powerline; then
130-
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${gray}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
131-
powerbg=${gray}
145+
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${bg_color}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
146+
powerbg=${bg_color}
132147
else
133148
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
134149
fi
@@ -295,12 +310,12 @@ main()
295310

296311
# Window option
297312
if $show_powerline; then
298-
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${gray}]${left_sep}"
313+
tmux set-window-option -g window-status-current-format "#[fg=${window_sep_fg},bg=${window_sep_bg}]${window_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${bg_color}]${left_sep}"
299314
else
300315
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W${current_flags} "
301316
fi
302317

303-
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${gray}] #I #W${flags}"
318+
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${bg_color}] #I #W${flags}"
304319
tmux set-window-option -g window-status-activity-style "bold"
305320
tmux set-window-option -g window-status-bell-style "bold"
306321
}

scripts/network.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ source $current_dir/utils.sh
77

88
# set your own hosts so that a wifi is recognised even without internet access
99
HOSTS=$(get_tmux_option "@dracula-network-hosts" "google.com github.com example.com")
10+
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
11+
ethernet_label=$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")
1012

1113
get_ssid()
1214
{
@@ -15,9 +17,9 @@ get_ssid()
1517
Linux)
1618
SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p')
1719
if [ -n "$SSID" ]; then
18-
printf '%s' "$wifi_label$SSID"
20+
echo "$wifi_label$SSID"
1921
else
20-
echo "$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")"
22+
echo "$ethernet_label"
2123
fi
2224
;;
2325

@@ -26,7 +28,7 @@ get_ssid()
2628
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
2729
echo "$wifi_label$(ipconfig getsummary en0 | awk -F ' SSID : ' '/ SSID : / {print $2}')"
2830
else
29-
echo "$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")"
31+
echo "$ethernet_label"
3032
fi
3133
;;
3234

@@ -44,7 +46,7 @@ main()
4446
{
4547
network="$(get_tmux_option "@dracula-network-offline-label" "Offline")"
4648
for host in $HOSTS; do
47-
if ping -q -c 1 -W 1 $host &>/dev/null; then
49+
if ping -q -c 1 -W 1 "$host" &>/dev/null; then
4850
network="$(get_ssid)"
4951
break
5052
fi

scripts/utils.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
#!/usr/bin/env bash
22

33
get_tmux_option() {
4-
local option=$1
5-
local default_value=$2
6-
local option_value=$(tmux show-option -gqv "$option")
4+
local option="$1"
5+
local default_value="$2"
6+
local option_value="$(tmux show-option -gqv "$option")"
77
if [ -z "$option_value" ]; then
8-
echo $default_value
8+
echo "$default_value"
99
else
10-
echo $option_value
10+
echo "$option_value"
1111
fi
1212
}
1313

1414
get_tmux_window_option() {
15-
local option=$1
16-
local default_value=$2
17-
local option_value=$(tmux show-window-options -v "$option")
15+
local option="$1"
16+
local default_value="$2"
17+
local option_value="$(tmux show-window-options -v "$option")"
1818
if [ -z "$option_value" ]; then
19-
echo $default_value
19+
echo "$default_value"
2020
else
21-
echo $option_value
21+
echo "$option_value"
2222
fi
2323
}
2424

0 commit comments

Comments
 (0)