From a38c3ae1e1e8853dcbf80070ac50a62d3e029fec Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 30 Mar 2015 12:14:15 +0200 Subject: [PATCH] Add a :tab-detach command. See #62. --- doc/help/commands.asciidoc | 5 +++++ qutebrowser/browser/commands.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 11cd85198..2f61491e6 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -45,6 +45,7 @@ |<>|Stop loading in the current/[count]th tab. |<>|Duplicate the current tab. |<>|Close the current/[count]th tab. +|<>|Detach the current tab to its own window. |<>|Select the tab given as argument/[count]. |<>|Move the current tab. |<>|Switch to the next tab, or switch [count] tabs forward. @@ -508,6 +509,10 @@ Close the current/[count]th tab. ==== count The tab index to close +[[tab-detach]] +=== tab-detach +Detach the current tab to its own window. + [[tab-focus]] === tab-focus Syntax: +:tab-focus ['index']+ diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index e7edf3905..c3de9e661 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -109,7 +109,7 @@ class CommandDispatcher: raise cmdexc.CommandError("No WebView available yet!") return widget - def _open(self, url, tab, background, window): + def _open(self, url, tab=False, background=False, window=False): """Helper function to open a page. Args: @@ -404,6 +404,15 @@ class CommandDispatcher: qtutils.deserialize(history, newtab.history()) return newtab + @cmdutils.register(instance='command-dispatcher', scope='window') + def tab_detach(self): + """Detach the current tab to its own window.""" + url = self._current_url() + self._open(url, window=True) + tabbed_browser = self._tabbed_browser() + cur_widget = self._current_widget() + tabbed_browser.close_tab(cur_widget) + def _back_forward(self, tab, bg, window, count, forward): """Helper function for :back/:forward.""" if (not forward and not