In 12.04 LTS there's a slightly cleaner way to do it. Just run
gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false
in a terminal. Apps opened afterwards will have the non-ayatana scrollbar.
To get the default behavior back, run
gsettings reset org.gnome.desktop.interface ubuntu-overlay-scrollbars
If you are using 12.10 or later, run
gsettings set com.canonical.desktop.interface scrollbar-mode normal
And to return to the default, run
gsettings reset com.canonical.desktop.interface scrollbar-mode
With 15.10 Ubuntu switched to Gnome-scrollbars. Searching for this topic I found https://www.reddit.com/r/gnome/comments/37bp1r/how_do_i_disable_316s_overlay_scrollbars/ where it is suggested to use the following commands:
export GTK_OVERLAY_SCROLLING=0
gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment '{"GTK_OVERLAY_SCROLLING": "0"}'
I just tested these commands on UbuntuGnome 17.04, the scrollbars stopped hiding and were visible all the time without hovering over them.
If the commands work for you, you may add them to your ~/.profile
-file.
Best Answer
The reason why solutions working in older Ubuntu versions do not work anymore are changes in CSS which GTK+ uses for styling and layout.
Put this into your ~/.config/gtk-3.0/gtk.css (create the file, if necessary):
Put the same into /root/.config/gtk-3.0/gtk.css for getting the same scrollbar experience for root applications like Synaptic.
And this prevents the scrollbar from disappearing when you are inactive:
For changes to take effect you might need to restart applications resp. log out and in again.
I am not completely satisfied with this solution though because the scrollbars do not look as "professional" as one might expect and because they look different in different applications. E.g. the steppers look OK in Firefox - the up and down arrows are visible. In Gnome Terminal and Nautilus they are just some rounded rectangles without arrows (as well as in the application I am developing).
Other applications come with their "own" scrollbars - e.g. Geany. They are completely unaffected by these settings and still look as one would expect from decent scrollbars. Maybe someone can figure out how to "steal" them from Geany. Update: In 18.04 Geany does not come with it's own scrollbars anymore but e.g. FBReader and Gimp still do.
However, getting rid of the warping slider still works in the old way: