From 8842bdf8497d97e60686b9fe0ed5acbb6f0827c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20D=2E=20M=C3=A1rquez?= Date: Tue, 21 Apr 2020 00:35:04 +0200 Subject: [PATCH] Add options to disable battery and network --- README.md | 4 +++- scripts/dracula.sh | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c774b86..9e7baf4 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ Compatible with macOS and Linux. Tested on tmux 3.0a ## Options Customize the status bar by adding any of these lines to your .tmux.conf as desired: -Disable weather functionality: `set -g @dracula-show-weather false` +* Disable battery functionality: `set -g @dracula-show-battery false` +* Disable network functionality: `set -g @dracula-show-network false` +* Disable weather functionality: `set -g @dracula-show-weather false` ## Team diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 489e09a..e87c851 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -18,6 +18,8 @@ main() { # set current directory variable current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + show_battery=$(get_tmux_option "@dracula-show-battery" true) + show_network=$(get_tmux_option "@dracula-show-network" true) show_weather=$(get_tmux_option "@dracula-show-weather" true) # Dracula Color Pallette @@ -60,11 +62,20 @@ main() tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ☺ " - tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh) " - tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}]#($current_dir/network.sh) " + tmux set-option -g status-right "" + + if $show_battery; then + tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh) " + fi + + if $show_network; then + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}]#($current_dir/network.sh) " + fi + if $show_weather; then tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) " fi + tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) " # window tabs