From e290571feea1ab33dffa481a1aa87a8e296d8d9e Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 10 Aug 2020 07:57:48 -0400 Subject: [PATCH] added the refresh rate by pulling from the .tmux.conf file and running the get_tmux_option function and using that as the variable for the refresh rate on sleep --- scripts/cpu_info.sh | 12 ++++++++++++ scripts/dracula.sh | 3 --- scripts/gpu_usage.sh | 12 ++++++++++++ scripts/ram_info.sh | 12 ++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 7bc72d1..34635c0 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -1,5 +1,16 @@ #!/usr/bin/env bash +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,6 +32,7 @@ get_percent() main() { + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) cpu_percent=$(get_percent) echo "CPU $cpu_percent" sleep $RATE diff --git a/scripts/dracula.sh b/scripts/dracula.sh index f324c12..b33d8d2 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -34,9 +34,6 @@ main() show_time=$(get_tmux_option "@dracula-show-time" true) show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5) - # exporting the value for the other scripts to read - export RATE=$show_refresh - # Dracula Color Pallette white='#f8f8f2' gray='#44475a' diff --git a/scripts/gpu_usage.sh b/scripts/gpu_usage.sh index 6935af7..3b783ee 100755 --- a/scripts/gpu_usage.sh +++ b/scripts/gpu_usage.sh @@ -1,5 +1,16 @@ #!/usr/bin/env bash +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,6 +38,7 @@ get_gpu() } main() { + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) gpu_usage=$(get_gpu) echo "GPU $gpu_usage" sleep $RATE diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 5263e5d..30f905c 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -1,5 +1,16 @@ #!/usr/bin/env bash +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,6 +48,7 @@ get_percent() main() { + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) ram_percent=$(get_percent) echo "RAM $ram_percent" sleep $RATE