Skip to content
cccskills
FreePublished on GitHub

gnome-preferences-dialog

Add a standard GNOME preferences dialog (AdwPreferencesDialog) with Ctrl+comma shortcut, PreferencesPage/Group rows, and GSettings bindings. Use when adding settings or preferences UI to a GNOME app.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Skill: Add a Preferences Dialog

Goal

Add a standard GNOME preferences dialog accessible via Ctrl+comma.

Blueprint Template

Adw.PreferencesDialog {
  search-enabled: true;
  content-width: 600;

  Adw.PreferencesPage {
    Adw.PreferencesGroup {
      title: _("Appearance");
      description: _("These settings control how the app looks.");

      Adw.SwitchRow {
        title: _("_Dark Mode");
        use-underline: true;
      }

      Adw.ComboRow {
        title: _("_Theme");
        use-underline: true;
        model: StringList { strings [_("Light"), _("Dark"), _("System")] };
      }
    }

    Adw.PreferencesGroup {
      title: _("Behavior");

      Adw.SpinRow {
        title: _("_Font Size");
        use-underline: true;
        numeric: true;
        adjustment: Adjustment { lower: 8; upper: 32; step-increment: 1; };
      }
    }

    Adw.PreferencesGroup {
      Adw.ButtonRow {
        title: _("_Clear History");
        use-underline: true;
        styles ["destructive-action"];
        activated => $on_clear_history_cb(template);
      }
    }
  }
}

GSettings Schema

<schemalist>
  <schema id="org.example.MyApp" path="/org/example/MyApp/">
    <key name="dark-mode" type="b"><default>false</default><summary>Dark mode</summary></key>
    <key name="font-size" type="i"><default>12</default><summary>Font size</summary></key>
  </schema>
</schemalist>

Menu Integration

<menu id="primary_menu">
  <section>
    <item>
      <attribute name="label" translatable="yes">P_references</attribute>
      <attribute name="action">win.show-preferences</attribute>
      <attribute name="accel">&lt;control&gt;comma</attribute>
    </item>
    <item>
      <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
      <attribute name="action">app.shortcuts</attribute>
    </item>
  </section>
</menu>

Python Code

from gi.repository import Adw, Gio

class MyApp(Adw.Application):
    def __init__(self):
        super().__init__(application_id='org.example.MyApp')
        self.create_action('shortcuts', self._on_shortcuts)

class MyWindow(Adw.ApplicationWindow):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        show_prefs = Gio.SimpleAction.new('show-preferences', None)
        show_prefs.connect('activate', self._on_preferences)
        self.add_action(show_prefs)
    
    def _on_preferences(self, action, param):
        builder = Gtk.Builder.new_from_resource('/org/example/MyApp/preferences.ui')
        dialog = builder.get_object('preferences_dialog')
        dialog.present(self)

GSettings Binding (C)

GSettings *settings = g_settings_new ("org.example.MyApp");
g_settings_bind (settings, "dark-mode", switch, "active", G_SETTINGS_BIND_DEFAULT);

Real App References

  • gnome-text-editor/src/editor-preferences-dialog.ui
  • nautilus/src/resources/ui/nautilus-preferences-dialog.blp
  • gnome-calculator/src/ui/math-preferences.blp

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Add a standard AdwAboutDialog wired to app metadata, plus the AppStream metainfo file it should share data with. Use when adding an About entry, release notes, credits, or preparing app metadata.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

Make a GTK4/libadwaita app accessible — accessible labels and roles, tooltips on icon-only buttons, keyboard navigation, contrast, and testing with Orca/Accerciser. Use when fixing a11y issues or running the accessibility category of a HIG audit.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

Responsive GNOME layouts: AdwBreakpoint conditions, BreakpointBin, MultiLayoutView, BottomSheet, narrow/wide layout swaps. Use when making an app work on phones or narrow windows.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

Onboarding tour with AdwCarousel and navigation dots, skippable welcome screens. Use when adding a first-run tour or feature showcase to a GNOME app.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

Implement GNOME's 4-tier destructive-action pattern: undo toasts instead of confirmation dialogs, AdwAlertDialog for irreversible actions. Use when adding delete, remove, clear, or other destructive actions.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

Loading, empty, and error states with AdwStatusPage and AdwSpinner — placeholder icons, titles, action buttons. Use when an app view can be empty, loading, or failed.

The English summary is being prepared. Showing the original description.

hanthor/gnome-gui-spec4Updated Oct 11, 2026

See all skills by hanthor

Report a problem with this skill