Application:Tweaks

From WebOS Internals
Jump to navigation Jump to search
Tweaks ss1.png


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.


Installation

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


Overview

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.

In order for Tweaks to properly work, you will need to install it along with at least one patch that has tweaks support. Patches that have Tweaks support will be displayed in Preware with a new category icon, a distinctive green plus sign.


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 in Preware with a distinctive green plus sign.


Usage

The information listed below will help you understand how to use the Tweaks app. The Usage section is broken down into to parts: One section for the End Users on how to access and use the the Tweaks app and the other section is for Patch Developers on how to include Tweaks support into their patches.


End Users

Accessing the Tweaks

  • Open Tweaks by starting it from the Launcher.


Configuring the Tweaks

Upon opening Tweaks, the Tweaks service will scan for tweaks that were added, modified and/or removed since the last time the app was accessed.
(Note: If none of the patch categories have a number next to them or are greyed out, that means that there are no patches installed on your device that have support for Tweaks.

Tapping a patch category will display all of the tweaks available to you that fall under that particular category. In each grouping of tweaks, you can modify the settings to your liking. To learn more about what a particular tweak does, tap the blue question mark button in the header of each patch category, then tap on the corresponding tweak to get a brief description of what the tweak does.

Depending on the type of tweak that was changed, you may be prompted by Tweaks to restart Luna for the settings to apply. For other tweaks that didn't prompt for a Luna restart, a simple closing of the affected app (if already open) will make the changes available for the next use of that app.


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.


Sample 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 as well. 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
		} ]
	}
]


Sample 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


Status

Changelog
1.1.0 - Current Release - (Released April. 12th, 2011)
  • Allow for the tweaks json file to override the owner value


1.0.0
  • Initial release