Application:Tweaks

From WebOS Internals
Jump to navigation Jump to search
« Go Back to the Utilities application list
Tweaks ss1.png

Tweaks - 1.0.0


Overview

Tweaks-icon.png

Tweaks is a webOS application that can be used to "tweak" the operation of patches. In this way, a single configurable patch can implement a number of different options, and the user can use the Tweaks app to choose between these options.

Patches that have Tweaks support will be displayed in Preware with a new category icon, a distinctive green plus sign.

The Tweaks application requires webOS 2.0.0 or later. The initial set of patches that have tweaks available are only released for webOS 2.1.0 at this time.


Installation

The following information will help you with installing the Tweaks application.


Method

The following method can be used to install Tweaks.


Preware
  1. Open Preware
  2. Start typing “Tweaks” (no quotes)
  3. Tap the Tweaks from the list
  4. Tap the Install button

Or

  1. Open Preware
  2. Tap Available Packages
  3. Tap Application > System Utilities > Tweaks
  4. Tap the Install button


Troubleshooting/FAQs

Q: What version of webOS is Tweaks available for?
A: webOS 2.0.0 or later.

Q: How can I tell what patches have Tweaks support?
A: Patches that include support for Tweaks are shown with a distinctive green plus sign.


Usage

The information listed below will help you understand how to use the Tweaks app.


End Users

Coming Soon.


Patch Developers

Overview

The Tweaks app has a node.js service that keeps a db8 database of all these configuration options and generates the Tweaks app user interface automatically based on the info all the currently installed patches provide.

In this way patches can easily add configuration, yet not to clutter the standard webOS system user interface with all the configuration stuff (since usually you want to set it once and then forget about it). If the Tweaks app is not installed then the patches can just use their default values and they will still work.


JSON File

The JSON file to be submitted with your patch needs to contain the configuration options and their default settings for the patch. The JSON file provides the configuration options and their default values to the Tweaks app for rendering the configuration options GUI.

When submitting your patch to the Patches Portal, you will need to submit the JSON file manually. (Manually to whom is yet to be determined at the moment.
(Note: For now until the Patches Portal is updated to allow for submission of the JSON file with your patch)

The JSON file you submit to the Patches Portal will be renamed automatically to <patchid>.json. The name used for the JSON file is what is used as the owner information during the service call to Tweaks.

Here is an example JSON file.

[
	{
		"category": "system", 
		"prefs": [ {
			"group": "behavior", 
			"restart": "app",
			"label": "Label for this item",
			"help": "Help text for this item",
			"key": "someUniqueKey",	
			"type": "IntegerPicker",
			"value": 50,
			"min": 0,
			"max": 100
		}, {
			"group": "behavior", 
			"restart": "luna",
			"label": "Label for this item",
			"help": "Help text for this item",
			"key": "someOtherUniqueKey",	
			"type": "ListSelector",
			"value": "default",
			"choices": [ {
				"label": "Test label 1", 
				"value": "default"
			}, {
				"label": "Test label 2",
				"value": "other"
			} ]
		} ]
	}, {
		"category": "messaging", 
		"prefs": [ {
			"group": "misc", 
			"restart": "none",
			"label": "Label for this item",
			"help": "Help text for this item",
			"key": "someYetAnotherUniqueKey",	
			"type": "ToggleButton",
			"value": false
		} ]
	}
]


Service Call

The following is an example of a service call that can be used in the code to query the current value of any of the keys provided in the json file.
(Note: Remember that the owner is the appid of the patch and keys is a list of wanted keys that was provided in the json file.)

this.controller.serviceRequest("palm://org.webosinternals.tweaks.prefs/", {method: "get", parameters: {
  owner: "patch-id", keys: ["someUniqueKey"]}, onSuccess: this.successCallback.bind(this)});

successCallback(response) {
 if((response) && (response.someUniqueKey)) {
    // Do something with the config value
 }
}


Resources

Supporting Development

Btn donateCC LG.gif

Official Forum
Changelog

1.0.0 - Current Release - (Apr. 11, 2011)

  • Initial release