diff --git a/INSTALL.md b/INSTALL.md index a24609f..03362b6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,6 +21,7 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi * Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false` * Enable powerline symbols: `set -g @dracula-show-powerline true` * Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol (can set any symbol you like as seperator) +* Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number * Enable military time: `set -g @dracula-military-time true` * Disable timezone: `set -g @dracula-show-timezone false` * Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character. diff --git a/README.md b/README.md index f8ec8a9..666ead6 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul * Current location based on network with temperature and forecast icon (if available) * Network connection status and SSID * Battery percentage and AC power connection status +* Refresh rate control * CPU usage * RAM usage * GPU usage diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index c5180cd..c765d16 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash +# function for getting the refresh rate +get_tmux_option() { + local option=$1 + local default_value=$2 + local option_value=$(tmux show-option -gqv "$option") + if [ -z $option_value ]; then + echo $default_value + else + echo $option_value + fi +} + get_percent() { case $(uname -s) in @@ -21,9 +33,11 @@ get_percent() main() { + # storing the refresh rate in the variable RATE, default is 5 + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) cpu_percent=$(get_percent) echo "CPU $cpu_percent" - sleep 10 + sleep $RATE } # run main driver diff --git a/scripts/dracula.sh b/scripts/dracula.sh index f2d68c3..b33d8d2 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -32,6 +32,7 @@ main() show_ram_usage=$(get_tmux_option "@dracula-ram-usage" false) show_gpu_usage=$(get_tmux_option "@dracula-gpu-usage" false) show_time=$(get_tmux_option "@dracula-show-time" true) + show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5) # Dracula Color Pallette white='#f8f8f2' @@ -79,7 +80,7 @@ main() esac # sets refresh interval to every 5 seconds - tmux set-option -g status-interval 5 + tmux set-option -g status-interval $show_refresh # set clock to 12 hour by default tmux set-option -g clock-mode-style 12 diff --git a/scripts/gpu_usage.sh b/scripts/gpu_usage.sh index 3bb1445..79b60f1 100755 --- a/scripts/gpu_usage.sh +++ b/scripts/gpu_usage.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash +# function for getting the refresh rate +get_tmux_option() { + local option=$1 + local default_value=$2 + local option_value=$(tmux show-option -gqv "$option") + if [ -z $option_value ]; then + echo $default_value + else + echo $option_value + fi +} + get_platform() { case $(uname -s) in @@ -27,9 +39,11 @@ get_gpu() } main() { + # storing the refresh rate in the variable RATE, default is 5 + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) gpu_usage=$(get_gpu) echo "GPU $gpu_usage" - sleep 10 + sleep $RATE } # run the main driver main diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 7b3a6a2..141e7a6 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash +# function for getting the refresh rate +get_tmux_option() { + local option=$1 + local default_value=$2 + local option_value=$(tmux show-option -gqv "$option") + if [ -z $option_value ]; then + echo $default_value + else + echo $option_value + fi +} + get_percent() { case $(uname -s) in @@ -37,9 +49,11 @@ get_percent() main() { + # storing the refresh rate in the variable RATE, default is 5 + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) ram_percent=$(get_percent) echo "RAM $ram_percent" - sleep 10 + sleep $RATE } #run main driver