Applet, desklet and extension settings reference

This is the reference for the settings API.

Basic settings types

switch

  • type: should be switch
  • default: true or false (no quotes)
  • description: String describing the setting

A simple switch that controls a boolean type value.

New in Cinnamon 3.2

spinbutton

  • type: should be spinbutton
  • default: default value to use - must be number
  • min: minimum value
  • max: maximum value
  • units: (optional) String describing the unit type (pixels, bytes, etc..)
  • step: adjustment amount
  • description: String describing the setting

Provides a spin button and entry that control a number value. This can be integer or floating point format. For floating point, all values must have leading 0's.

scale

  • type: should be scale
  • default: default value to use - must be number
  • min: minimum value
  • max: maximum value
  • step: adjustment amount
  • show-value: (optional) whether to show the current value on the slider - default: true
  • description: String describing the setting

Provides a scale widget that allows you to pick a number value between min and max, by step amount. Integer or floating point numbers can be used. For floating point, all values must have leading 0's.

entry

  • type: should be entry
  • default: default string value
  • description: String describing the setting
  • expand-width: (optional) true or false, or leave off entirely. Forces editable fields of entry's elements to occupy the entire space available in a row

A single-line text entry field that stores a string.

textview

  • type: should be textview
  • default: default string value
  • description: String describing the setting
  • height: (optional) Number indicating the height of the textview in pixels or leave off for default height (200 px)

A multi-line text entry field that stores a string.

New in Cinnamon 2.0

File chooser widgets

filechooser

  • type: should be filechooser
  • description: String describing the setting
  • default: Default filename to use
  • select-dir: (optional) true or false, or leave off entirely. Forces directory selection.

Opens a file chooser dialog that allows you to choose a filename. If select-dir is true, it will only allow directories to be selected. Stores as a string.

iconfilechooser

  • type: should be iconfilechooser
  • description: String describing the setting
  • default: default icon path or icon name to use
  • expand-width: (optional) true or false, or leave off entirely. Forces editable fields of iconfilechooser's elements to occupy the entire space available in a row

Provides a preview button and text entry field. You can open a file dialog to pick an image-type file, or enter a registered icon name in the text field. Stores as a string.

soundfilechooser

  • type: should be soundfilechooser
  • description: String describing the setting
  • default: default icon path or icon name to use
  • event-sounds: (optional) true or false, or leave off entirely. Unless this property is set to false, the file chooser will only allow wav and ogg/oga type files as these are the only types currently supported by cinnamon sound events. (New in Cinnamon 4.2)

Provides a button which shows the currently selected file name and opens a file dialog when clicked. A preview button is also provided to allow the user to test the selected sound. Stores as a string.

New in Cinnamon 3.2

Other chooser widgets

combobox

  • type: should be combobox
  • default: default value to set
  • description: String describing the setting
  • options: node of desc:val pair options, where desc is the displayed option name, val is the stored value

Provides a dropdown list from which you can select from description:value pairs defined by options. The values can be string, number, or boolean.

colorchooser

  • type: should be colorchooser
  • default: default color string - can be "red" or "rgba(x,x,x,x)", etc...
  • description: String describing the setting

A Color button that lets you choose a color. Stores an RGBA color code as a string

fontchooser

  • type: should be fontchooser
  • default: default font string - should be the font name followed by the font size. (eg. "sans 12")
  • description: String describing the setting

A button that opens a dialog that lets you select a font. Stores a font string as a string

New in Cinnamon 3.2

datechooser

  • type: should be datechooser
  • default: default date - should be of the form {d: '1', m: '1', y: '2000'}
  • description: String describing the setting

A button that opens a dialog that lets you select a date. The date is stored as three key/value pairs representing the numerical value for the day('d'), month('m'), and year('y').

New in Cinnamon 3.2

timechooser

  • type: should be timechooser
  • default: default time - should be of the form {h: '12', m: '0', s: '0'}
  • description: String describing the setting

A button that opens a dialog that lets you select a time. The time is stored as three key/value pairs representing the numerical value for the hour('h'), minute('m'), and second('s').

New in Cinnamon 4.2

tween

  • type: should be tween
  • default: default tween value
  • description: String describing the setting

Provides a dropdown list from which you can select a tween type. A tween value is a string of the form ease<direction><shape> where direction can be In, Out, InOut, or OutIn and shape can be Quad, Cubic, Quart, Quint, Sine, Expo, Circ, Elastic, Back, or Bounce. For example, to specify a direction of In and a shape of Quad, the resultant string would be easeInQuad. To specify no tween, use the special tween value easeNone.

New in Cinnamon 2.6

effect

  • type: should be effect
  • default: default effect type
  • description: String describing the setting

Provides a dropdown list from which you can select an effect type. An effect type specifies what an animation looks like. Stores as a string.

New in Cinnamon 3.2

Layout types

section

  • type: should be section
  • description: String to display as the section title

A non-setting widget, this specifies a new section for assisting in organizing your settings.

New in Cinnamon 3.2

layout

  • type: should be layout
  • pages: An array of strings representing page items

A non-setting widget, this allows you to specify a particular layout for your settings rather than relying on the order they appear in your settings-schema.json file. This has the added advantage of using settings pages to further organize your settings into tabs. This is only recommended when you have a large number of settings that wont all fit without scrolling. To use the layout object, you must place it at the beginning of the settings-schema.json file as the first "setting". Any section items not placed within the layout object will be ignored.

To use the layout object, you must define any number of page and section types as key/value pairs in the layout item. Each page will include a sections key which is an array of section items. Each section item in turn will contain a property called keys which is an array of key. In addition, the layout object also must include the pages key which is an array that contains a list of the pages in your layout. The each item in pages and sections must correspond to a page or section key in the layout property and each item in keys must correspond to one of the settings keys in your settings-schema.json file. The pages, sections and keys will be displayed in the order in which their key names appear in their respective arrays and do not depend on their order in the layout object or your settings file.

Here is an example of what a layout object might look like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"layout" : {
  "pages" : ["page1", "page2"],
  "page1" : {
    "type" : "page",
    "title" : "1st page",
    "sections" : ["section1", "section2"]
  },
  "page2" : {
    "type" : "page",
    "title" : "2nd page",
    "sections" : ["section3", "section4"]
  },
  "section1" : {
    "type" : "section",
    "title" : "1st section",
    "keys" : ["setting1", "setting2"]
  },
  "section2" : {
    "type" : "section",
    "title" : "2nd section",
    "keys" : ["setting3", "setting4"]
  },
  "section3" : {
    "type" : "section",
    "title" : "3rd section",
    "keys" : ["setting5", "setting6"]
  },
  "section4" : {
    "type" : "section",
    "title" : "4th section",
    "keys" : ["setting7", "setting8"]
  }
}

New in Cinnamon 3.2

Other settings types

keybinding

  • type: should be keybinding
  • default: default keybinding string - i.e. <Control>F8 or other string parseable by gtk_accelerator_parse.
  • description: String describing the setting

An input that allows you to select a keybinding for an action.

generic

  • type: should be generic
  • default: default value

A generic storage object for any type of value. This is generally intended for internal settings that won't be adjusted by the user. For example, a history, or most recent command. There is no corresponding widget for it in Cinnamon Settings.

label

  • type: should be label
  • description: String to display as a label

A non-setting widget, this provides a label for making a note or describing something. Unlike a header which is bold-faced to stand out, a label is formatted just like the description of most of the other setting types.

New in Cinnamon 2.6

button

  • type: should be button
  • description: Label for the button
  • callback: string of callback method name (no "this", just "myFunc")

A non-setting widget, this provides a button, which, when clicked, activates the callback method in your applet, desklet, or extension. The callback value should be a string of the method name only. For instance, to call this.myCallback(), you would put myCallback for the callback value.

Note: for an applet or desklet, the callback function must be a method of the applet or desklet object. For an extension, it can be a method of any object, but that object must be returned from the enabled() function of your extension in order for it to work.

list

  • type: should be list
  • description: (optional) String to describe the setting
  • columns: Array of objects specifying the columns in the list widget
  • default: default value
  • show-buttons: (optional) Whether to show the action buttons below the list (true by default)

This widget provides a list with columns, and rows which can be created, edited, deleted and reordered. The columns in the list are specified by the columns property. All columns have the following properties:

  • id: a unique string for identifying the column
  • title: the title that will be displayed in the column header
  • type: the data type for the column
  • default: (optional) a default value for the column when a new row is being created. This will only be used to auto-populate the corresponding widget when it is first generated in the add row dialog. If this property is omitted, the default will be determined by the widget.
  • options: (optional) A list of acceptable values for that column. Either an array or an object with key value pairs may be used. If an object is given, the key is displayed as the text of the widget, and must be a string; the value must match the data type of the column (ie. string, integer, boolean, etc).
  • align: (optional) A number between 0 and 1 indicating how the value should be aligned with respect to the column in which it is displayed. 0 aligns to the left of the cell, 1 to the right, and 0.5 in the center. (New in Cinnamon 4.2)

The column type determines the type of data that will be stored. When the user presses the add or edit button, a dialog is generated with a widget for each column definition. Starting in Cinnamon 3.8, if the options property is given, the widget will be a combo box. Otherwise the widget will be determined by the data type of the column as listed below. These widgets act just like the corresponding widgets in this document, and all the same properties can be included in the column definition, with the exception of description and type. The following types are currently available:

  • string: this type stores data as a string. An entry is generated in the add/edit dialog. The default value for new entries is an empty string unless specified with the default property.
  • file: this type stores data as a string. A filechooser is generated in the add/edit dialog. The default value for new entries is an empty string unless specified with the default property.
  • integer: this type stores data as an integer. A spinbutton is generated in the add/edit dialog. The default value for new entries is 0 unless specified with the default property.
  • float: this type stores data as a floating point number. A spinbutton is generated in the add/edit dialog. The default value for new entries is 0.0 unless specified with the default property.
  • boolean: this type stores data as a boolean. A switch is generated in the add/edit dialog. The default value for new entries is false unless specified with the default property.

The values are stored as an array of objects where each object in the array corresponds to a row in the list, and each entry in the row object is a key:value pair where the key being the column id of the column to which the value corresponds.

For an example of how to use this widget, see the settings example applet that is included with Cinnamon. The source code for it can be found in /usr/share/cinnamon/applets/settings-example@cinnamon.org

Note: For appearance, it is recommended that you do not use the description property of this setting, but rather place it in it's own section.

New in Cinnamon 3.4

Deprecated settings types

Please do not use the following settings types in new code. They may be removed in future versions.

checkbox

  • type: should be checkbox
  • default: true or false (no quotes)
  • description: String describing the setting

Formerly generating a checkbox widget, this widget type now functions exactly like the switch settings type.

Deprecated since Cinnamon 3.2

radiogroup

  • type: should be radiogroup
  • default: default value from the list of options, or it can be a custom value if custom is defined
  • description: String describing the setting
  • options: node of desc:val pair options, where desc is the displayed option name, val is the stored value

Formerly generating a series of radio buttons this widget now functions exactly like the combobox settings type.

Deprecated since Cinnamon 3.2

header

  • type: should be header
  • description: String to display as a bold header

A non-setting widget, it formerly generated a bold-faced label for assisting in organizing your settings. It now functions exactly like the section type.

Deprecated since Cinnamon 3.2

separator

  • type: should be separator

A non-setting widget, it formerly drew a horizontal separator for assisting in organizing your settings. It currently is ignored. It is recommended that you use sections instead.

Deprecated since Cinnamon 3.2

Additional setting options

Additional Setting Options

These fields can be added to any widget:
  • dependency: Shows or hides the settings widget based on the value of another key in the settings-schema file. There are several possible values for this option:
    • The most common value for this option is simply the key of the setting you wish to depend on. This is most useful for depending on a boolean setting such as a switch. This will make your setting hide if the key you're depending on is false, and show it when the key is true.
    • If you wish to 'invert' the dependence you can precede the key with a !. This will make your setting hide if the key you're depending on is true, and show it when the key is false.
    • For non-boolean values, you can use a simple expression of the form my-key=value where my-key is the key you're depending on, and value is the value that wish to compare to. In addition to '=' you can also use '<', '<=', '>', '>=', and '!='.

    In addition to settings widgets, a dependency can also be added to a section to show or hide the section and all it's widgets. This works with or without the layout item.

    New in Cinnamon 3.8.

  • tooltip: Adds a popup tooltip to the widget
  • indent: true: Indent the widget in the settings page to help with organizing your layout. Note: this key has been deprecated since Cinnamon 3.2 and will be ignored.

Signals

settings-changed

Signal when the underlying config file has changed and the in-memory values have been updated.

changed::<key>

Signals when key has changed in the configuration file. Use this in conjunction with getValue if you want to handle your own updating in a more traditional way (like gsettings).

The callback function will be called with three parameters: settingProvider, oldval, newval, which are, respectively, the settings object (which you usually don't need), the original value and the updated value.

Additional options in metadata.json

You can add the following items to metadata.json to affect how the settings are presented to the user:
  • hide-configuration: Hides the configure button in Cinnamon Settings. Set to true if you are using only generic-type settings that should be hidden from the user. This is not a mandatory key. Omitting it will allow the configuration button to hide or display depending on whether you are utilizing the settings API or not.
  • external-configuration-app: Allows you to define an external settings app to use instead of the built-in settings GUI. This should be a string with the name of your executable settings app (path relative to the applet's install directory). Note, this key can be overridden by the hide-configuration key. This is not a mandatory key. Omitting it will allow the configuration button to hide or display depending on whether you are utilizing the settings API or not.

Accessing the settings window from command-line

You can access the settings with one of the following commands:

1
xlet-settings <type> <uuid> <instanceid>
1
xlet-settings <type> <uuid> -i <instanceid> -t <tabnumber>

Where type is applet, desklet or extension depending on what type it is. The instanceid is optional. The tabnumber is optional and designates the tab (or page) you want to access; the tabs are numbered from 0 to number of tabs - 1.

The second command is new in Cinnamon 4.2.