diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 712dc3c1b..d35554c37 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -345,6 +345,20 @@ class CommandDispatcher(QObject): def yank(self, sel=False): """Yank the current URL to the clipboard or primary selection. + Args: + sel: True to use primary selection, False to use clipboard + """ + clip = QApplication.clipboard() + url = urlutils.urlstring(self._tabs.currentWidget().url()) + mode = QClipboard.Selection if sel else QClipboard.Clipboard + clip.setText(url, mode) + message.info("URL yanked to {}".format("primary selection" if sel + else "clipboard")) + + @cmdutils.register(instance='mainwindow.tabs.cmd') + def yank_title(self, sel=False): + """Yank the current title to the clipboard or primary selection. + Args: sel: True to use primary selection, False to use clipboard """