What These Guidelines (Will) Cover
This document is a place to collect all the "do"s, "don't"s and "how to"s for interface elements in Plasma, particularly applets and plasmoids.
The following are acceptable known entries for plasmoids and applets. If your applet does not fall within one of the following categories, leave the category field empty (it will be automatically categories under "Miscellaneous" for the time being) and contact the Plasma development team to have a suitable category added to the list (at which point you may then use that category).
- Application Launchers application starters and file openers.
- Date and Time clocks, calendars, scheduling, etc
- Environment & Weather add-ons that display information regarding the weather or other environmentally related data
- Examples samples that are not meant for production systems
- File System anything that operates on files or the file system as it's primary purpose, such as file watchers or directory listings. Simply using a file as storage does not qualify the add-on for this category.
- Graphics for add-ons where displaying images, photos or graphical eye candy is the primary purpose
- Language add-ons whose primary purpose is language related, such as dictionaries and translators.
- Mapping geography and geographic data add-ons
- Online Services add-ons that provide an interface to online services such as social networking or blogging sites. If there is another more appropriate category for the add-on given the topic (e.g. mapping if the applet's purpose is to show maps), even if the data is retrieved from the Internet prefer that other category over this one.
- System Information display and interaction with information about the computer such as network activity, hardware health, memory usage, etc
- Windows and Tasks managers for application windows and/or tasks, such as taskbars
Questions from a futur plasmoid programmer. I find those categories ambiguous. For instance:
- Where would go "Disc Usage" applet go? File System? It's listing mount-points and how much free space is left on each... Or "System Information"?
- Where goes an applet that display the cover art and music information of the currently playing track in Amarok? Or any media-center related plasmoid. I propose to add a category "Multimedia".
- Where would go a "Live Road Traffic" plasmoid: "Environment & Weather", or "mapping"? Environment is quite vague
- Shouldn't "Date and Time" be renamed "Date & Time", and "Windows and Tasks" "Windows & Tasks", to keep consistency?
- applets should *not* store or retrieve their own size from config(). Plasma::Applet does that for us.
Layouts and Sizing
To set your initial size, call setSize(). same for setMaximumSize() and setMinimumSize(). if you need to change the size, call resize().
If you need to be notified when your plasmoid is resized, then implement constraintUpdated and check for a sizeconstraint. your new size is given by contentSize().
- resize to a reasonable default in the constructor (whatever that means for the config)
- only over ride contentSizeHint if there is good reason to (e.g. aspect ratio is important, the systemtray, etc)
- if the applet needs to resize at runtime because of changing content, this is ok to do. just be careful of the form factor.
- setting a minimum size is a good idea for applets that need a certain amount of room no matter what