Reputation: 4288
Is there a way to get the locations of the desktop icons in Snow Leopard? I believe each icon was a different window in Leopard, but this changed with SL.
Is there an API to do this or a file (like a configuration file) to parse?
Upvotes: 3
Views: 492
Reputation: 22958
As far as I can tell, icons on the Desktop appear to be an "AXImage". If you get out Accessibility Inspector (in /Applications/Utilities/Accessibility Tools/), you can examine the Accessibility information reported for items on the screen.
For example:
<AXApplication: "Finder">
<AXScrollArea: "desktop">
<AXGroup: "._sideEntrance.psd">
<AXImage: "Untitled.icns">
Attributes:
AXRole: "AXImage"
AXRoleDescription: "image"
AXParent: "<AXGroup: "._sideEntrance.psd">"
AXWindow: "<AXScrollArea: "desktop">"
AXTopLevelUIElement: "<AXScrollArea: "desktop">"
AXSize: "w=16 h=16"
AXPosition: "x=106 y=412"
AXEnabled: "true"
AXFocused (W): "false"
AXTitle: "Untitled.icns"
AXFilename: "Untitled.icns"
AXURL: "file://localhost/Users/mdouma46/Desktop/Untitled.icns"
AXSelected (W): "false"
AXEnabled: "true"
The Accessibility APIs (the lower level ones, anyway), are part of HIServices:
/System/Library/Frameworks/ApplicationServices.framework/.../HIServices.framework
(You link against and import the ApplicationServices umbrella framework into your project, however).
I'm not that familiar with those APIs so I can't offer specifics, but that would be a place to start.
Hope this helps...
Upvotes: 4
Reputation: 30289
Position of files and folders icons is in the .DS_Store file, this exists for any directory (that Finder has viewed)
Upvotes: 1