Skip to content

Instantly share code, notes, and snippets.

@philgood
Created July 7, 2018 08:19
Show Gist options
  • Save philgood/4e97c736f0d5b4992825019dd1b01bb6 to your computer and use it in GitHub Desktop.
Save philgood/4e97c736f0d5b4992825019dd1b01bb6 to your computer and use it in GitHub Desktop.
CPU load - Bitbar plugin to work with argos gnome extension
#!/usr/bin/env bash
# <bitbar.title>CPU Load</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Paul W. Rankin</bitbar.author>
# <bitbar.modified>Ryan Phelan - to work with argos in linux
# <bitbar.author.github>rnkn</bitbar.author.github>
# <bitbar.desc>Shows CPU load as a percentage (without using top).</bitbar.desc>
# <bitbar.image>http://photos.paulwrankin.com/screenshots/cpu-load.png</bitbar.image>
# <bitbar.dependencies>bash</bitbar.dependencies>
# BitBar CPU Load plugin
ncpu=$(nproc)
total=$(ps -Ao %cpu= | paste -sd+ - | bc)
usage=$(echo "scale = 2; $total / $ncpu" | bc)
printf "%0.1f%%\n" "$usage"
echo "---"
echo "Refresh | refresh=true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment