I searched far and wide, but only found third party utility references (an app called cscreen, for one) to get the current display layout programmatically in a script (AppleScript / bash). This could be easily munged into AppleScript, but here's what I came up with for a bash function that output something like:
Display Unit: 0 with height 900 and width 1440 is positioned at (0, 0)
Display Unit: 1 with height 1024 and width 1280 is positioned at (503, -1024)
However, you can massage the output to suit your needs. The script only returns the last set-up displays. In other words, if a display is hot-unplugged, the script will still report the last layout set in System Preferences.
Here's the script; it's only been tested on 10.5.6: [robg adds: To use the script, copy and paste the above into vi, emacs, BBEdit, TextEdit, or other pure-text editor. Save the file with a meaningful name (screeninfo). Then, in Terminal, cd to the directory where you saved the file, and run this command to make the file executable: chmod a+x screeninfo. You can then run the script (assuming it's been saved somewhere on your path) by typing screeninfo (or from within the current directory with ./screeninfo). It worked fine on my dual-monitor setup.]
Display Unit: 0 with height 900 and width 1440 is positioned at (0, 0)
Display Unit: 1 with height 1024 and width 1280 is positioned at (503, -1024)
However, you can massage the output to suit your needs. The script only returns the last set-up displays. In other words, if a display is hot-unplugged, the script will still report the last layout set in System Preferences.
Here's the script; it's only been tested on 10.5.6: [robg adds: To use the script, copy and paste the above into vi, emacs, BBEdit, TextEdit, or other pure-text editor. Save the file with a meaningful name (screeninfo). Then, in Terminal, cd to the directory where you saved the file, and run this command to make the file executable: chmod a+x screeninfo. You can then run the script (assuming it's been saved somewhere on your path) by typing screeninfo (or from within the current directory with ./screeninfo). It worked fine on my dual-monitor setup.]
•
[11,259 views]

