diff options
author | Marc Jauvin <marc.jauvin@gmail.com> | 2018-01-26 22:06:05 -0500 |
---|---|---|
committer | Marc Jauvin <marc.jauvin@gmail.com> | 2018-01-26 22:06:05 -0500 |
commit | fe4dd579f9cfa0283f91c1ca1343b43747cb3ad0 (patch) | |
tree | c9f0073dca2ea9f6e7e3802feb67a42530ec13ee /qutebrowser/mainwindow/prompt.py | |
parent | ddcc960aa5c166e7999e5d7875f3670cbc803e18 (diff) | |
download | qutebrowser-fe4dd579f9cfa0283f91c1ca1343b43747cb3ad0.tar.gz qutebrowser-fe4dd579f9cfa0283f91c1ca1343b43747cb3ad0.zip |
add --sel option to prompt-yank
Diffstat (limited to 'qutebrowser/mainwindow/prompt.py')
-rw-r--r-- | qutebrowser/mainwindow/prompt.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index 29afc62a4..aff6701fc 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -425,15 +425,23 @@ class PromptContainer(QWidget): @cmdutils.register( instance='prompt-container', scope='window', modes=[usertypes.KeyMode.prompt, usertypes.KeyMode.yesno]) - def prompt_yank(self): - """Yank URL.""" + def prompt_yank(self, sel=False): + """Yank URL to clipboard or primary selection. + + Args: + sel: Use the primary selection instead of the clipboard. + """ question = self._prompt.question if not question.url: message.error('No URL found.') return s = question.url - utils.set_clipboard(s) - message.info("Yanked to clipboard: {}".format(s)) + target = 'primary selection' + if not (sel and utils.supports_selection()): + target = 'clipboard' + sel = False + utils.set_clipboard(s, sel) + message.info("Yanked to {}: {}".format(target, s)) class LineEdit(QLineEdit): |