Changes to ~/.config/gtk-3.0/gtk.css reset after restart

I’m missing the little stepper arrows above and below scrollbars to scroll by row in programs like LibreOffice Calc. Therefore I looked for a solution and found a quickfix where they add some css code to a config file (see title).

scrollbar {
  -GtkScrollbar-has-backward-stepper: true;
  -GtkScrollbar-has-forward-stepper: true;
  }

I can make this changes successfully by editing and saving the gtk.css file but the changes get always reset after restarting the system. Any idea why?

What custom Gtk theme are you using? That would normally be the culprit.

Reset to what? The file doesn’t exist to begin with.

Where would I find this information? I haven’t installed any custom theme just Manjaro Gnome.

There is a file in my home directory at /home/username/.config/gtk-3.0/ named gtk.css which will always have a timestamp of the last restart. I can edit this file and make the changes successfully but after the next restart the file gets reset to a state before my changes.

According to

gsettings get org.gnome.desktop.interface gtk-theme

it is ‘Adw-dark

I’m using the same theme and I do not have a gtk.css in ~/.config/gtk-3.0/.

What does yours look like?

cat ~/.config/gtk-3.0/gtk.css

cat ~/.config/gtk-3.0/gtk.css

results in the following output:

@define-color accent_color #55dfc4;
@define-color accent_bg_color #16a085;

Same goes for

cat ~/.config/gtk-4.0/gtk.css

Those are Maia colors, so it’s probably set by our Custom Accent Colors GNOME Shell Extension. Upstream handles things differently now, but there’s no new release yet.

I can confirm this extension is installed and enabled. So you’re saying this extension is always overwriting the gtk.css upon restarting the system?

I assume ‘Upstream’ refers to some development version/branch of Manjaro? Should I wait for an update to the ‘stable’ branch or is there another file where I could put these changes?

Upstream refers to the extension developer. The source is here:

As far as things changing, it turns out I was wrong. Unfortunately, as he notes in the warning added recently, any custom gtk.css files will be overwritten. Perhaps create an issue and see if there’s a way around that somehow.

I’ve created an issue now and will report back. :slight_smile:

1 Like

According to the extension developer there’s no workaround for having the extension enabled and have a gtk.css file of your own. The developer is considering adding a feature to make this possible in the future.

Meanwhile as a workaround you have to (sudo) add your CSS changes to the gtk.css file of the extensions color accent you chose. In Manjaro’s case (maia) that would be:

/usr/share/gnome-shell/extensions/custom-accent-colors@demiskp/resources/maia/gtk.css

In that way, the extension will add your own CSS code to gtk.css upon restart.

EDIT: Downside is, you have to redo these changes every time the extension gets updated. So it might be a good idea to have a backup of ‘gtk.css’ at all times. :slight_smile:

If you didn’t already know, that file will be overwritten when there’s an update for the package. Always keep it backed up if you modify it.

1 Like

Thanks for the tip. I’ve added this information to my previous post. :+1:

The fact that anything is able to delete a file in your home directory other than you is not acceptable. Most programs will write a basic config file and you can edit/delete/customize as you wish. These are usually used to set default actions/behaviour but nothing should ever be deleting a file. Not even removing a uninstalling a program. This is by default.

Technically speaking it isn’t deleting the file but overwriting it. But I agree. The extension is basically killing the possibility for custom GTK CSS changes via gtk.css. I don’t understand why the extension can’t simply append its own changes to an existing gtk.css file instead of overwriting it.

I’m not 100% sure but I think I ran into problems adding my CSS code to the extension CSS file. The system logs shows countless error messages like:

nautilus[18617]: Theme parser error: gtk.css:4:3-37: No property named "-GtkScrollbar-has-backward-stepper"
gnome-logs[6418]: Theme parser error: gtk.css:4:3-37: No property named "-GtkScrollbar-has-backward-stepper"
gjs[3453]: Theme parser error: gtk.css:4:3-37: No property named "-GtkScrollbar-has-backward-stepper"

I’m wondering if it’s because I’ve added it to the extensions file and it therefore puts my code in places where it isn’t supported or if this would also happen with a custom gtk.css file and the extension being disabled.

I’ve closed the issue over at Github. Sadly the only working solution for having a custom CSS file (gtk.css) is to disable the Custom Accent Colors Extension in the gnome-extensions-app.

Well, after selecting the color accent you want, copy the values the extension writes to gtk.css, disable the extension, then restore your custom file and paste the values into it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.