summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Schwab <git@nicholas-schwab.de>2021-04-08 15:23:53 +0200
committerNicholas Schwab <git@nicholas-schwab.de>2021-04-08 15:23:53 +0200
commit5fa0228a7efc3b8ea64b7002a198d0a22d0c8cd1 (patch)
tree76e9f536760c8a39eb2e6477e14cdf2b8f192138
parent3474604dea49381980c27a8d5caabfe3655b165a (diff)
downloadqutebrowser-5fa0228a7efc3b8ea64b7002a198d0a22d0c8cd1.tar.gz
qutebrowser-5fa0228a7efc3b8ea64b7002a198d0a22d0c8cd1.zip
Added configtype StatusbarWidget that can either be one of the valid_values or text:*.
-rw-r--r--qutebrowser/config/configdata.yml2
-rw-r--r--qutebrowser/config/configtypes.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index dc8ddd1dc..9ceb84173 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -1917,7 +1917,7 @@ statusbar.widgets:
type:
name: List
valtype:
- name: String
+ name: StatusbarWidget
valid_values:
- url: "Current page URL."
- scroll: "Percentage of the current page position like `10%`."
diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py
index 49a1f0356..4439cd4f4 100644
--- a/qutebrowser/config/configtypes.py
+++ b/qutebrowser/config/configtypes.py
@@ -1996,3 +1996,15 @@ class UrlPattern(BaseType):
return urlmatch.UrlPattern(value)
except urlmatch.ParseError as e:
raise configexc.ValidationError(value, str(e))
+
+
+class StatusbarWidget(String):
+
+ """A Widget for the status bar.
+
+ Allows some predefined widgets and custom text-widgets via text:$CONTENT."""
+
+ def _validate_valid_values(self, value: str) -> None:
+ if value.startswith("text:"):
+ return
+ super()._validate_valid_values(value)