Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freebsd compatibility #94

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ This is done by introducing 12 new format strings that can be added to
- `#{cpu_bg_color}` - will change the background color based on the CPU percentage
- `#{cpu_fg_color}` - will change the foreground color based on the CPU percentage
- `#{ram_icon}` - will display a RAM status icon
- `#{ram_percentage}` - will show RAM percentage (averaged across cores)
- `#{ram_percentage}` - will show RAM percentage (averaged across cores)\
(freebsd user will need to install `freecolor`: `$ pkg install freecolor`)
- `#{ram_bg_color}` - will change the background color based on the RAM percentage
- `#{ram_fg_color}` - will change the foreground color based on the RAM percentage
- `#{cpu_temp_icon}` - will display a CPU temperature status icon
Expand Down
2 changes: 1 addition & 1 deletion scripts/cpu_percentage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ print_cpu_percentage() {
elif is_osx; then
cached_eval iostat -c 2 disk0 | sed '/^\s*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$6} END {printf(format, usage)}' | sed 's/,/./'
elif is_freebsd || is_openbsd; then
cached_eval iostat -c 2 | sed '/^\s*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$NF} END {printf(format, usage)}' | sed 's/,/./'
cached_eval iostat -c 2 | sed '/^[[:space:]]*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$NF} END {printf(format, usage)}' | sed 's/,/./'
else
echo "Unknown iostat version please create an issue"
fi
Expand Down
2 changes: 2 additions & 0 deletions scripts/ram_percentage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ print_ram_percentage() {

if command_exists "free"; then
cached_eval free | awk -v format="$ram_percentage_format" '$1 ~ /Mem/ {printf(format, 100*$3/$2)}'
elif command_exists "freecolor"; then # freebsd: install freecolor first: $ pkg install freecolor
cached_eval freecolor -m -o | awk -v format="$ram_percentage_format" '$1 ~ /Mem/ {printf(format, 100*$3/$2)}'
elif command_exists "vm_stat"; then
# page size of 4096 bytes
stats="$(cached_eval vm_stat)"
Expand Down