Skip to content

Architecture

This page covers some important parts of libtuner and Tuner that are useful to consider when creating plugins.

Object tree

Tuner uses custom object-tree system that is not compatible with Gtk.Widget system. That blocks usage template feature of Gtk.Builder.

Tuner.Widget and Tuner.Binding

All interface elements are created using Tuner.Widget. Some widgets do not work without assigning the binding property to them. Tuner.Binding is a simple tool that binds a certain widget property (for example active in the internal Tuner.Switch widget) to the required backend.

The following example creates a Tuner.Switch with a binding to a Tuner.Setting, which implements the GSettings backend. When the application starts, an Adw.SwitchRow will be created and the active property will be bound to the allow-volume-above-100-percent key. This will allow changing the active property in Adw.SwitchRow to change the GSettings value, also when the GSettings value is changed independently, the switch will be synchronized.

blp
Tuner.Switch {
    title: _("Over Amplification");

    binding: Tuner.Setting {
        schema-id: "org.gnome.desktop.sound";
        schema-key: "allow-volume-above-100-percent";
    }
}

Merging and priority system

Merging system in Tuner allows to extends existing plugins interface by other plugins.

There are there different priorities in Tuner: plugin priority, page priorirty, group priority.

  • The plugin priority determines the order in which they are loaded. If two plugins try to add Tuner.Page with the same tag, the plugin with the higher priority dictates all page information (icon, title, etc.). Their content will be merged. Also, if the plugin with the higher priority does not set an icon, the icon from the plugin with the lower priority can be used if it has one.

  • Page Priority determines the order of pages in the sidebar. The lower the priority, the higher the page will be listed. That does not apply to internal pages.

  • Tuner.Group has its own priority, which determines the order in the group list. A group with a lower priority will be displayed higher in the page interface. Groups also have a tag property, if two groups have the same tag they will be merged, widgets from the group with a higher plugin priority will be higher in the interface of the resulting group.

For example, this system allows Tweaks and Panel plugins to exist separately and independently.

Only Panel plugin loaded

The panel plugin sets its own icon for the row.

Only Panel plugin loaded

Only Tweaks plugin loaded

The tweaks plugin sets its own icon for the row.

Only Tweaks plugin loaded

Tweaks and Panel are loaded simultaneously

The icon for the row is set using the Tweaks plugin since it has higher priority.

Their content was merged and despite the fact that the panel plugin had a lower priority, the group from the panel plugin turned out to be higher because the priority of this group was lower than the priority of the groups from the tweaks plugin.

Tweaks and Panel are loaded simultaneously

Released under the GPL-3.0+ License. The content is available under CC BY-SA 4.0, unless stated otherwise.