Wednesday, March 12, 2008

All About Widgets

Ever wondered what are those wonderful things Mac calls Widgets? how to back them up, what if i want to delete or uninstall? well here is a small guide for you, starting with basics and cover the rest.

What is a widget?
a widget is a small application that runs in a layer named Dashboard, it is brought to display by pressing the F12 key, or use the Dashboard icon on the dock. once you do that your screen turns a bit darker and the widgets land on your screen with gorges animation.

move, close, add, remove, configure widgets
you can click and move widgets around, you can interact with them (some have controls, some have buttons and scroll or even a complete game), they are simple html pages and they reside on a PNG image. you can configure a widget by clicking the small 'i' circle (it will appear on most widgets), you make the 'i' circle appear by hovering the mouse on the widget, once you click it the widget will 3D flip and a configuration screen appears inside it, to exit that screen simply press "Done".

you may close a widget so it wont appear on the dashboard anymore by holding the option key (ALT on hackintosh) and hover with the mouse on a widget, a cross appears on the widget upper left corner, and you may click it so the widget will not appear anymore, also a wonderful animation is associated with it.

Manage Widgets
another way to see the close cross on all widgets and/or add other widgets is to press the plus sign in the lower left corner of the dashboard screen, again an eye candy animation is associated with the process. the lower screen is filled with all available widgets and you may click them so they will be added to dashboard, you may click and drag them to the place you want them to appear, or you may press the little arrows on the left and right to scroll between available widgets.

you can also press the first widgets icon (or the "Manage Widgets" button above it) it will display a popup window with the widgets listed in it, you may sort by name, or by date, you can mark the checkbox so the widget will not appear even in the lower part of the screen when you press the plus sign, or (for some widgets) you can press the red circle with minus sign next to it in order to delete the widget and move it to the trash.

Get More Widgets
last thing you can do with the "Manage Widgets" popup is to press the "Get More Widgets..." button on the bottom, it will open apples widgets download page and exit the dashboard, once you have chosen a widget to download it will ask you if to install or cancel,

if you click install the dashboard opens up, displaying  the recently downloaded widget in the center of the screen with the buttons "keep" and "delete" buttons giving you last chance to get rid of it.

Exit the Dashboard
the ways available to exit the dashboard are: pressing an area where there are no widgets in it, or pressing F12 again.

Web Clip Widgets
the last basic and most attractive part in widgets i explain is the web clip, it is a safari plugin that allows it to cut a part of a web page and save it as a widget on the dashboard, making all the web available to you as you wish it to be.
the procedure is very simple:
1. open safari and go to the page you want to save part as a widget.
2. from File menu choose "Open in Dashboard"

3. the safari screen darkens and when you hover with your mouse the appropriate part is lighten

4. click on the chosen part (a circles will appear on the edges of the chosen part allowing you to adjust the size you want)

5. on the purple upper bar click "Add"
6. the widget will load and display on your dashboard

Lets move to some more complex stuff,

Moving widgets from dashboard to desktop
moving widgets from dashboard to desktop is covered in this post.

Backup or manually delete widgets
the widgets (ones you download) reside in the folder:


you can remove them from this folder and they will disappear from the dashboard, you can add previously backed-up widgets to this folder and they can be added to the dashboard from the "Manage Widgets" drawer.

Widgets structure
the widget file extension is: wdgt, and they are actually a folder (like most executables on mac), that means you can do right click "Show Package Contents" and browse them.

all of them should include the files:
Default.png (this is the main widgets window)
Icon.png (it will be displayed when the lower drawer on the dashboard appears, this is optional)
XXX.html (some html file that is the actual application that forms the widgets)
info.plist (this is the definition file that accompanies every install app in Mac OS X)

there might be other files like "lproj" folders to support multilingual resources, css files or flash files etc.

Keyboard Shortcuts
Command++ = from within dashboard you can click on Command and Plus sign (+) to open and close the widget drawer.

Command+R = in dashboard you can point to a widget and press Command + R and cause the widget to refresh its data (it will perform some nice twirl animation)

Tweak the Widget
of course since the widget is an html part you may edit it as you wish and achieve some cool results. for instance lets change the string "Address Book Search" in the "Address Book" widget.

1. goto folder:

2. right click the "Address Book" widget and choose "Show Package Content"

3. enter into the folder: "English.lproj"

4. open the file: localizedStrings.js with some text editor (like BBEdit/Smile)

5. change the words "Address Book Search" in the line: 
localizedStrings['Address Book Search'] = 'Address Book Search';
to anything you want like:
localizedStrings['Address Book Search'] = 'Find people';
6. save and open dashboard, remove the "Address Book" widget if you have it and add it back on, it should display what you wrote, mine looks like this:

so if you know html, javascript, css, flash, you can alter the way your widgets act and behave, and more then that you can create one of your own.

Widgets Process
every Widget you add to dashboard will add (depends on the load and need) a process named "Dashboard Client", it will consume a memory depending on how many widgets it needs to handle,

roughly the main process (one always stay to handle dashboard it self) will consume 10M and if a widget is added it should launch another process and it will consume about 10M as well, next widget add should be handled by the two processes already running but the first now consume about 13-14M and the second about 21-23M, next could launch another process and will use (depends on the widget size, logic, and code) 3-6M, i have never seen more then 12 "Dashboard Client" process at the same time but it could potentially add as much as it needs.

if you try to kill a process it will restart immidiatly as it needs, even if you manage to kill (and they will auto re-born) all the clients it will not harm or change the way your dashboard works.
you will return to the dashboard and you will see it the same. more then that if you start closing widgets the number of process (A.K.A pool size) will reduce to the needed size.

here are some links for good widgets:
Google Gadgets for mac (download and install google application that puts google gadgets on your dashboard)
Yahoo widgets for mac (using a browser plugin for download and install)
InnerMindMedia cool Widgets (and icons and apps...)


No comments:

the menu is from: Milonic DHTML menus