I am attempting to edit the adwaita theme, the only way to do this is to open the gtk.gresource file.

gedit will not open the file, geany will not open the file.

How do I open the file so I can edit gtk.css?


3 Answers 3


since some time, GTK-3 theme CSS files are precompiled into a binary format (*.gresource) and installed as a bundle. There is a helper program called gresource to deal with these files

  • usually, it is installed alongside with the library GLib
  • thus it should be in the package libglib2.0-bin
  • and since this package is usually already installed, you'll find it in your /usr/bin and get more documentation by invoking man gresource

In short

  • to list the contents of a *.gresource file:

     gresource list gtk.gresource
  • to extract a specific resource from it:

     gresource extract gtk.gresource /org/gnome/adwaita/gtk-main.css

Basically, this allows you to get the contents of the original Theme extracted. You could make a conventional Theme (with discrete CSS files) from the extracted resources. The key point to note for this is that you have to change the entry point in the top level gtk-3.0/gtk.css file within your theme. In binary themes, you'll find there a URL reference

@import url("resource:///org/gnome/THEMENAME/gtk-main.css");

You need to change this reference to point to your locally installed files

@import url("gtk-main.css");

If you want to compile a new binary bundle from a theme you edited in discrete CSS files, see this Blog post from 2012 by Satyajit Sahoo

$ file gtk.*
gtk.css:       ASCII text
gtk.gresource: GVariant Database file, version 0

So the answer is: you do not. It is software (see gvariant).

so I can edit the gtk.css

That one is an ASCII file so editable with gEdit.

  • Thanks Rinzwind. But I don't understand what you wrote in code.
    – Adam
    Jan 11, 2015 at 16:38

You can use the folowing script to recursively extract all files from gresource (save it to ~/bin/gextract.sh and make it executable):


# recursively extract gresource

for file in "$@"; do
    gresource list "$file" | while read i; do
        mkdir -p "$dirpath"
        cd "$dirpath"
            gresource extract "$file" "$i" > "${i##*/}"
        cd - >/dev/null


gextract.sh gtk.gresource

it will create a directory tree with files (it's like unpack an archive)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .