gnome-terminator / terminator

multiple GNOME terminals in one window
https://gnome-terminator.org
GNU General Public License v2.0
2.12k stars 257 forks source link

Use auto-hiding scrollbar from GTK3, rather than the old one #216

Open mattrose opened 4 years ago

mattrose commented 4 years ago

From a comment on reddit

Handling of scrollbar - Tilix has perfect solution (auto-hiding, barely visible scrollbar - using modern Gnome style); Terminator has old scrollbar from GTK2 times, with an option to disable it completely (but no option for autohide the same way Tilix does it).

mattrose commented 3 years ago

Wow. I know vte doesn't support the auto-hiding scrollbar natively, so I was wondering how Tilix did it.

Turns out they set a transparent Gtk.ScrolledWindow() the same size as the vte window and use the automatic scrollbar from the ScrolledWindow.

       if (useOverlayScrollbar) {
            sw = new ScrolledWindow(vte);
            sw.getStyleContext.addClass("tilix-terminal-scrolledwindow");
            sw.setPropagateNaturalHeight(true);
            sw.setPropagateNaturalWidth(true);
            sw.getVadjustment().addOnValueChanged(&updateNewOutputIndicator);
            terminalOverlay.add(sw);
        } else {
            terminalOverlay.add(vte);
        }