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

System Engineering degree at UNAC, Computer Science Masters at PUCP, High Performance Masters at University of Edinburgh, Winner OPW GNOME 2011, GNOME Foundation member since 2012, Fedora Ambassador since 2012, winner of the Linux Foundation scholarship 2012, Linux Admin at GMD 2012, IT Specialist at IBM 2013. Academia experience in lecturing at PUCP, USIL and UNI Peru (2010-2018). HPC intern at ORNL 2018. HPC Software Specialist at UKAEA since 2020. Tech Certifications: RHCE, RHCSA, AIX 6.1, AIX 7 Administrator, and ITILv3. Leader of LinuXatUNI Community, Creator of the "Mujeres Imperfectas | I'm perfect woman" channel, Reviewer of the Technological Magazine of ESPOL-RTE, Online trainer at BackTrackAcademy, blogger, photographer, IT-Linux-HPC-science worldwide speaker, graphic designer, researcher, content creator, press communicator... a simple mortal, just like you!
This entry was posted in GNOME, τεχνολογια :: Technology and tagged , , , , , , , . Bookmark the permalink.

1 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 comment