Thursday, March 28, 2024
spot_img

iStat Pro Widget for OS X 10.8 Mountain Lion

If you use the iStat Pro dashboard widget you may have noticed the following issues after you updated to new version of OS X such as Mountain Lion.

  • Processes stopped listing correctly after you installed Mountain Lion.
  • It also no long displays your external IP address.
  • There is also a cosmetic issue with the way hard drive usage is displayed when the widget is in Tall mode.

The developer has, apparently, announced they will not update it for full Mountain Lion (10.8.x) compatibility. There is, however, a very easy DIY fix. Here’s how.

Credit for these fixes goes to the many folk in the Macrumors forum who collectively provided a way to fix iStat Pro.
You can find that discussion here: http://forums.macrumors.com/showthread.php?t=1407448

If you don’t wish to apply all these fixes yourself, jump to the bottom of the article. You can then download the modified widget and install it.

Fixing the Processes display

First let’s get the Processes displaying

  1. Find the widget file. It will be in ~/Library/Widgets or /Library/Widgets
    In Finder use the Go menu, and select Go To Folder. Copy and paste in the above file location.
    The file you are looking for is called iStat Pro.wdgt
  2. If you can’t find your ~/Library/     (which is the   /username/Library/) folder, plug this command into Terminal to permanently unhide it:    chflags nohidden ~/Library/
  3. Control-Click (or double click / two-finger click) on the file. Select Show Package Contents.
  4. Depending on the view mode you use in iStat Pro, you need to edit one or both of these files: wide.js and/or tall.js – I recommend editing both. Use any text editor.
  5. Search for this bit of code:     PID|$1
  6. Change it to:  PID| $1       You are simply adding one space in front of the $ sign.

You should end up with this code segment looking like this (changed code in bold):

WideSkinController.prototype.updateProcesses = function(){
var _self = this;
var exclude = "";
if(p.v("processes_excludewidgets") == 'on')
exclude = " grep -v DashboardClient | ";
if(p.v("processes_sort_mode") == 'cpu')
widget.system('ps -arcwwwxo "pid %cpu command" | egrep "PID|$1" | grep -v grep | ' + exclude + ' head -7 | tail -6 | awk \'{print "<pid>"$1"</pid><cpu>"$2"</cpu><name>"$3,$4,$5"</name></item>"}\'', function(data){ _self.updateProcessesOut(data);});
else
widget.system('ps -amcwwwxo "pid rss command" | egrep "PID|$1" | grep -v grep | ' + exclude + ' head -7 | tail -6 | awk \'{print "<pid>"$1"</pid><cpu>"$2"</cpu><name>"$3,$4,$5"</name></item>"}\'', function(data){ _self.updateProcessesOut(data);});
}

Fixing the external IP address issue

Next let’s get the external IP address displaying. You will notice it says Ext: Unknown.

  1. The file you need to edit this time (using the above instructions on how to find the widget) is ../scripts/core.js
  2. Find and replace the code in bold:
function getExtIP(){ ipURL = 'http://whatsmyip.islayer.com/?random='+new Date().getTime(); ipConnection = new XMLHttpRequest(); ipConnection.open("GET",ipURL,true); ipConnection.onreadystatechange = function() {

Replace it with the code in bold below:
function getExtIP(){
        ipURL = 'http://ip.bjango.com';
        ipConnection = new XMLHttpRequest();
        ipConnection.open("GET",ipURL,true);
        ipConnection.onreadystatechange = function() {

If you have your own web server or shared hosting account, an alternative option is to place a small php file on the server. Create a file with the name ip.php (or something along those lines). Put the following code into it:

<?php
/* $Id: ip.php,v 1.3 2008/09/24 13:58:49 pblankenbaker Exp $
*
* Small PHP script to "echo" back the IP address of the remote
* system as it appears to the server.
*
* Example client side usage:
*
* wget http://www.networksecuritytoolkit.org/nst/tools/ip.php -O -
*
*/

// Echo back IP address as a "plain text" document

header('Content-type: text/plain');

// Check to see if server has been forwarded the request
if (isset($_SERVER['HTTP_X_REMOTE_ADDR'])) {
printf("%s\n", $_SERVER['HTTP_X_REMOTE_ADDR']);
} else {
printf("%s\n", $_SERVER['REMOTE_ADDR']);
}
?>

Save this file to a publicly accessible folder on your web server. In the www root will do the trick. If you are going to use this method, then the correct final code change for the above mentioned ../scripts/core.js file is this:

function getExtIP(){
        ipURL = 'http://YOURDOMAIN.COM/ip.php';
        ipConnection = new XMLHttpRequest();
        ipConnection.open("GET",ipURL,true);
        ipConnection.onreadystatechange = function() {

You need to replace YOURDOMAIN.COM with the domain of your web site.

Fixing hard drive indicators in wide mode

Istat drive fix

If you use iStat Pro in wide mode you will notice the usage indicators for the hard drives have two bars instead of just one. The image to the right shows an example of what I mean.

Here is how to fix that.

Using the same instructions above to locate and open the widget file, do the following.

  1. Open core.css in a text editor.
  2. Find the following line of code:  .barbg { 
  3. Edit the file so that it looks like this:
.barbg {
	background-image:url(./images/common/bar_horizontal_bg.png);
	height:8px;
	overflow:hidden;
}

.verticalbarbg { background-image:url(./images/common/bar_vertical_bg.png); width:8px; overflow:hidden; background-position: -4px 0; }

.verticalbar { background-position: -4px 0; }

canvas { background-image:url(./images/common/graph_bg.png); }

You need to add in the blue lines of code shown above. Save the file.

Restart the Dashboard

After you have applied all the changes, save your modified files, and restart the dashboard with the following command in Terminal

killall Dock

Download the fixed iStat Pro files

iStat Pro is no longer available for download on the Apple Widgets site. If you need it below is a link to the full and nano version. Or perhaps you don’t feel like getting your hands dirty with code, and want the finished update.

Download from here

Recent Articles

spot_img

Related Stories

29 Comments

  1. Regardless of the the unmodified version or the modified version of iStat Pro I use, nothing works. I add the widget to the dashboard and just just an small icon with the word iStat and a “i” and “?” icon in the left portion of it. Nothing is clickable and it displays information, which is different than I see with anything else. Have you seen this? Running 10.8.2 on a MBPR

    • Sorry to hear that.
      I have it running fine, with the suggested changes, on MBP 17″, with OS X 10.8.2
      I am not sure what else to suggest. Except perhaps to complete remove the widget (using something like AppCleaner – which has a Widget removal option). And then installing again.

  2. Hi, there! I am trying to install the widget in my MacAir with OS X 10.8.2 and I got this message rom Widget Installer: You can’t install “.iStat Pro.wdgt” becaus it is not a valid widget. Could you help me? Thank you in advance.

    • Hmmm… strange. I can only suggest you download the widget again. Is this one you have modified (such as applying the fixes shared in my blog post)?

  3. Hi Jonathan,
    Thanks a million for uploading the updated widget. I seem to have however one small issue – it seems it still counts disk size in the ‘old fashion’ way and shows different values from the system size. Do you think you could implement the change please?

  4. Awesome guide and very good work ! Thanks for solving these issues.

    How about asking Bjango to release the source code of the binary file they’re using to poll all the data that is shown within the widget ? We could improve it ourselves, add functionalities and so on ! What do you think ?

  5. Sorry, revised … it seems that the bug that leads to “-4” is fixed to either set it to “0” or remove the line.

    .barbg {
    background-image:url(./images/common/bar_horizontal_bg.png);
    height:8px;
    overflow:hidden;
    }

    .verticalbarbg {
    background-image:url(./images/common/bar_vertical_bg.png);
    width:8px;
    overflow:hidden;
    background-position: -0px 0;
    }

    .verticalbar {
    background-position: -0px 0;
    }

    canvas {
    background-image:url(./images/common/graph_bg.png);

  6. Just moved from 10.7 to 10.9. The transition has been quite smooth for the most part, and all of the other “bumps” I’ve run into so far, I’ve been able to fix myself, but this one had me stumped. Followed both your instructions above for processes and external IP, and now all is well. Just wanted to thank you and also let you know (if someone hasn’t already) that the above works for Mavericks as well as Mountain Lion.

  7. Recently updated my 2009 MacBook to a new MacBook Pro/Retina I was disappointed with the non-functioning items of iStat Pro so I was pleased to find your site. As mentioned above this works with the latest version of Mavericks. I do have a question/request: do you know of a similar fix for the Temperatures section? The CPU and Airport Card temperatures are no longer displayed and I have always found them to be most closely associated with fan speed. Many thanks for these fixes.

    -Brian

Leave a Reply to Johannes Cancel reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox