From b10c4dcf18360e4e77f53494d0404cdb8a0d20ae Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 1 Jun 2020 02:10:10 -0400 Subject: [PATCH 01/21] Added cpu percentage, works on powerline and normal, will add memory later :) --- INSTALL.md | 1 + scripts/cpu_info.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++ scripts/dracula.sh | 14 ++++++++++++ 3 files changed, 68 insertions(+) create mode 100755 scripts/cpu_info.sh diff --git a/INSTALL.md b/INSTALL.md index aa4fdd3..3dd0106 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,3 +24,4 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi * Enable military time: `set -g @dracula-military-time true` * Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character. * Enable high contrast pane border: `set -g @dracula-border-contrast true` +* Enable cpu percentage: `set -g @dracula-cpu-percent true` diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh new file mode 100755 index 0000000..861f754 --- /dev/null +++ b/scripts/cpu_info.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +get_percent() +{ + arg=$1 + case "$arg" in + Linux) + percent=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}') + echo $percent + ;; + + Mac) + # TODO - Mac compatability + ;; + + Windows) + # TODO - windows compatability + ;; + esac +} +check_os() +{ + # Check os + case $(uname -s) in + Linux) + get_percent Linux + ;; + + Darwin) + # Dont have a mac currently, TODO - Mac compatability + get_percent Mac + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + get_percent Windows + # leaving empty - TODO - windows compatability + ;; + + *) + ;; + esac +} + + + +main() +{ + cpu_percent=$(check_os) + echo "CPU $cpu_percent" + sleep 5 +} +#run main driver +main diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 5cd2155..27a5d2a 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -27,6 +27,7 @@ main() show_left_sep=$(get_tmux_option "@dracula-show-left-sep" ) show_right_sep=$(get_tmux_option "@dracula-show-right-sep" ) show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false) + show_cpu_percentage=$(get_tmux_option "@dracula-cpu-percent" false) # Dracula Color Pallette white='#f8f8f2' @@ -64,6 +65,10 @@ main() if $show_weather; then $current_dir/sleep_weather.sh $show_fahrenheit & fi + + if $show_cpu_percentage; then + $current_dir/cpu_info.sh & + fi # sets refresh interval to every 5 seconds @@ -98,6 +103,11 @@ main() tmux set-option -g status-right "" powerbg=${gray} + if $show_cpu_percentage; then + tmux set-option -ga status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/cpu_info.sh)" + powerbg=${pink} + fi + if $show_battery; then # battery tmux set-option -g status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh)" powerbg=${pink} @@ -131,6 +141,10 @@ main() tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh) " fi + if $show_cpu_percentage; then + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}]#($current_dir/cpu_info.sh) " + fi + if $show_network; then # network tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh) " fi From 3e4add69187aad485e43e87b28187f910161d3ce Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 1 Jun 2020 10:39:17 -0400 Subject: [PATCH 02/21] Added Mac (? testing) support, added comments --- scripts/cpu_info.sh | 4 ++-- scripts/dracula.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 861f754..74aaa46 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -10,7 +10,7 @@ get_percent() ;; Mac) - # TODO - Mac compatability + percent=$(ps -A -o %cpu | awk '{s+=$1} END {print s "%"}') ;; Windows) @@ -27,7 +27,7 @@ check_os() ;; Darwin) - # Dont have a mac currently, TODO - Mac compatability + # Dont have a mac currently, TODO - Mac compatability - May have a solution, testing get_percent Mac ;; diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 27a5d2a..aebdbcf 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -66,11 +66,11 @@ main() $current_dir/sleep_weather.sh $show_fahrenheit & fi + # start cpu script in the background if $show_cpu_percentage; then $current_dir/cpu_info.sh & fi - # sets refresh interval to every 5 seconds tmux set-option -g status-interval 5 From a17746e0d131759d103fba28c8eba5294d6bf2a5 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 1 Jun 2020 11:53:16 -0400 Subject: [PATCH 03/21] Fixed a bug --- scripts/cpu_info.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 74aaa46..37560ab 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -11,6 +11,7 @@ get_percent() Mac) percent=$(ps -A -o %cpu | awk '{s+=$1} END {print s "%"}') + echo $percent ;; Windows) From 1451ccaff76ae4da537f167deace9c86918f2adc Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Mon, 1 Jun 2020 19:27:15 -0400 Subject: [PATCH 04/21] Fixed it for powerline, removed 'testing' on Mac --- scripts/cpu_info.sh | 3 +-- scripts/dracula.sh | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 37560ab..8879fb3 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -28,7 +28,6 @@ check_os() ;; Darwin) - # Dont have a mac currently, TODO - Mac compatability - May have a solution, testing get_percent Mac ;; @@ -48,7 +47,7 @@ main() { cpu_percent=$(check_os) echo "CPU $cpu_percent" - sleep 5 + sleep 10 } #run main driver main diff --git a/scripts/dracula.sh b/scripts/dracula.sh index aebdbcf..1e567e8 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -103,16 +103,16 @@ main() tmux set-option -g status-right "" powerbg=${gray} - if $show_cpu_percentage; then - tmux set-option -ga status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/cpu_info.sh)" - powerbg=${pink} - fi - if $show_battery; then # battery tmux set-option -g status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh)" powerbg=${pink} fi + if $show_cpu_percentage; then + tmux set-option -ga status-right "#[fg=${orange},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh)" + powerbg=${orange} + fi + if $show_network; then # network tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh)" powerbg=${cyan} From 3ec7e1a038e2326843aec6885f9f1f0234a567df Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 2 Jun 2020 22:55:14 -0400 Subject: [PATCH 05/21] For some reason branch wasnt up to date? Fixed --- scripts/cpu_info.sh | 28 ++-------------------------- scripts/dracula.sh | 5 ----- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index 8879fb3..cee644f 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -2,8 +2,7 @@ get_percent() { - arg=$1 - case "$arg" in + case $(uname -s) in Linux) percent=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}') echo $percent @@ -19,33 +18,10 @@ get_percent() ;; esac } -check_os() -{ - # Check os - case $(uname -s) in - Linux) - get_percent Linux - ;; - - Darwin) - get_percent Mac - ;; - - CYGWIN*|MINGW32*|MSYS*|MINGW*) - get_percent Windows - # leaving empty - TODO - windows compatability - ;; - - *) - ;; - esac -} - - main() { - cpu_percent=$(check_os) + cpu_percent=$(get_percent) echo "CPU $cpu_percent" sleep 10 } diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 1e567e8..fbf27f8 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -66,11 +66,6 @@ main() $current_dir/sleep_weather.sh $show_fahrenheit & fi - # start cpu script in the background - if $show_cpu_percentage; then - $current_dir/cpu_info.sh & - fi - # sets refresh interval to every 5 seconds tmux set-option -g status-interval 5 From 87ef58abfca7bcfa3e4e794339a7a326eadc9522 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Wed, 3 Jun 2020 22:58:26 -0400 Subject: [PATCH 06/21] Fixed the uname -s output case statement issue --- scripts/cpu_info.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/cpu_info.sh b/scripts/cpu_info.sh index cee644f..c5180cd 100755 --- a/scripts/cpu_info.sh +++ b/scripts/cpu_info.sh @@ -8,12 +8,12 @@ get_percent() echo $percent ;; - Mac) + Darwin) percent=$(ps -A -o %cpu | awk '{s+=$1} END {print s "%"}') echo $percent ;; - Windows) + CYGWIN*|MINGW32*|MSYS*|MINGW*) # TODO - windows compatability ;; esac @@ -25,5 +25,6 @@ main() echo "CPU $cpu_percent" sleep 10 } -#run main driver + +# run main driver main From 614d0123520411e29728e7b7a44d66793eced401 Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Wed, 3 Jun 2020 20:33:41 -0700 Subject: [PATCH 07/21] fix space for non powerline --- scripts/dracula.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index fbf27f8..e3b3bbe 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -137,7 +137,7 @@ main() fi if $show_cpu_percentage; then - tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}]#($current_dir/cpu_info.sh) " + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh) " fi if $show_network; then # network From d311e94d868b0d59a896a4c09b6f658b1059519f Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Wed, 3 Jun 2020 20:40:46 -0700 Subject: [PATCH 08/21] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cefd29f..33a6b36 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 +* CPU usage * Color code based on if prefix is active or not * List of windows with current window highlighted * When prefix is enabled smiley face turns from green to yellow From 3d5a3cbb8f1a843ae49aba5f0678690cbfc57d6e Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Wed, 3 Jun 2020 23:44:17 -0400 Subject: [PATCH 09/21] Added ram percentage support --- INSTALL.md | 1 + scripts/dracula.sh | 9 +++++++++ scripts/ram_info.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100755 scripts/ram_info.sh diff --git a/INSTALL.md b/INSTALL.md index 3dd0106..24667b1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -25,3 +25,4 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi * Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character. * Enable high contrast pane border: `set -g @dracula-border-contrast true` * Enable cpu percentage: `set -g @dracula-cpu-percent true` +* Enable ram percentage: `set -g @dracula-ram-percent true` diff --git a/scripts/dracula.sh b/scripts/dracula.sh index e3b3bbe..cc2c882 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -28,6 +28,7 @@ main() show_right_sep=$(get_tmux_option "@dracula-show-right-sep" ) show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false) show_cpu_percentage=$(get_tmux_option "@dracula-cpu-percent" false) + show_ram_percentage=$(get_tmux_option "@dracula-ram-percent" false) # Dracula Color Pallette white='#f8f8f2' @@ -103,6 +104,11 @@ main() powerbg=${pink} fi + if $show_ram_percent; then + tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/ram_info.sh)" + powerbg=${cyan} + fi + if $show_cpu_percentage; then tmux set-option -ga status-right "#[fg=${orange},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh)" powerbg=${orange} @@ -135,6 +141,9 @@ main() if $show_battery; then # battery tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh) " fi + if $show_ram_percentage; then + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/ram_info.sh) " + fi if $show_cpu_percentage; then tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh) " diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh new file mode 100755 index 0000000..3130e75 --- /dev/null +++ b/scripts/ram_info.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +get_percent() +{ + case $(uname -s) in + Linux) + percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}') + echo $percent + ;; + + Darwin) + # TODO - Mac compatability + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + # TODO - windows compatability + ;; + esac +} + +main() +{ + ram_percent=$(get_percent) + echo "RAM $ram_percent" + sleep 10 +} +#run main driver +main From 410902b6d8ee02c7ff177c1d4ace5e7e5570ae87 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Wed, 3 Jun 2020 23:46:33 -0400 Subject: [PATCH 10/21] forgot to add a file --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 33a6b36..b76073d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul * Network connection status and SSID * Battery percentage and AC power connection status * CPU usage +* RAM usage * Color code based on if prefix is active or not * List of windows with current window highlighted * When prefix is enabled smiley face turns from green to yellow From 833baa96165e16bf451152725fa4ed09a6147da3 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Thu, 4 Jun 2020 00:33:47 -0400 Subject: [PATCH 11/21] I think this will add Mac/Darwin support --- scripts/ram_info.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 3130e75..6fc4705 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -9,7 +9,8 @@ get_percent() ;; Darwin) - # TODO - Mac compatability + percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') + echo $percent ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) @@ -24,5 +25,6 @@ main() echo "RAM $ram_percent" sleep 10 } + #run main driver main From 3ec3f2f08bc25e4fd22fd4d30e75db8373e7b016 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Thu, 4 Jun 2020 12:01:53 -0400 Subject: [PATCH 12/21] Fixed weird spacing on session/window/smiley on left side --- scripts/dracula.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index cc2c882..77e244d 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -47,11 +47,11 @@ main() # Handle left icon configuration case $show_left_icon in smiley) - left_icon="☺ ";; + left_icon="☺";; session) - left_icon="#S ";; + left_icon="#S";; window) - left_icon="#W ";; + left_icon="#W";; *) left_icon=$show_left_icon;; esac From 4cf72d94c399914641fa019447c4efbc09b1c98f Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 6 Jun 2020 22:41:30 -0400 Subject: [PATCH 13/21] I hope this works lol --- scripts/ram_info.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 6fc4705..ff17c91 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -4,13 +4,23 @@ get_percent() { case $(uname -s) in Linux) - percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}') - echo $percent + # percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}') + used_mem=$(free -g | grep Mem: | awk '{mem += $3} END {print mem}') + total_mem=$(free -h | grep Mem: | awk '{mem += $2} END {print mem}') + if (( $used_mem == 0 )); then + memory_usage=$(free -m | grep Mem: | awk '{mem += $3} END {print mem}') + echo $memory_usage\M\B/$total_mem\G\B + else + memory_usage=$(free -g | grep Mem: | awk '{mem += $3} END {print mem}') + echo $memory_usage\G\B/$total_mem\G\B + fi ;; Darwin) - percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') - echo $percent + # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') + used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{mem += $2} END {print mem}') + total_mem=$(hwprefs memory_size | sed 's/ //g; s/B//g;') + echo $used_mem/$total_mem ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) From 8ba9b201522da6e7c4d70b1c7c98e4eb34a23fea Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 7 Jun 2020 19:08:55 -0400 Subject: [PATCH 14/21] realized the command i was trying to use was depreciated --- scripts/ram_info.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index ff17c91..da5bf76 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -19,8 +19,8 @@ get_percent() Darwin) # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{mem += $2} END {print mem}') - total_mem=$(hwprefs memory_size | sed 's/ //g; s/B//g;') - echo $used_mem/$total_mem + total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{mem += $2} END {print mem}') + echo $used_mem/$total_mem\G\B ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) From 167260211ad6dec127eec878e75b52362f9ed1f6 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 7 Jun 2020 19:16:55 -0400 Subject: [PATCH 15/21] Found a nice lil trick --- scripts/ram_info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index da5bf76..ed5c1bd 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -19,7 +19,7 @@ get_percent() Darwin) # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{mem += $2} END {print mem}') - total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{mem += $2} END {print mem}') + total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}' | sed 's/used//g') echo $used_mem/$total_mem\G\B ;; From eeff7ec82dad99d07c00ba36976d57134eed3bba Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 7 Jun 2020 19:19:52 -0400 Subject: [PATCH 16/21] Trying to get this to work --- scripts/dracula.sh | 6 +++--- scripts/ram_info.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 77e244d..cc2c882 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -47,11 +47,11 @@ main() # Handle left icon configuration case $show_left_icon in smiley) - left_icon="☺";; + left_icon="☺ ";; session) - left_icon="#S";; + left_icon="#S ";; window) - left_icon="#W";; + left_icon="#W ";; *) left_icon=$show_left_icon;; esac diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index ed5c1bd..60de0cd 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -18,7 +18,7 @@ get_percent() Darwin) # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') - used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{mem += $2} END {print mem}') + used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{print $2 $3}' | sed 's/used//g') total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}' | sed 's/used//g') echo $used_mem/$total_mem\G\B ;; From 420eed6fd40ffeadad23ab92b916dfd07e65a86d Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 7 Jun 2020 19:21:46 -0400 Subject: [PATCH 17/21] dont mind the commits, Im testing it on a mac, and editing and pushing it from my desktop --- scripts/ram_info.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 60de0cd..f9d207c 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -20,7 +20,7 @@ get_percent() # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{print $2 $3}' | sed 's/used//g') total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}' | sed 's/used//g') - echo $used_mem/$total_mem\G\B + echo $used_mem/$total_mem ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) From e41cabee1c4d19877dcc82080fdbab98d07847f5 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 7 Jun 2020 19:36:26 -0400 Subject: [PATCH 18/21] Changed naming of some things --- INSTALL.md | 4 ++-- scripts/dracula.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 24667b1..abd5055 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,5 +24,5 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi * Enable military time: `set -g @dracula-military-time true` * Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character. * Enable high contrast pane border: `set -g @dracula-border-contrast true` -* Enable cpu percentage: `set -g @dracula-cpu-percent true` -* Enable ram percentage: `set -g @dracula-ram-percent true` +* Enable cpu percentage: `set -g @dracula-cpu-usage true` +* Enable ram percentage: `set -g @dracula-ram-usage true` diff --git a/scripts/dracula.sh b/scripts/dracula.sh index cc2c882..04911f5 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -27,8 +27,8 @@ main() show_left_sep=$(get_tmux_option "@dracula-show-left-sep" ) show_right_sep=$(get_tmux_option "@dracula-show-right-sep" ) show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false) - show_cpu_percentage=$(get_tmux_option "@dracula-cpu-percent" false) - show_ram_percentage=$(get_tmux_option "@dracula-ram-percent" false) + show_cpu_usage=$(get_tmux_option "@dracula-cpu-usage" false) + show_ram_usage=$(get_tmux_option "@dracula-ram-usage" false) # Dracula Color Pallette white='#f8f8f2' @@ -104,12 +104,12 @@ main() powerbg=${pink} fi - if $show_ram_percent; then + if $show_ram_usage; then tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/ram_info.sh)" powerbg=${cyan} fi - if $show_cpu_percentage; then + if $show_cpu_usage; then tmux set-option -ga status-right "#[fg=${orange},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh)" powerbg=${orange} fi @@ -141,11 +141,11 @@ main() if $show_battery; then # battery tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/battery.sh) " fi - if $show_ram_percentage; then + if $show_ram_usage; then tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/ram_info.sh) " fi - if $show_cpu_percentage; then + if $show_cpu_usage; then tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #($current_dir/cpu_info.sh) " fi From ac2f789ff4b5419791347b7f1afb09b5f7eeee55 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sat, 13 Jun 2020 21:42:27 -0400 Subject: [PATCH 19/21] Fixed reviews --- scripts/ram_info.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index f9d207c..8f4d40a 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -18,9 +18,14 @@ get_percent() Darwin) # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') - used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{print $2 $3}' | sed 's/used//g') - total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}' | sed 's/used//g') - echo $used_mem/$total_mem + used_mem=$(vm_stat | grep -i "Pages active:" | sed 's/\.//g' | awk '{printf "%d", $3*4096/1024/1024}') + total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}') + if (( $used_mem < 1024 )); then + echo $used_mem\M\B/$total_mem + else + memory=$(($used_mem / 1024)) + echo $memory\G\B/$total_mem + fi ;; CYGWIN*|MINGW32*|MSYS*|MINGW*) From 0516471e72c213dc333ca297465a8c3a32f08267 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Sun, 28 Jun 2020 13:34:08 -0400 Subject: [PATCH 20/21] mac compatability is working --- scripts/.ram_info.sh.swp | Bin 0 -> 12288 bytes scripts/ram_info.sh | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 scripts/.ram_info.sh.swp diff --git a/scripts/.ram_info.sh.swp b/scripts/.ram_info.sh.swp new file mode 100644 index 0000000000000000000000000000000000000000..eb675d967b73275fac4b31abb9aefb3e3be9dcb8 GIT binary patch literal 12288 zcmeI2&u<$=6vrn>Js8@8C>KtBwKs|#Sg*Y5iSXJ`H9&F4*4 zi88yT8yj`HP%H@?F9`AB&wt7vDL49R3CyU;}J`4X^<=zy{a=8(;%Zt${dP5Fa4>XT~!y z$LEE)^SH?;Hoykh02^QfY=8~00XDz}*Z><~18m?aG$30-eDbUi@;M}r|Nl?^{{QQF zA^rrvfnULQ;7c$7Hu&ST5D&o+G{D>7pHo8o0)7PFgNNWNFa#&SXD5aD7&zb#xCG9E zm%&Tm40wb*egZ#$Z^1XK z-L4xC@WdOp)^BcXEjYFR4A-a+);iK zWI8ZL(*qqV$ch5T?W%|xTW?{XGWIH~8YX*v5Gr~=?MQ``t&eiQn8gj*ze`K|VdVNT z88#V};nFD0NnQvX2O*hVDwCNg*8EAw-6H}xmZM`ea`|nv+dxdblX5OA&=L^Z@ z(!sGD$}YCH{p_n4)HEul@!ELY9F41ufkRE^8kqqtLgDoL$@ME$GRi}GbF)U{+;KOJ zP?Hhre00@zdRn&CT_??L*68yKs9Ht+4qHCyG&@HQWFIoknZ@!Xwq|Re#+g=q^IElPr=?DoPOT_y@>z- literal 0 HcmV?d00001 diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 8f4d40a..3d40303 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -18,12 +18,12 @@ get_percent() Darwin) # percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}') - used_mem=$(vm_stat | grep -i "Pages active:" | sed 's/\.//g' | awk '{printf "%d", $3*4096/1024/1024}') + used_mem=$(top -l 1 -s 0 | grep PhysMem | sed 's/[a-z]//g; s/[A-Z]//g; s/[()]//g' | awk '{printf "%d\n", $2-$3-$5}') total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}') if (( $used_mem < 1024 )); then echo $used_mem\M\B/$total_mem else - memory=$(($used_mem / 1024)) + memory=$(($used_mem/1024)) echo $memory\G\B/$total_mem fi ;; From 393b4fa5a287ee472aed5f72a0aee486ec0ef4d0 Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Sun, 28 Jun 2020 15:48:24 -0700 Subject: [PATCH 21/21] removed swp file --- scripts/.ram_info.sh.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 scripts/.ram_info.sh.swp diff --git a/scripts/.ram_info.sh.swp b/scripts/.ram_info.sh.swp deleted file mode 100644 index eb675d967b73275fac4b31abb9aefb3e3be9dcb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&u<$=6vrn>Js8@8C>KtBwKs|#Sg*Y5iSXJ`H9&F4*4 zi88yT8yj`HP%H@?F9`AB&wt7vDL49R3CyU;}J`4X^<=zy{a=8(;%Zt${dP5Fa4>XT~!y z$LEE)^SH?;Hoykh02^QfY=8~00XDz}*Z><~18m?aG$30-eDbUi@;M}r|Nl?^{{QQF zA^rrvfnULQ;7c$7Hu&ST5D&o+G{D>7pHo8o0)7PFgNNWNFa#&SXD5aD7&zb#xCG9E zm%&Tm40wb*egZ#$Z^1XK z-L4xC@WdOp)^BcXEjYFR4A-a+);iK zWI8ZL(*qqV$ch5T?W%|xTW?{XGWIH~8YX*v5Gr~=?MQ``t&eiQn8gj*ze`K|VdVNT z88#V};nFD0NnQvX2O*hVDwCNg*8EAw-6H}xmZM`ea`|nv+dxdblX5OA&=L^Z@ z(!sGD$}YCH{p_n4)HEul@!ELY9F41ufkRE^8kqqtLgDoL$@ME$GRi}GbF)U{+;KOJ zP?Hhre00@zdRn&CT_??L*68yKs9Ht+4qHCyG&@HQWFIoknZ@!Xwq|Re#+g=q^IElPr=?DoPOT_y@>z-