diff --git a/README.asciidoc b/README.asciidoc index 5d7224455..52b36cec8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -130,6 +130,7 @@ Contributors, sorted by the number of commits in descending order: // QUTE_AUTHORS_START * Florian Bruhin * Claude +* ZDarian * Peter Vilim * John ShaggyTwoDope Jenkins * rikn00 diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 73cf2205a..32ae8e9a5 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -372,7 +372,7 @@ Syntax: +:set [*--temp*] ['section'] ['option'] ['value']+ Set an option. -If the option name ends with '?', the value of the option is shown instead. +If the option name ends with '?', the value of the option is shown instead. If the option name ends with '!' and it is a boolean value, toggle it. ==== positional arguments * +'section'+: The section where the option is in. diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 4fa66ad19..05fd1c47c 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -82,7 +82,8 @@ |<>|How new tabs are positioned. |<>|How new tabs opened explicitely are positioned. |<>|Behaviour when the last tab is closed. -|<>|Hide the tabbar if only one tab is open. +|<>|Hide the tabbar if only one tab is open. +|<>|Always hide the tabbar. |<>|Whether to wrap when changing tabs. |<>|Whether tabs should be movable. |<>|On which mouse button to close tabs. @@ -718,8 +719,8 @@ Valid values: Default: +pass:[ignore]+ -[[tabs-auto-hide]] -=== auto-hide +[[tabs-hide-auto]] +=== hide-auto Hide the tabbar if only one tab is open. Valid values: @@ -729,6 +730,17 @@ Valid values: Default: +pass:[false]+ +[[tabs-hide-always]] +=== hide-always +Always hide the tabbar. + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[false]+ + [[tabs-wrap]] === wrap Whether to wrap when changing tabs. diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index b12c33dcf..8c70112c9 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -209,6 +209,7 @@ class ConfigManager(QObject): ('colors', 'tab.indicator.stop'): 'tabs.indicator.stop', ('colors', 'tab.indicator.error'): 'tabs.indicator.error', ('colors', 'tab.indicator.system'): 'tabs.indicator.system', + ('tabs', 'auto-hide'): 'hide-auto', } DELETED_OPTIONS = [ ('colors', 'tab.seperator'), @@ -499,6 +500,8 @@ class ConfigManager(QObject): If the option name ends with '?', the value of the option is shown instead. + If the option name ends with '!' and it is a boolean value, toggle it. + // Wrapper for self.set() to output exceptions in the status bar. @@ -523,6 +526,14 @@ class ConfigManager(QObject): val = self.get(sectname, optname[:-1], transformed=False) message.info(win_id, "{} {} = {}".format( sectname, optname[:-1], val), immediately=True) + elif optname.endswith('!'): + val = self.get(sectname, optname[:-1]) + layer = 'temp' if temp else 'conf' + if isinstance(val, bool): + self.set(layer, sectname, optname[:-1], str(not val)) + else: + raise cmdexc.CommandError("set: Attempted inversion of " + "non-boolean value.") else: if value is None: raise cmdexc.CommandError("set: The following arguments " diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 9d22c1f72..50f39c1ac 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -356,10 +356,14 @@ DATA = collections.OrderedDict([ SettingValue(typ.LastClose(), 'ignore'), "Behaviour when the last tab is closed."), - ('auto-hide', + ('hide-auto', SettingValue(typ.Bool(), 'false'), "Hide the tabbar if only one tab is open."), + ('hide-always', + SettingValue(typ.Bool(), 'false'), + "Always hide the tabbar."), + ('wrap', SettingValue(typ.Bool(), 'true'), "Whether to wrap when changing tabs."), diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 6b1773fc6..f87ab17f4 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -97,16 +97,27 @@ class TabBar(QTabBar): config_obj.changed.connect(self.set_colors) QTimer.singleShot(0, self.autohide) config_obj.changed.connect(self.autohide) + config_obj.changed.connect(self.alwayshide) config_obj.changed.connect(self.on_tab_colors_changed) def __repr__(self): return utils.get_repr(self, count=self.count()) - @config.change_filter('tabs', 'auto-hide') + @config.change_filter('tabs', 'hide-auto') def autohide(self): - """Auto-hide the tabbar if needed.""" - auto_hide = config.get('tabs', 'auto-hide') - if auto_hide and self.count() == 1: + """Hide tabbar if needed when tabs->hide-auto got changed.""" + self._tabhide() + + @config.change_filter('tabs', 'hide-always') + def alwayshide(self): + """Hide tabbar if needed when tabs->hide-always got changed.""" + self._tabhide() + + def _tabhide(self): + """Hide the tabbar if needed.""" + hide_auto = config.get('tabs', 'hide-auto') + hide_always = config.get('tabs', 'hide-always') + if hide_always or (hide_auto and self.count() == 1): self.hide() else: self.show()