Skip to content

Creating plugin

Alex edited this page Jun 10, 2025 · 2 revisions

To create plugin you need to extend Tuner.Addin and in init block add your pages and content addins. Then build it to shared library.

Example:

namespace Test {
    public class Addin : Tuner.Addin {

        construct {
            add_from_resource("/org/example/TestAddin/test.ui");
        }
    }
}

This will add pages and content addins from /org/example/TestAddin/test.ui to Tuner.

test.ui

using Gtk 4.0;
using Tuner 1;

// Set translation domain
// Required if you need custom translation
// in your plugin
translation-domain "your-translations";

// Add new page to sidebar
Tuner.PanelPage {
    title: _("Test Page");
    tag: "testtag"; // Required if you want make your page extensible
    icon-name: "help-info-symbolic";

    // Creates new Adw.PreferenceGroup that that can be extended
    // by other plugins if id specified
    // Also allows to use widgets from libtuner
    Tuner.Group your_group_tag {
        title: _("Group Title");

        // Adw.SwitchRow with binding support
        // Can only be added to Tuner.Group
        Tuner.Switch {
            title: _("Over Amplification");

            // Binds this switch to GSettings
            binding: Tuner.Setting {
                schema-id: "org.gnome.desktop.sound";
                schema-key: "allow-volume-above-100-percent";
            };
        }
    }
}

Resulting library can be placed to ~/.local/share/tuner/plugins folder with plugin description file called <you plugin name>.plugin

test.plugin

[Plugin]
Name=Your name
Module=test

Where test should be replaced with your library name without lib prefix and .so. In example above test will be exanded to libtest.so

Here you can found template plugins for: Vala Python

More plugins: Tweaks Panel

Clone this wiki locally