Playing with dconf and gnome-tweak-tool

This experience was based on Micah Carrick post, and I received help from Vincent Untz, Ryan Lortie and David King while I was trying to understand about GSettings and how lockdown works with GSettings. I learned also that this is all delegated to the backend used by GSettings: dconf.

* Before all else, in case you see ‘(your environment path)’, you must replace $(prefix) by what’s appropriate in ‘your environment’.

As the Micah tutorial says “The first step is to create a schema to define the application’s configuration settings. ” He did a great example of creating schema for apps ( applications ).

* In my case, I wanted to work with schemas for gnome-tweak-tool, so I started to analyse the tree and I did realize about the structure used in dconf. I first got shell in the tree: org – gnome – shell [Figure 01] with its schema org.gnome.shell and I also noticed that there are so much to do, I only found two of six “sub schemas for shell”. These were:

– Show date in clock with its schema  org.gnome.shell.clock [Figure 02]

– Show the week date in the calendar with its schema org.gnome.shell.calendar[Figure 03]

[ Figure 01]

[ Figure 02]

[ Figure 03]

* I learned that gsettings works with schemas and keys, so I was looking for those schemas in share/glib-2.0/schemas. This is the list I found:
gschema.dtd                                         org.gnome.desktop.enums.xml                    org.gnome.desktop.thumbnailers.gschema.xml
gschemas.compiled                                   org.gnome.desktop.interface.gschema.xml        org.gnome.desktop.wm.keybindings.gschema.xml
org.gnome.desktop.a11y.applications.gschema.xml     org.gnome.desktop.lockdown.gschema.xml         org.gnome.desktop.wm.preferences.gschema.xml
org.gnome.desktop.a11y.keyboard.gschema.xml         org.gnome.desktop.media-handling.gschema.xml   org.gnome.system.locale.gschema.xml
org.gnome.desktop.a11y.magnifier.gschema.xml        org.gnome.desktop.screensaver.gschema.xml      org.gnome.system.proxy.gschema.xml
org.gnome.desktop.a11y.mouse.gschema.xml            org.gnome.desktop.session.gschema.xml          org.gtk.Demo.gschema.xml
org.gnome.desktop.background.gschema.xml            org.gnome.desktop.sound.gschema.xml            org.gtk.Settings.ColorChooser.gschema.xml
org.gnome.desktop.default-applications.gschema.xml  org.gnome.desktop.thumbnail-cache.gschema.xml  org.gtk.Settings.FileChooser.gschema.xml

* After my reading, I decided to work with org.gnome.desktop.interface.schema.xml

[ Figure 04]

I create a boolean setting using the schema: org.gnome.desktop.interface.gschema.xml.  My boolean setting inserted was called “julita-setting”:

<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gsettings-desktop-schemas">
  <schema path="/org/gnome/desktop/interface/" id="org.gnome.desktop.interface">
    <key type="b" name="julita-settings">
      <default>true</default>
      <summary>Julita setting</summary>
      <description>My first example of boolean setting.</description>
    </key>
...
  </schema>
</schemalist>

This is usually compiled with glib-compile-schemas that usually lives in /usr/bin. In my case, using the environment, it was available in my bin.

glib-compile-schemas /(your environment path)/share/glib-2.0/schemas/

After the compilation, we must run dconf-editor in your little environment… and: [Figure 05]

Note *************************************************************************** If your environment is correctly configured (this happens automatically if you run “jhbuild shell”), then files in /(your environment path)/share/glib-2.0/schemas will be looked at too, in addition to the files in /usr/share/glib-2.0/schemas. This is what the XDG_DATA_DIRS environment variable is responsible for (when it is set).  *****************************************************************************

Finally, the Python part. I searched some py files stored in /(your environment path)/lib/python2.7/site-packages/gtweak/tweaks, and I saw GSettingsComboTweak examples that set default values…. [Figure 06] shows an example of this through “icon-theme”

[Figure 06]

I added python code in  /(your environment path)/lib/python2.7/site-packages/gtweak/tweaks and this is what I got:    [Figure 07]

About Julita Inca

Ingeniero de Sistemas UNAC, Magíster en Ciencias de la Computación PUCP, OPW GNOME 2011, Miembro de la GNOME Foundation desde el 2012, Embajadora Fedora Perú desde el 2012, ganadora del scholarship of the Linux Foundation 2012, experiencia como Admin Linux en GMD y Especialista IT en IBM, con certificaciones RHCE, RHCSA, AIX 6.1, AIX 7 Administrator e ITILv3. Experiencia académica en universidades como PUCP, USIL y UNI. HPC researcher, a simple mortal, like you!
This entry was posted in GNOME, τεχνολογια :: Technology and tagged , , , , , , , . Bookmark the permalink.

One Response to Playing with dconf and gnome-tweak-tool

  1. Pingback: GNOME was presented in the Technology Week in ICA, Perú | Sólo para Mí!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s