Buttons on GTK3 scrollbars
Published: 2018-04-15
Figure 1: before (left) and after (right) screenshots of a scrollable item in gtk3-widget-factory
In the default Adwaita theme of GTK3, the scrollbars are Apple-esque blobs lacking any up/down buttons. Also, the scrollbars implement some sort of "auto-hide" behavior that hides them when the cursor is far away.
These have been long standing minor annoyances of mine. Let's fix them!
Disable scrollbar auto-hide
To disable the "auto-hide" feature of GTK3 scrollbars, add the
following environment variable to your .profile
, .bash_profile
, or
wherever you put your customized environment variables.
export GTK_OVERLAY_SCROLLING=0
Note: If you are running a display manager, consult your display
manager's documentation. Some display managers source .profile
;
some don't. Personally, I prefer to use startx
to launch a
graphical session, so .bash_profile
is loaded when I login.
Add buttons to scrollbars
One more thing is missing: the up and down buttons.
Create the file ~/.config/gtk-3.0/gtk.css
:
* { -GtkScrollbar-has-backward-stepper: true; -GtkScrollbar-has-forward-stepper: true; /* -GtkScrollbar-has-secondary-backward-stepper: false; */ /* -GtkScrollbar-has-secondary-forward-stepper: false; */ }
Uncomment and set the has-secondary-*-stepper
properties if you
desire to configure a scrollbar that has both up/down buttons on a
single corner (e.g. old KDE style).
Apply the changes
If you changed the GTK_OVERLAY_SCROLLING
environment variable, log
out and log back in so that the change takes effect globally. If you
created or modified gtk.css
, restart all GTK3 applications.
Conclusion
It's hard to say anything about UI design without starting a flame war, so I will keep it simple:
This is my workbench, dammit, it's not a pretty box to impress people with graphics and sounds. When I work at this system up to 12 hours a day, I'm profoundly uninterested in what user interface a novice user would prefer.
Comments
Reddit user sdeklight points out other locations to store environment variables:
Why not just use
/etc/environment
,/etc/security/pam_env.conf
or~/.pam_environment
to store your variables? Those are loaded by pam on login independently of shells and WMs.
Reddit user AnSpailpinFanach suggests using ~/.xsessionrc
:
On Debian the recommended place to put them is
~/.xsessionrc
. In that way they are available only in an X session. Example:$ cat .xsessionrc export QT_STYLE_OVERRIDE=gtk export GTK_OVERLAY_SCROLLING=0The file is sourced, not executed, on starting a session so it doesn't need to be executable.
Reddit user SomeGenericUsername gives some helpful troubleshooting advice:
Depending on your setup and how the dbus session daemon is started, you might also need to run
dbus-update-activation-environment
GTK_OVERLAY_SCROLLING
after setting the environment variable for this to work with applications that are started via dbus activation (e.g. gedit) and inherit their environment variables from the dbus session.
Reddit user __konrad
links to an additional trick to remove the
dashed lines.
Thank you to all for reviewing and providing feedback!