Gedit, OverlayScrolling and DBus

GTK3's overlay scrollbars can be quite annoying. Especially if the theme you're using isn't keeping up with the latest changes and is barely functional. Fortunately, there's an easy way to disable them by using the GTK_OVERLAY_SCROLLING environment variable.

My Openbox environment had some trouble with that. I noticed that depending how a GTK3 application was started, that it either respected that environment variable or not. Opening a text file from my file manager with Gedit seemed to disregard it. The scrollbars would still autohide and what's even worse: cover up a line.


Running Gedit from my terminal worked and the scrollbars were always visible. After a lot of troubleshooting I have figured out why it was happening.

Every time I opened a file through the file manager, Gedit was started via Dbus activation. The overlay scrollbars were still there because the Dbus session wasn't aware of the environment variable. Since I exported GTK_OVERLAY_SCROLLING in Openbox's environment file, it was exported AFTER the Dbus session initialized. That's why it was unaware of the variable upon opening Gedit via Dbus activation.

The first solution, and what helped me figure this out, was this post on Reddit. However, instead of just exporting that one variable, it's probably better to make Dbus aware of all the new environment variables exported through Openbox's environment file after its start. To do that, run:

dbus-update-activation-environment --systemd --all

after your Openbox session starts. I have it inside my openbox/environment file. Of course I figured this out after I stopped using Gedit.