diff options
-rw-r--r-- | terminal.vala | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/terminal.vala b/terminal.vala index b9f96de..42da259 100644 --- a/terminal.vala +++ b/terminal.vala @@ -34,8 +34,10 @@ class Terminal : Gtk.Overlay { [GtkChild] unowned Gtk.SearchEntry search_entry; [GtkChild] unowned Vte.Terminal vte; Gtk.Clipboard clipboard; + Gtk.Settings settings; bool has_search; + bool overlay_scrolling_env_override; string url_match; string hyperlink_match; uint? infobar_timeout_id; @@ -44,6 +46,11 @@ class Terminal : Gtk.Overlay { public Terminal(string[] args, Gtk.Container parent, Gtk.Window window) { Object(parent: parent, window: window); + settings = Gtk.Settings.get_for_screen(window.screen); + + if (Environment.get_variable("GTK_OVERLAY_SCROLLING") == "0") + overlay_scrolling_env_override = true; + load_config(false); search_update_sensitivity(); @@ -74,11 +81,20 @@ class Terminal : Gtk.Overlay { } } + Gtk.PolicyType get_scrollbar_policy(bool want_scrollbar) { + if (!want_scrollbar) + return Gtk.PolicyType.NEVER; + + if (!settings.gtk_overlay_scrolling || overlay_scrolling_env_override) + return Gtk.PolicyType.ALWAYS; + + return Gtk.PolicyType.AUTOMATIC; + } + public void load_config(bool reload) { var conf = new Config(); - Gtk.PolicyType policy = conf.scrollbar ? Gtk.PolicyType.AUTOMATIC : Gtk.PolicyType.NEVER; - scrolled_window.set_policy(Gtk.PolicyType.NEVER, policy); + scrolled_window.set_policy(Gtk.PolicyType.NEVER, get_scrollbar_policy(conf.scrollbar)); vte.set_allow_hyperlink(conf.allow_hyperlinks); |