Add an url. group to settings

This commit is contained in:
Florian Bruhin 2017-07-02 12:07:27 +02:00
parent 5c08c6c930
commit 50602cbf26
19 changed files with 213 additions and 212 deletions

View File

@ -11,7 +11,6 @@
|<<auto_save.config,auto_save.config>>|Whether to save the config automatically on quit. |<<auto_save.config,auto_save.config>>|Whether to save the config automatically on quit.
|<<auto_save.interval,auto_save.interval>>|How often (in milliseconds) to auto-save config/cookies/etc. |<<auto_save.interval,auto_save.interval>>|How often (in milliseconds) to auto-save config/cookies/etc.
|<<auto_save.session,auto_save.session>>|Whether to always save the open pages. |<<auto_save.session,auto_save.session>>|Whether to always save the open pages.
|<<auto_search,auto_search>>|Whether to start a search when something else than a URL is entered.
|<<bindings.commands,bindings.commands>>|Keybindings mapping keys to commands in different modes. |<<bindings.commands,bindings.commands>>|Keybindings mapping keys to commands in different modes.
|<<bindings.default,bindings.default>>|Default keybindings. If you want to add bindings, modify `bindings.commands` instead. |<<bindings.default,bindings.default>>|Default keybindings. If you want to add bindings, modify `bindings.commands` instead.
|<<bindings.key_mappings,bindings.key_mappings>>|This setting can be used to map keys to other keys. |<<bindings.key_mappings,bindings.key_mappings>>|This setting can be used to map keys to other keys.
@ -145,7 +144,6 @@
|<<content.user_stylesheet,content.user_stylesheet>>|User stylesheet to use (absolute filename or filename relative to the config directory). Will expand environment variables. |<<content.user_stylesheet,content.user_stylesheet>>|User stylesheet to use (absolute filename or filename relative to the config directory). Will expand environment variables.
|<<content.webgl,content.webgl>>|Enables or disables WebGL. |<<content.webgl,content.webgl>>|Enables or disables WebGL.
|<<content.xss_auditing,content.xss_auditing>>|Whether load requests should be monitored for cross-site scripting attempts. |<<content.xss_auditing,content.xss_auditing>>|Whether load requests should be monitored for cross-site scripting attempts.
|<<default_page,default_page>>|The page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
|<<downloads.location.directory,downloads.location.directory>>|The directory to save downloads to. |<<downloads.location.directory,downloads.location.directory>>|The directory to save downloads to.
|<<downloads.location.prompt,downloads.location.prompt>>|Whether to prompt the user for the download location. |<<downloads.location.prompt,downloads.location.prompt>>|Whether to prompt the user for the download location.
|<<downloads.location.remember,downloads.location.remember>>|Whether to remember the last used download directory. |<<downloads.location.remember,downloads.location.remember>>|Whether to remember the last used download directory.
@ -206,15 +204,11 @@
|<<keyhint.delay,keyhint.delay>>|Time from pressing a key to seeing the keyhint dialog (ms) |<<keyhint.delay,keyhint.delay>>|Time from pressing a key to seeing the keyhint dialog (ms)
|<<messages.timeout,messages.timeout>>|Time (in ms) to show messages in the statusbar for. |<<messages.timeout,messages.timeout>>|Time (in ms) to show messages in the statusbar for.
|<<messages.unfocused,messages.unfocused>>|Whether to show messages in unfocused windows. |<<messages.unfocused,messages.unfocused>>|Whether to show messages in unfocused windows.
|<<new_instance_open_target,new_instance_open_target>>|How to open links in an existing instance if a new one is launched.
|<<new_instance_open_target_window,new_instance_open_target_window>>|Which window to choose when opening links as new tabs.
|<<prompt.filebrowser,prompt.filebrowser>>|Show a filebrowser in upload/download prompts. |<<prompt.filebrowser,prompt.filebrowser>>|Show a filebrowser in upload/download prompts.
|<<prompt.radius,prompt.radius>>|The rounding radius for the edges of prompts. |<<prompt.radius,prompt.radius>>|The rounding radius for the edges of prompts.
|<<scrolling.bar,scrolling.bar>>|Show a scrollbar. |<<scrolling.bar,scrolling.bar>>|Show a scrollbar.
|<<scrolling.smooth,scrolling.smooth>>|Whether to enable smooth scrolling for web pages. Note smooth scrolling does not work with the `:scroll-px` command. |<<scrolling.smooth,scrolling.smooth>>|Whether to enable smooth scrolling for web pages. Note smooth scrolling does not work with the `:scroll-px` command.
|<<searchengines,searchengines>>|Definitions of search engines which can be used via the address bar.
|<<session_default_name,session_default_name>>|The name of the session to save by default, or unset for the last loaded session. |<<session_default_name,session_default_name>>|The name of the session to save by default, or unset for the last loaded session.
|<<start_pages,start_pages>>|The default page(s) to open at the start.
|<<statusbar.hide,statusbar.hide>>|Whether to hide the statusbar unless a message is shown. |<<statusbar.hide,statusbar.hide>>|Whether to hide the statusbar unless a message is shown.
|<<statusbar.padding,statusbar.padding>>|Padding for the statusbar. |<<statusbar.padding,statusbar.padding>>|Padding for the statusbar.
|<<statusbar.position,statusbar.position>>|The position of the status bar. |<<statusbar.position,statusbar.position>>|The position of the status bar.
@ -240,10 +234,16 @@
|<<tabs.width.indicator,tabs.width.indicator>>|Width of the progress indicator (0 to disable). |<<tabs.width.indicator,tabs.width.indicator>>|Width of the progress indicator (0 to disable).
|<<tabs.width.pinned,tabs.width.pinned>>|The width for pinned tabs with a horizontal tabbar, in px. |<<tabs.width.pinned,tabs.width.pinned>>|The width for pinned tabs with a horizontal tabbar, in px.
|<<tabs.wrap,tabs.wrap>>|Whether to wrap when changing tabs. |<<tabs.wrap,tabs.wrap>>|Whether to wrap when changing tabs.
|<<url_incdec_segments,url_incdec_segments>>|The URL segments where `:navigate increment/decrement` will search for a number. |<<url.auto_search,url.auto_search>>|Whether to start a search when something else than a URL is entered.
|<<url.default_page,url.default_page>>|The page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
|<<url.incdec_segments,url.incdec_segments>>|The URL segments where `:navigate increment/decrement` will search for a number.
|<<url.new_instance_open_target,url.new_instance_open_target>>|How to open links in an existing instance if a new one is launched.
|<<url.new_instance_open_target_window,url.new_instance_open_target_window>>|Which window to choose when opening links as new tabs.
|<<url.searchengines,url.searchengines>>|Definitions of search engines which can be used via the address bar.
|<<url.start_pages,url.start_pages>>|The default page(s) to open at the start.
|<<url.yank_ignored_parameters,url.yank_ignored_parameters>>|The URL parameters to strip with :yank url.
|<<window.hide_wayland_decoration,window.hide_wayland_decoration>>|Hide the window decoration when using wayland (requires restart) |<<window.hide_wayland_decoration,window.hide_wayland_decoration>>|Hide the window decoration when using wayland (requires restart)
|<<window.title_format,window.title_format>>|The format to use for the window title. The following placeholders are defined: |<<window.title_format,window.title_format>>|The format to use for the window title. The following placeholders are defined:
|<<yank_ignored_url_parameters,yank_ignored_url_parameters>>|The URL parameters to strip with :yank url.
|<<zoom.default,zoom.default>>|The default zoom level. |<<zoom.default,zoom.default>>|The default zoom level.
|<<zoom.levels,zoom.levels>>|The available zoom levels. |<<zoom.levels,zoom.levels>>|The available zoom levels.
|<<zoom.mouse_divider,zoom.mouse_divider>>|How much to divide the mouse wheel movements to translate them into zoom increments. |<<zoom.mouse_divider,zoom.mouse_divider>>|How much to divide the mouse wheel movements to translate them into zoom increments.
@ -284,18 +284,6 @@ Valid values:
Default: empty Default: empty
[[auto_search]]
== auto_search
Whether to start a search when something else than a URL is entered.
Valid values:
* +naive+: Use simple/naive check.
* +dns+: Use DNS requests (might be slow!).
* +never+: Never search automatically.
Default: +pass:[naive]+
[[bindings.commands]] [[bindings.commands]]
== bindings.commands == bindings.commands
Keybindings mapping keys to commands in different modes. Keybindings mapping keys to commands in different modes.
@ -1414,12 +1402,6 @@ Valid values:
Default: empty Default: empty
[[default_page]]
== default_page
The page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
Default: +pass:[https://start.duckduckgo.com/]+
[[downloads.location.directory]] [[downloads.location.directory]]
== downloads.location.directory == downloads.location.directory
The directory to save downloads to. The directory to save downloads to.
@ -1891,33 +1873,6 @@ Valid values:
Default: empty Default: empty
[[new_instance_open_target]]
== new_instance_open_target
How to open links in an existing instance if a new one is launched.
Valid values:
* +tab+: Open a new tab in the existing window and activate the window.
* +tab-bg+: Open a new background tab in the existing window and activate the window.
* +tab-silent+: Open a new tab in the existing window without activating the window.
* +tab-bg-silent+: Open a new background tab in the existing window without activating the window.
* +window+: Open in a new window.
Default: +pass:[tab]+
[[new_instance_open_target_window]]
== new_instance_open_target_window
Which window to choose when opening links as new tabs.
Valid values:
* +first-opened+: Open new tabs in the first (oldest) opened window.
* +last-opened+: Open new tabs in the last (newest) opened window.
* +last-focused+: Open new tabs in the most recently focused window.
* +last-visible+: Open new tabs in the most recently visible window.
Default: +pass:[last-focused]+
[[prompt.filebrowser]] [[prompt.filebrowser]]
== prompt.filebrowser == prompt.filebrowser
Show a filebrowser in upload/download prompts. Show a filebrowser in upload/download prompts.
@ -1957,25 +1912,12 @@ Valid values:
Default: empty Default: empty
[[searchengines]]
== searchengines
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `auto_search` is turned on and something else than a URL was entered to be opened. Other search engines can be used by prepending the search engine name to the search term, e.g. `:open google qutebrowser`. The string `{}` will be replaced by the search term, use `{{` and `}}` for literal `{`/`}` signs.
Default: +pass:[{&quot;DEFAULT&quot;: &quot;https://duckduckgo.com/?q={}&quot;}]+
[[session_default_name]] [[session_default_name]]
== session_default_name == session_default_name
The name of the session to save by default, or unset for the last loaded session. The name of the session to save by default, or unset for the last loaded session.
Default: empty Default: empty
[[start_pages]]
== start_pages
The default page(s) to open at the start.
Default: +pass:[[&quot;https://start.duckduckgo.com&quot;]]+
[[statusbar.hide]] [[statusbar.hide]]
== statusbar.hide == statusbar.hide
Whether to hide the statusbar unless a message is shown. Whether to hide the statusbar unless a message is shown.
@ -2227,8 +2169,26 @@ Valid values:
Default: +pass:[true]+ Default: +pass:[true]+
[[url_incdec_segments]] [[url.auto_search]]
== url_incdec_segments == url.auto_search
Whether to start a search when something else than a URL is entered.
Valid values:
* +naive+: Use simple/naive check.
* +dns+: Use DNS requests (might be slow!).
* +never+: Never search automatically.
Default: +pass:[naive]+
[[url.default_page]]
== url.default_page
The page to open if :open -t/-b/-w is used without URL. Use `about:blank` for a blank page.
Default: +pass:[https://start.duckduckgo.com/]+
[[url.incdec_segments]]
== url.incdec_segments
The URL segments where `:navigate increment/decrement` will search for a number. The URL segments where `:navigate increment/decrement` will search for a number.
Valid values: Valid values:
@ -2240,6 +2200,52 @@ Valid values:
Default: +pass:[[&quot;path&quot;, &quot;query&quot;]]+ Default: +pass:[[&quot;path&quot;, &quot;query&quot;]]+
[[url.new_instance_open_target]]
== url.new_instance_open_target
How to open links in an existing instance if a new one is launched.
Valid values:
* +tab+: Open a new tab in the existing window and activate the window.
* +tab-bg+: Open a new background tab in the existing window and activate the window.
* +tab-silent+: Open a new tab in the existing window without activating the window.
* +tab-bg-silent+: Open a new background tab in the existing window without activating the window.
* +window+: Open in a new window.
Default: +pass:[tab]+
[[url.new_instance_open_target_window]]
== url.new_instance_open_target_window
Which window to choose when opening links as new tabs.
Valid values:
* +first-opened+: Open new tabs in the first (oldest) opened window.
* +last-opened+: Open new tabs in the last (newest) opened window.
* +last-focused+: Open new tabs in the most recently focused window.
* +last-visible+: Open new tabs in the most recently visible window.
Default: +pass:[last-focused]+
[[url.searchengines]]
== url.searchengines
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `url.auto_search` is turned on and something else than a URL was entered to be opened. Other search engines can be used by prepending the search engine name to the search term, e.g. `:open google qutebrowser`. The string `{}` will be replaced by the search term, use `{{` and `}}` for literal `{`/`}` signs.
Default: +pass:[{&quot;DEFAULT&quot;: &quot;https://duckduckgo.com/?q={}&quot;}]+
[[url.start_pages]]
== url.start_pages
The default page(s) to open at the start.
Default: +pass:[[&quot;https://start.duckduckgo.com&quot;]]+
[[url.yank_ignored_parameters]]
== url.yank_ignored_parameters
The URL parameters to strip with :yank url.
Default: +pass:[[&quot;ref&quot;, &quot;utm_source&quot;, &quot;utm_medium&quot;, &quot;utm_campaign&quot;, &quot;utm_term&quot;, &quot;utm_content&quot;]]+
[[window.hide_wayland_decoration]] [[window.hide_wayland_decoration]]
== window.hide_wayland_decoration == window.hide_wayland_decoration
Hide the window decoration when using wayland (requires restart) Hide the window decoration when using wayland (requires restart)
@ -2268,12 +2274,6 @@ The format to use for the window title. The following placeholders are defined:
Default: +pass:[{perc}{title}{title_sep}qutebrowser]+ Default: +pass:[{perc}{title}{title_sep}qutebrowser]+
[[yank_ignored_url_parameters]]
== yank_ignored_url_parameters
The URL parameters to strip with :yank url.
Default: +pass:[[&quot;ref&quot;, &quot;utm_source&quot;, &quot;utm_medium&quot;, &quot;utm_campaign&quot;, &quot;utm_term&quot;, &quot;utm_content&quot;]]+
[[zoom.default]] [[zoom.default]]
== zoom.default == zoom.default
The default zoom level. The default zoom level.

View File

@ -271,7 +271,7 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None):
if via_ipc and target_arg and target_arg != 'auto': if via_ipc and target_arg and target_arg != 'auto':
open_target = target_arg open_target = target_arg
else: else:
open_target = config.val.new_instance_open_target open_target = config.val.url.new_instance_open_target
win_id = mainwindow.get_window(via_ipc, force_target=open_target) win_id = mainwindow.get_window(via_ipc, force_target=open_target)
tabbed_browser = objreg.get('tabbed-browser', scope='window', tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id) window=win_id)
@ -307,7 +307,7 @@ def _open_startpage(win_id=None):
window=cur_win_id) window=cur_win_id)
if tabbed_browser.count() == 0: if tabbed_browser.count() == 0:
log.init.debug("Opening start pages") log.init.debug("Opening start pages")
for url in config.val.start_pages: for url in config.val.url.start_pages:
tabbed_browser.tabopen(url) tabbed_browser.tabopen(url)

View File

@ -307,7 +307,7 @@ class CommandDispatcher:
private: Open a new window in private browsing mode. private: Open a new window in private browsing mode.
""" """
if url is None: if url is None:
urls = [config.val.default_page] urls = [config.val.url.default_page]
else: else:
urls = self._parse_url_input(url) urls = self._parse_url_input(url)
@ -778,7 +778,7 @@ class CommandDispatcher:
url_query.setQueryDelimiters('=', ';') url_query.setQueryDelimiters('=', ';')
url_query.setQuery(url_query_str) url_query.setQuery(url_query_str)
for key in dict(url_query.queryItems()): for key in dict(url_query.queryItems()):
if key in config.val.yank_ignored_url_parameters: if key in config.val.url.yank_ignored_parameters:
url_query.removeQueryItem(key) url_query.removeQueryItem(key)
url.setQuery(url_query) url.setQuery(url_query)
return url.toString(flags) return url.toString(flags)
@ -1192,7 +1192,7 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.register(instance='command-dispatcher', scope='window')
def home(self): def home(self):
"""Open main startpage in current tab.""" """Open main startpage in current tab."""
self._current_widget().openurl(config.val.start_pages[0]) self._current_widget().openurl(config.val.url.start_pages[0])
def _run_userscript(self, cmd, *args, verbose=False): def _run_userscript(self, cmd, *args, verbose=False):
"""Run a userscript given as argument. """Run a userscript given as argument.

View File

@ -42,7 +42,7 @@ def incdec(url, count, inc_or_dec):
background: Open the link in a new background tab. background: Open the link in a new background tab.
window: Open the link in a new window. window: Open the link in a new window.
""" """
segments = set(config.val.url_incdec_segments) segments = set(config.val.url.incdec_segments)
try: try:
new_url = urlutils.incdec_number(url, inc_or_dec, count, new_url = urlutils.incdec_number(url, inc_or_dec, count,
segments=segments) segments=segments)

View File

@ -15,28 +15,11 @@ aliases:
desc: >- desc: >-
Aliases for commands. Aliases for commands.
auto_search:
type:
name: String
valid_values:
- naive: Use simple/naive check.
- dns: Use DNS requests (might be slow!).
- never: Never search automatically.
default: naive
desc: Whether to start a search when something else than a URL is entered.
confirm_quit: confirm_quit:
type: ConfirmQuit type: ConfirmQuit
default: [never] default: [never]
desc: Whether to confirm quitting the application. desc: Whether to confirm quitting the application.
default_page:
type: FuzzyUrl
default: https://start.duckduckgo.com/
desc: >-
The page to open if :open -t/-b/-w is used without URL. Use `about:blank`
for a blank page.
history_session_interval: history_session_interval:
type: Int type: Int
default: 30 default: 30
@ -53,49 +36,6 @@ ignore_case:
default: smart default: smart
desc: Whether to find text on a page case-insensitively. desc: Whether to find text on a page case-insensitively.
new_instance_open_target:
type:
name: String
valid_values:
- tab: Open a new tab in the existing window and activate the window.
- tab-bg: Open a new background tab in the existing window and activate
the window.
- tab-silent: Open a new tab in the existing window without activating the
window.
- tab-bg-silent: Open a new background tab in the existing window without
activating the window.
- window: Open in a new window.
default: tab
desc: How to open links in an existing instance if a new one is launched.
new_instance_open_target_window:
type:
name: String
valid_values:
- first-opened: Open new tabs in the first (oldest) opened window.
- last-opened: Open new tabs in the last (newest) opened window.
- last-focused: Open new tabs in the most recently focused window.
- last-visible: Open new tabs in the most recently visible window.
default: last-focused
desc: Which window to choose when opening links as new tabs.
searchengines:
default:
DEFAULT: https://duckduckgo.com/?q={}
type:
name: Dict
required_keys: ['DEFAULT']
keytype: String
valtype: SearchEngineUrl
desc: >-
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `auto_search` is turned on and
something else than a URL was entered to be opened. Other search engines can
be used by prepending the search engine name to the search term, e.g. `:open
google qutebrowser`. The string `{}` will be replaced by the search term,
use `{{` and `}}` for literal `{`/`}` signs.
session_default_name: session_default_name:
type: type:
name: SessionName name: SessionName
@ -104,35 +44,6 @@ session_default_name:
desc: The name of the session to save by default, or unset for the last loaded desc: The name of the session to save by default, or unset for the last loaded
session. session.
start_pages:
type:
name: List
valtype: FuzzyUrl
default: ["https://start.duckduckgo.com"]
desc: The default page(s) to open at the start.
url_incdec_segments:
type:
name: FlagList
valid_values: [host, path, query, anchor]
default: [path, query]
desc: The URL segments where `:navigate increment/decrement` will search for a
number.
yank_ignored_url_parameters:
type:
name: List
valtype: String
none_ok: true
default:
- ref
- utm_source
- utm_medium
- utm_campaign
- utm_term
- utm_content
desc: The URL parameters to strip with :yank url.
## auto_save ## auto_save
auto_save.config: auto_save.config:
@ -1175,6 +1086,97 @@ tabs.wrap:
type: Bool type: Bool
desc: Whether to wrap when changing tabs. desc: Whether to wrap when changing tabs.
## url
url.auto_search:
type:
name: String
valid_values:
- naive: Use simple/naive check.
- dns: Use DNS requests (might be slow!).
- never: Never search automatically.
default: naive
desc: Whether to start a search when something else than a URL is entered.
url.default_page:
type: FuzzyUrl
default: https://start.duckduckgo.com/
desc: >-
The page to open if :open -t/-b/-w is used without URL. Use `about:blank`
for a blank page.
url.incdec_segments:
type:
name: FlagList
valid_values: [host, path, query, anchor]
default: [path, query]
desc: The URL segments where `:navigate increment/decrement` will search for a
number.
url.new_instance_open_target:
type:
name: String
valid_values:
- tab: Open a new tab in the existing window and activate the window.
- tab-bg: Open a new background tab in the existing window and activate
the window.
- tab-silent: Open a new tab in the existing window without activating the
window.
- tab-bg-silent: Open a new background tab in the existing window without
activating the window.
- window: Open in a new window.
default: tab
desc: How to open links in an existing instance if a new one is launched.
url.new_instance_open_target_window:
type:
name: String
valid_values:
- first-opened: Open new tabs in the first (oldest) opened window.
- last-opened: Open new tabs in the last (newest) opened window.
- last-focused: Open new tabs in the most recently focused window.
- last-visible: Open new tabs in the most recently visible window.
default: last-focused
desc: Which window to choose when opening links as new tabs.
url.searchengines:
default:
DEFAULT: https://duckduckgo.com/?q={}
type:
name: Dict
required_keys: ['DEFAULT']
keytype: String
valtype: SearchEngineUrl
desc: >-
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `url.auto_search` is turned on
and something else than a URL was entered to be opened. Other search engines
can be used by prepending the search engine name to the search term, e.g.
`:open google qutebrowser`. The string `{}` will be replaced by the search
term, use `{{` and `}}` for literal `{`/`}` signs.
url.start_pages:
type:
name: List
valtype: FuzzyUrl
default: ["https://start.duckduckgo.com"]
desc: The default page(s) to open at the start.
url.yank_ignored_parameters:
type:
name: List
valtype: String
none_ok: true
default:
- ref
- utm_source
- utm_medium
- utm_campaign
- utm_term
- utm_content
desc: The URL parameters to strip with :yank url.
## window ## window
window.hide_wayland_decoration: window.hide_wayland_decoration:

View File

@ -60,7 +60,7 @@ def get_window(via_ipc, force_window=False, force_tab=False,
# Initial main window # Initial main window
return 0 return 0
open_target = config.val.new_instance_open_target open_target = config.val.url.new_instance_open_target
# Apply any target overrides, ordered by precedence # Apply any target overrides, ordered by precedence
if force_target is not None: if force_target is not None:
@ -98,7 +98,7 @@ def get_window(via_ipc, force_window=False, force_tab=False,
def get_target_window(): def get_target_window():
"""Get the target window for new tabs, or None if none exist.""" """Get the target window for new tabs, or None if none exist."""
try: try:
win_mode = config.val.new_instance_open_target_window win_mode = config.val.url.new_instance_open_target_window
if win_mode == 'last-focused': if win_mode == 'last-focused':
return objreg.last_focused_window() return objreg.last_focused_window()
elif win_mode == 'first-opened': elif win_mode == 'first-opened':

View File

@ -263,11 +263,10 @@ class TabbedBrowser(tabwidget.TabWidget):
elif last_close == 'blank': elif last_close == 'blank':
self.openurl(QUrl('about:blank'), newtab=True) self.openurl(QUrl('about:blank'), newtab=True)
elif last_close == 'startpage': elif last_close == 'startpage':
for url in config.val.start_pages: for url in config.val.url.start_pages:
self.openurl(url, newtab=True) self.openurl(url, newtab=True)
elif last_close == 'default-page': elif last_close == 'default-page':
url = config.val.default_page self.openurl(config.val.url.default_page, newtab=True)
self.openurl(url, newtab=True)
def _remove_tab(self, tab, *, add_undo=True, crashed=False): def _remove_tab(self, tab, *, add_undo=True, crashed=False):
"""Remove a tab from the tab list and delete it properly. """Remove a tab from the tab list and delete it properly.
@ -329,8 +328,8 @@ class TabbedBrowser(tabwidget.TabWidget):
no_history = len(self.widget(0).history) == 1 no_history = len(self.widget(0).history) == 1
urls = { urls = {
'blank': QUrl('about:blank'), 'blank': QUrl('about:blank'),
'startpage': config.val.start_pages[0], 'startpage': config.val.url.start_pages[0],
'default-page': config.val.default_page, 'default-page': config.val.url.default_page,
} }
first_tab_url = self.widget(0).url() first_tab_url = self.widget(0).url()
last_close_urlstr = urls[last_close].toString().rstrip('/') last_close_urlstr = urls[last_close].toString().rstrip('/')

View File

@ -70,7 +70,7 @@ def _parse_search_term(s):
if len(split) == 2: if len(split) == 2:
engine = split[0] engine = split[0]
try: try:
config.val.searchengines[engine] config.val.url.searchengines[engine]
except KeyError: except KeyError:
engine = None engine = None
term = s term = s
@ -100,7 +100,7 @@ def _get_search_url(txt):
assert term assert term
if engine is None: if engine is None:
engine = 'DEFAULT' engine = 'DEFAULT'
template = config.val.searchengines[engine] template = config.val.url.searchengines[engine]
url = qurl_from_user_input(template.format(urllib.parse.quote(term))) url = qurl_from_user_input(template.format(urllib.parse.quote(term)))
qtutils.ensure_valid(url) qtutils.ensure_valid(url)
return url return url
@ -193,7 +193,7 @@ def fuzzy_url(urlstr, cwd=None, relative=False, do_search=True,
url = qurl_from_user_input(urlstr) url = qurl_from_user_input(urlstr)
log.url.debug("Converting fuzzy term {!r} to URL -> {}".format( log.url.debug("Converting fuzzy term {!r} to URL -> {}".format(
urlstr, url.toDisplayString())) urlstr, url.toDisplayString()))
if do_search and config.val.auto_search != 'never' and urlstr: if do_search and config.val.url.auto_search != 'never' and urlstr:
qtutils.ensure_valid(url) qtutils.ensure_valid(url)
else: else:
if not url.isValid(): if not url.isValid():
@ -238,7 +238,7 @@ def is_url(urlstr):
Return: Return:
True if it is a valid URL, False otherwise. True if it is a valid URL, False otherwise.
""" """
autosearch = config.val.auto_search autosearch = config.val.url.auto_search
log.url.debug("Checking if {!r} is a URL (autosearch={}).".format( log.url.debug("Checking if {!r} is a URL (autosearch={}).".format(
urlstr, autosearch)) urlstr, autosearch))

View File

@ -601,7 +601,7 @@ Feature: Downloading things from a website.
Scenario: Downloading invalid URL Scenario: Downloading invalid URL
When I set downloads.location.prompt to false When I set downloads.location.prompt to false
And I set auto_search to never And I set url.auto_search to never
And I run :download foo! And I run :download foo!
Then the error "Invalid URL" should be shown Then the error "Invalid URL" should be shown

View File

@ -54,7 +54,7 @@ Feature: Opening external editors
Then the error "Only one of -t/-b/-w can be given!" should be shown Then the error "Only one of -t/-b/-w can be given!" should be shown
Scenario: Editing a URL with invalid URL Scenario: Editing a URL with invalid URL
When I set auto_search to never When I set url.auto_search to never
And I open data/hello.txt And I open data/hello.txt
And I set up a fake editor replacing "http://localhost:(port)/data/hello.txt" by "foo!" And I set up a fake editor replacing "http://localhost:(port)/data/hello.txt" by "foo!"
And I run :edit-url And I run :edit-url

View File

@ -109,7 +109,7 @@ Feature: Page history
@qtwebengine_skip @qtwebkit_ng_skip @qtwebengine_skip @qtwebkit_ng_skip
Scenario: Opening a valid URL which turns out invalid Scenario: Opening a valid URL which turns out invalid
When I set auto_search to naive When I set url.auto_search to naive
And I run :open http://foo%40bar@baz And I run :open http://foo%40bar@baz
Then "QFSFileEngine::open: No file name specified" should be logged Then "QFSFileEngine::open: No file name specified" should be logged
And "Error while loading : Host not found" should be logged And "Error while loading : Host not found" should be logged

View File

@ -7,7 +7,7 @@ Feature: Invoking a new process
Given I clean up open tabs Given I clean up open tabs
Scenario: Using new-instance-open-target = tab Scenario: Using new-instance-open-target = tab
When I set new_instance_open_target to tab When I set url.new_instance_open_target to tab
And I open data/title.html And I open data/title.html
And I open data/search.html as a URL And I open data/search.html as a URL
Then the following tabs should be open: Then the following tabs should be open:
@ -15,7 +15,7 @@ Feature: Invoking a new process
- data/search.html (active) - data/search.html (active)
Scenario: Using new-instance-open-target = tab-bg Scenario: Using new-instance-open-target = tab-bg
When I set new_instance_open_target to tab-bg When I set url.new_instance_open_target to tab-bg
And I open data/title.html And I open data/title.html
And I open data/search.html as a URL And I open data/search.html as a URL
Then the following tabs should be open: Then the following tabs should be open:
@ -23,7 +23,7 @@ Feature: Invoking a new process
- data/search.html - data/search.html
Scenario: Using new-instance-open-target = window Scenario: Using new-instance-open-target = window
When I set new_instance_open_target to window When I set url.new_instance_open_target to window
And I open data/title.html And I open data/title.html
And I open data/search.html as a URL And I open data/search.html as a URL
Then the session should look like: Then the session should look like:
@ -37,8 +37,8 @@ Feature: Invoking a new process
- url: http://localhost:*/data/search.html - url: http://localhost:*/data/search.html
Scenario: Using new-instance-open-target_window = last-opened Scenario: Using new-instance-open-target_window = last-opened
When I set new_instance_open_target to tab When I set url.new_instance_open_target to tab
And I set new_instance_open_target_window to last-opened And I set url.new_instance_open_target_window to last-opened
And I open data/title.html And I open data/title.html
And I open data/search.html in a new window And I open data/search.html in a new window
And I open data/hello.txt as a URL And I open data/hello.txt as a URL
@ -55,8 +55,8 @@ Feature: Invoking a new process
- url: http://localhost:*/data/hello.txt - url: http://localhost:*/data/hello.txt
Scenario: Using new-instance-open-target_window = first-opened Scenario: Using new-instance-open-target_window = first-opened
When I set new_instance_open_target to tab When I set url.new_instance_open_target to tab
And I set new_instance_open_target_window to first-opened And I set url.new_instance_open_target_window to first-opened
And I open data/title.html And I open data/title.html
And I open data/search.html in a new window And I open data/search.html in a new window
And I open data/hello.txt as a URL And I open data/hello.txt as a URL
@ -75,8 +75,8 @@ Feature: Invoking a new process
# issue #1060 # issue #1060
Scenario: Using target_window = first-opened after tab-detach Scenario: Using target_window = first-opened after tab-detach
When I set new_instance_open_target to tab When I set url.new_instance_open_target to tab
And I set new_instance_open_target_window to first-opened And I set url.new_instance_open_target_window to first-opened
And I open data/title.html And I open data/title.html
And I open data/search.html in a new tab And I open data/search.html in a new tab
And I run :tab-detach And I run :tab-detach
@ -95,8 +95,8 @@ Feature: Invoking a new process
- url: http://localhost:*/data/search.html - url: http://localhost:*/data/search.html
Scenario: Opening a new qutebrowser instance with no parameters Scenario: Opening a new qutebrowser instance with no parameters
When I set new_instance_open_target to tab When I set url.new_instance_open_target to tab
And I set start_pages to ["http://localhost:(port)/data/hello.txt"] And I set url.start_pages to ["http://localhost:(port)/data/hello.txt"]
And I open data/title.html And I open data/title.html
And I spawn a new window And I spawn a new window
And I wait until data/hello.txt is loaded And I wait until data/hello.txt is loaded

View File

@ -327,12 +327,12 @@ Feature: Various utility commands.
# :home # :home
Scenario: :home with single page Scenario: :home with single page
When I set start_pages to ["http://localhost:(port)/data/hello2.txt"] When I set url.start_pages to ["http://localhost:(port)/data/hello2.txt"]
And I run :home And I run :home
Then data/hello2.txt should be loaded Then data/hello2.txt should be loaded
Scenario: :home with multiple pages Scenario: :home with multiple pages
When I set start_pages to ["http://localhost:(port)/data/numbers/1.txt", "http://localhost:(port)/data/numbers/2.txt"] When I set url.start_pages to ["http://localhost:(port)/data/numbers/1.txt", "http://localhost:(port)/data/numbers/2.txt"]
And I run :home And I run :home
Then data/numbers/1.txt should be loaded Then data/numbers/1.txt should be loaded

View File

@ -97,8 +97,8 @@ Feature: Using :navigate
And I run :navigate decrement with count 5 And I run :navigate decrement with count 5
Then data/numbers/3.txt should be loaded Then data/numbers/3.txt should be loaded
Scenario: Setting url-incdec-segments Scenario: Setting url.incdec_segments
When I set url_incdec_segments to [anchor] When I set url.incdec_segments to [anchor]
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I run :navigate increment And I run :navigate increment
Then the error "No number found in URL!" should be shown Then the error "No number found in URL!" should be shown

View File

@ -17,17 +17,17 @@ Feature: Opening pages
url: http://localhost:*/data/numbers/1.txt url: http://localhost:*/data/numbers/1.txt
Scenario: :open without URL Scenario: :open without URL
When I set default_page to http://localhost:(port)/data/numbers/11.txt When I set url.default_page to http://localhost:(port)/data/numbers/11.txt
And I run :open And I run :open
Then data/numbers/11.txt should be loaded Then data/numbers/11.txt should be loaded
Scenario: :open without URL and -t Scenario: :open without URL and -t
When I set default_page to http://localhost:(port)/data/numbers/2.txt When I set url.default_page to http://localhost:(port)/data/numbers/2.txt
And I run :open -t And I run :open -t
Then data/numbers/2.txt should be loaded Then data/numbers/2.txt should be loaded
Scenario: :open with invalid URL Scenario: :open with invalid URL
When I set auto_search to never When I set url.auto_search to never
And I run :open foo! And I run :open foo!
Then the error "Invalid URL" should be shown Then the error "Invalid URL" should be shown
@ -37,7 +37,7 @@ Feature: Opening pages
# FIXME:conf # FIXME:conf
# Scenario: Searching with :open # Scenario: Searching with :open
# When I set auto_search to naive # When I set url.auto_search to naive
# And I set searchengines.DEFAULT to http://localhost:(port)/data/numbers/{}.txt # And I set searchengines.DEFAULT to http://localhost:(port)/data/numbers/{}.txt
# And I run :open 3 # And I run :open 3
# Then data/numbers/3.txt should be loaded # Then data/numbers/3.txt should be loaded

View File

@ -715,7 +715,7 @@ Feature: Tab management
When I open data/hello.txt When I open data/hello.txt
And I run :tab-only And I run :tab-only
And I set tabs.last_close to startpage And I set tabs.last_close to startpage
And I set start_pages to ["http://localhost:(port)/data/numbers/4.txt"] And I set url.start_pages to ["http://localhost:(port)/data/numbers/4.txt"]
And I run :tab-close And I run :tab-close
And I wait until data/numbers/4.txt is loaded And I wait until data/numbers/4.txt is loaded
And I run :undo And I run :undo
@ -727,7 +727,7 @@ Feature: Tab management
When I open data/hello.txt When I open data/hello.txt
And I run :tab-only And I run :tab-only
And I set tabs.last_close to default-page And I set tabs.last_close to default-page
And I set default_page to http://localhost:(port)/data/numbers/6.txt And I set url.default_page to http://localhost:(port)/data/numbers/6.txt
And I run :tab-close And I run :tab-close
And I wait until data/numbers/6.txt is loaded And I wait until data/numbers/6.txt is loaded
And I run :undo And I run :undo
@ -739,7 +739,7 @@ Feature: Tab management
Given I have a fresh instance Given I have a fresh instance
When I open about:blank When I open about:blank
And I set tabs.last_close to default-page And I set tabs.last_close to default-page
And I set default_page to about:blank And I set url.default_page to about:blank
And I run :undo And I run :undo
And I run :undo And I run :undo
Then the error "Nothing to undo!" should be shown Then the error "Nothing to undo!" should be shown
@ -807,7 +807,7 @@ Feature: Tab management
- about:blank (active) - about:blank (active)
Scenario: last-close = startpage Scenario: last-close = startpage
When I set start_pages to ["http://localhost:(port)/data/numbers/7.txt", "http://localhost:(port)/data/numbers/8.txt"] When I set url.start_pages to ["http://localhost:(port)/data/numbers/7.txt", "http://localhost:(port)/data/numbers/8.txt"]
And I set tabs.last_close to startpage And I set tabs.last_close to startpage
And I open data/hello.txt And I open data/hello.txt
And I run :tab-only And I run :tab-only
@ -819,7 +819,7 @@ Feature: Tab management
- data/numbers/8.txt (active) - data/numbers/8.txt (active)
Scenario: last-close = default-page Scenario: last-close = default-page
When I set default_page to http://localhost:(port)/data/numbers/9.txt When I set url.default_page to http://localhost:(port)/data/numbers/9.txt
And I set tabs.last_close to default-page And I set tabs.last_close to default-page
And I open data/hello.txt And I open data/hello.txt
And I run :tab-only And I run :tab-only

View File

@ -20,7 +20,7 @@ Feature: quickmarks and bookmarks
Then the error "Title must be provided if url has been provided" should be shown Then the error "Title must be provided if url has been provided" should be shown
Scenario: Saving a bookmark with an invalid url Scenario: Saving a bookmark with an invalid url
When I set auto_search to never When I set url.auto_search to never
And I run :bookmark-add foo! "some example title" And I run :bookmark-add foo! "some example title"
Then the error "Invalid URL" should be shown Then the error "Invalid URL" should be shown

View File

@ -145,7 +145,7 @@ Feature: Yanking and pasting.
url: http://localhost:*/data/hello.txt url: http://localhost:*/data/hello.txt
Scenario: Pasting an invalid URL Scenario: Pasting an invalid URL
When I set auto_search to never When I set url.auto_search to never
And I put "foo bar" into the clipboard And I put "foo bar" into the clipboard
And I run :open {clipboard} And I run :open {clipboard}
Then the error "Invalid URL" should be shown Then the error "Invalid URL" should be shown
@ -169,7 +169,7 @@ Feature: Yanking and pasting.
# FIXME:conf # FIXME:conf
# Scenario: Pasting multiline text # Scenario: Pasting multiline text
# When I set auto_search to naive # When I set url.auto_search to naive
# And I set searchengines.DEFAULT to http://localhost:(port)/data/hello.txt?q={} # And I set searchengines.DEFAULT to http://localhost:(port)/data/hello.txt?q={}
# And I put the following lines into the clipboard: # And I put the following lines into the clipboard:
# this url: # this url:
@ -183,7 +183,7 @@ Feature: Yanking and pasting.
# FIXME:conf # FIXME:conf
# Scenario: Pasting multiline whose first line looks like a URI # Scenario: Pasting multiline whose first line looks like a URI
# When I set auto_search to naive # When I set url.auto_search to naive
# And I set searchengines.DEFAULT to http://localhost:(port)/data/hello.txt?q={} # And I set searchengines.DEFAULT to http://localhost:(port)/data/hello.txt?q={}
# And I put the following lines into the clipboard: # And I put the following lines into the clipboard:
# text: # text:

View File

@ -453,7 +453,7 @@ class QuteProc(testprocess.Process):
settings = [ settings = [
('messages.timeout', '0'), ('messages.timeout', '0'),
('auto_save.interval', '0'), ('auto_save.interval', '0'),
('new_instance_open_target_window', 'last-opened') ('url.new_instance_open_target_window', 'last-opened')
] ]
if not self.request.config.webengine: if not self.request.config.webengine:
settings.append(('content.ssl_strict', 'false')) settings.append(('content.ssl_strict', 'false'))