diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-05-22 22:24:34 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-05-22 22:24:34 +0200 |
commit | c7e20386b5b0a6c85768ea08d8ebc750c0f122ad (patch) | |
tree | 95f161078e7e38a1af2e0808fc941e8f53b7dcc5 | |
parent | 7a7d74dba1c6dfe1f377958e2df8ce0a2b6fed81 (diff) | |
parent | 2cb1ba1e7c4b5d6b074a5161a46ec2252cf364a4 (diff) | |
download | qutebrowser-c7e20386b5b0a6c85768ea08d8ebc750c0f122ad.tar.gz qutebrowser-c7e20386b5b0a6c85768ea08d8ebc750c0f122ad.zip |
Merge remote-tracking branch 'origin/pr/5456'
-rw-r--r-- | qutebrowser/browser/commands.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 0f42a09d8..9f328c768 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -453,7 +453,7 @@ class CommandDispatcher: @cmdutils.argument('win_id', completion=miscmodels.window) @cmdutils.argument('count', value=cmdutils.Value.count) def tab_give(self, win_id: int = None, keep: bool = False, - count: int = None) -> None: + count: int = None, private: bool = False) -> None: """Give the current tab to a new or existing window if win_id given. If no win_id is given, the tab will get detached into a new window. @@ -462,6 +462,7 @@ class CommandDispatcher: win_id: The window ID of the window to give the current tab to. keep: If given, keep the old tab around. count: Overrides win_id (index starts at 1 for win_id=0). + private: If the tab should be detached into a private instance. """ if config.val.tabs.tabs_are_windows: raise cmdutils.CommandError("Can't give tabs when using " @@ -479,7 +480,7 @@ class CommandDispatcher: "only one tab") tabbed_browser = self._new_tabbed_browser( - private=self._tabbed_browser.is_private) + private=private or self._tabbed_browser.is_private) else: if win_id not in objreg.window_registry: raise cmdutils.CommandError( @@ -488,6 +489,9 @@ class CommandDispatcher: tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) + if private and not tabbed_browser.is_private: + raise cmdutils.CommandError("The window with id {} is not private".format(win_id)) + tabbed_browser.tabopen(self._current_url()) if not keep: self._tabbed_browser.close_tab(self._current_widget(), |