diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 9143a4c41..8bac566da 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -267,6 +267,7 @@ |<>|Page to open if :open -t/-b/-w is used without URL. |<>|URL segments where `:navigate increment/decrement` will search for a number. |<>|Open base URL of the searchengine if a searchengine shortcut is invoked without parameters. +|<>|Which categories should be shown in the :open dialogue. |<>|Search engines which can be used via the address bar. |<>|Page(s) to open at the start. |<>|URL parameters to strip with `:yank url`. @@ -3227,6 +3228,18 @@ Type: <> Default: +pass:[false]+ +[[url.open_categories_shown]] +=== url.open_categories_shown +Which categories should be shown in the :open dialogue. + +Type: <> + +Default +- +pass:[bookmarks]+ +- +pass:[searchengines]+ +- +pass:[history]+ +- +pass:[quickmarks]+ + [[url.searchengines]] === url.searchengines Search engines which can be used via the address bar. diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index bebf6d829..5b544ea3d 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -22,6 +22,7 @@ from qutebrowser.completion.models import (completionmodel, listcategory, histcategory) from qutebrowser.utils import log, objreg +from qutebrowser.config import config _URLCOL = 0 @@ -50,7 +51,7 @@ def _delete_quickmark(data): def url(*, info): - """A model which combines bookmarks, quickmarks and web history URLs. + """A model which combines bookmarks, quickmarks, search engines and web history URLs. Used for the `open` command. """ @@ -59,16 +60,22 @@ def url(*, info): quickmarks = [(url, name) for (name, url) in objreg.get('quickmark-manager').marks.items()] bookmarks = objreg.get('bookmark-manager').marks.items() + searchengines = config.val.url.searchengines.items() + categories = config.val.url.open_categories_shown - if quickmarks: + if searchengines and "searchengines" in categories: + model.add_category(listcategory.ListCategory( + 'Search engines', searchengines, sort=False)) + + if quickmarks and "quickmarks" in categories: model.add_category(listcategory.ListCategory( 'Quickmarks', quickmarks, delete_func=_delete_quickmark, sort=False)) - if bookmarks: + if bookmarks and "bookmarks" in categories: model.add_category(listcategory.ListCategory( 'Bookmarks', bookmarks, delete_func=_delete_bookmark, sort=False)) - if info.config.get('completion.web_history_max_items') != 0: + if info.config.get('completion.web_history_max_items') != 0 and "history" in categories: hist_cat = histcategory.HistoryCategory(delete_func=_delete_history) model.add_category(hist_cat) return model diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 49e037538..a5a5a067e 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1565,6 +1565,19 @@ url.open_base_url: default: false desc: Open base URL of the searchengine if a searchengine shortcut is invoked without parameters. +url.open_categories_shown: + type: + name: List + valtype: String + none_ok: true + default: + - searchengines + - quickmarks + - bookmarks + - history + desc: Which categories should be shown in the :open dialogue. + + url.searchengines: default: DEFAULT: https://duckduckgo.com/?q={}