Added support for searchengines listing in :open dialogue. Added settings for selecting what categories are shown in the :open dialogue.
This commit is contained in:
parent
e2ef39e872
commit
a62aeb4abe
@ -267,6 +267,7 @@
|
||||
|<<url.default_page,url.default_page>>|Page to open if :open -t/-b/-w is used without URL.
|
||||
|<<url.incdec_segments,url.incdec_segments>>|URL segments where `:navigate increment/decrement` will search for a number.
|
||||
|<<url.open_base_url,url.open_base_url>>|Open base URL of the searchengine if a searchengine shortcut is invoked without parameters.
|
||||
|<<url.open_categories_shown,url.open_categories_shown>>|Which categories should be shown in the :open dialogue.
|
||||
|<<url.searchengines,url.searchengines>>|Search engines which can be used via the address bar.
|
||||
|<<url.start_pages,url.start_pages>>|Page(s) to open at the start.
|
||||
|<<url.yank_ignored_parameters,url.yank_ignored_parameters>>|URL parameters to strip with `:yank url`.
|
||||
@ -3227,6 +3228,18 @@ Type: <<types,Bool>>
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[url.open_categories_shown]]
|
||||
=== url.open_categories_shown
|
||||
Which categories should be shown in the :open dialogue.
|
||||
|
||||
Type: <<types,List of Strings>>
|
||||
|
||||
Default
|
||||
- +pass:[bookmarks]+
|
||||
- +pass:[searchengines]+
|
||||
- +pass:[history]+
|
||||
- +pass:[quickmarks]+
|
||||
|
||||
[[url.searchengines]]
|
||||
=== url.searchengines
|
||||
Search engines which can be used via the address bar.
|
||||
|
@ -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
|
||||
|
@ -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={}
|
||||
|
Loading…
Reference in New Issue
Block a user