Gavin’s Odd Bits of Code

2009-04-09 (Thu)

csshX 0.59 – Multi-monitor support..

Filed under: Software — Gavin Brock @ 11:57 pm

Thanks to some great publicity from Mac OS X Hints, I have received lots of feedback and bug reports.

Number one issue has been multi-monitor support, and problems related to it. This is now working.

To use it, add a –screen n to your command line, where n is the screen number. It will default to screen zero if omitted.

This was actually a nasty problem since there is no quick AppleScript solution, and the only way to get screen counts and sizes is by calling the AppKit frameworks. This is Objective-C only and since csshX is written in perl, I had to mess with the PerlObjCBridge (or as it’s known) to get the NSFrame. To make matters worse, NSFrame is not even Objective C, rather it’s a pure C struct. In the end, I use NSValue to give me a string “description” of the data, and parse this with regex’s (differenet for 10.4 and 10.5 naturally!).

Other changes:

  • Cursor keys now working for terminal applications like more and vim
  • Windows will no longer cover the dock (wherever it happens to be)
  • A –debug option for when things go wrong
  • Some documentation corrections.

The package is available at:

1 Comment »

  1. Nice work man, really effing handy! This update is working perfectly with multiple monitors.

    Comment by Chris Brant — 2009-04-10 (Fri) @ 9:45 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: