From e2004baa51022f7a402665945b81f98df0566ab5 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 1 Sep 2020 21:24:39 -0400 Subject: [PATCH 1/4] added ram support --- scripts/ram_info.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/ram_info.sh b/scripts/ram_info.sh index 7b3a6a2..24cc450 100755 --- a/scripts/ram_info.sh +++ b/scripts/ram_info.sh @@ -28,6 +28,25 @@ get_percent() echo $memory\G\B/$total_mem fi ;; + + FreeBSD) + # Looked at the code from neofetch + hw_pagesize="$(sysctl -n hw.pagesize)" + mem_inactive="$(($(sysctl -n vm.stats.vm.v_inactive_count) * hw_pagesize))" + mem_unused="$(($(sysctl -n vm.stats.vm.v_free_count) * hw_pagesize))" + mem_cache="$(($(sysctl -n vm.stats.vm.v_cache_count) * hw_pagesize))" + + free_mem=$(((mem_inactive + mem_unused + mem_cache) / 1024 / 1024)) + total_mem=$(($(sysctl -n hw.physmem) / 1024 / 1024)) + used_mem=$((total_mem - free_mem)) + echo $used_mem + 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*) # TODO - windows compatability From e5550a61d2e812a54345671340124770371bd890 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 1 Sep 2020 21:31:28 -0400 Subject: [PATCH 2/4] Revert "adding the option to turn off time on powerline" This reverts commit 288cdc5a99c170048b3489143e34a3198e21a6b2. --- scripts/dracula.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index f2d68c3..54798bd 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -178,13 +178,12 @@ main() tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) " fi - if $show_time; then - if $show_military; then # military time - tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " - else - tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " - fi + if $show_military; then # military time + tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " + else + tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " fi + tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W " fi From a2874eed9575cd9598621eeb8c8104de112e8992 Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Tue, 1 Sep 2020 21:33:39 -0400 Subject: [PATCH 3/4] Revert "adding the option to turn off time on powerline" This reverts commit 288cdc5a99c170048b3489143e34a3198e21a6b2. Revert "Option to remove the time" This reverts commit c933dae67e5171fc6ab4395ccfb3ec886871be98. --- scripts/dracula.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index f2d68c3..bf7388c 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -31,7 +31,6 @@ main() show_cpu_usage=$(get_tmux_option "@dracula-cpu-usage" false) 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) # Dracula Color Pallette white='#f8f8f2' @@ -139,12 +138,11 @@ main() tmux set-option -ga status-right "#[fg=${orange},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt)" powerbg=${orange} fi - if $show_time; then - if $show_military; then # military time - tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " - else - tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " - fi + + if $show_military; then # military time + tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " + else + tmux set-option -ga status-right "#[fg=${dark_purple},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " fi tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}" @@ -178,13 +176,12 @@ main() tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) " fi - if $show_time; then - if $show_military; then # military time - tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " - else - tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " - fi + if $show_military; then # military time + tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %R ${timezone} " + else + tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p ${timezone} " fi + tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W " fi From 3ccb5359ac48d345cd5197d88653fc45753d9ecf Mon Sep 17 00:00:00 2001 From: Ethan Edwards Date: Wed, 2 Sep 2020 12:41:30 -0400 Subject: [PATCH 4/4] added battery support --- scripts/battery.sh | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/scripts/battery.sh b/scripts/battery.sh index 4d57ad0..d6cae11 100755 --- a/scripts/battery.sh +++ b/scripts/battery.sh @@ -43,6 +43,10 @@ battery_percent() echo $(pmset -g batt | grep -Eo '[0-9]?[0-9]?[0-9]%') ;; + FreeBSD) + echo $(apm | sed '8,11d' | grep life | awk '{print $4}') + ;; + CYGWIN*|MINGW32*|MSYS*|MINGW*) # leaving empty - TODO - windows compatability ;; @@ -57,13 +61,17 @@ battery_status() # Check OS case $(uname -s) in Linux) - status=$(linux_acpi status) + status=$(linux_acpi status) ;; Darwin) status=$(pmset -g batt | sed -n 2p | cut -d ';' -f 2) ;; + FreeBSD) + status=$(apm | sed '8,11d' | grep Status | awk '{printf $3}') + ;; + CYGWIN*|MINGW32*|MSYS*|MINGW*) # leaving empty - TODO - windows compatability ;; @@ -72,11 +80,28 @@ battery_status() ;; esac - if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then - echo '' - else - echo 'AC' - fi + case $status in + discharging|Discharging) + echo '' + ;; + high) + echo '' + ;; + charging) + echo 'AC' + ;; + *) + echo 'AC' + ;; + esac + ### Old if statements didn't work on BSD, they're probably not POSIX compliant, not sure + # if [ $status = 'discharging' ] || [ $status = 'Discharging' ]; then + # echo '' + # # elif [ $status = 'charging' ]; then # This is needed for FreeBSD AC checking support + # # echo 'AC' + # else + # echo 'AC' + # fi } main()