From 395f9417fea2d7b9048a65872293c912168996d0 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Fri, 19 May 2023 21:28:04 -0400 Subject: [PATCH] qutebrowser: add copy title bind --- src/.config/qutebrowser/config.py | 9 +++++++++ src/.local/share/qutebrowser/userscripts/code_select.py | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/.config/qutebrowser/config.py b/src/.config/qutebrowser/config.py index 8e62ec2..b327c46 100644 --- a/src/.config/qutebrowser/config.py +++ b/src/.config/qutebrowser/config.py @@ -103,6 +103,15 @@ c.hints.selectors["code"] = [ ] config.bind("cc", "hint code userscript code_select.py") +# copy the title +c.hints.selectors["title"] = [ + "h1", + "h2", + "h3", + "h4", +] +config.bind("ct", "hint title userscript code_select.py") + # use libre redirects config.bind(",fl", "hint links userscript fixlink.sh") config.bind(",fL", "hint links userscript fixlink-tab.sh") diff --git a/src/.local/share/qutebrowser/userscripts/code_select.py b/src/.local/share/qutebrowser/userscripts/code_select.py index b095d62..e15a774 100755 --- a/src/.local/share/qutebrowser/userscripts/code_select.py +++ b/src/.local/share/qutebrowser/userscripts/code_select.py @@ -40,7 +40,8 @@ def main(): pyperclip.copy(code_text) send_command_to_qute( "message-info 'copied to clipboard: {info}{suffix}'".format( - info=code_text.splitlines()[0], + # message-info doesn't support escape codes for ' so we replace them + info=code_text.splitlines()[0].replace("'", "\""), suffix="..." if len(code_text.splitlines()) > 1 else "" ) )