.dotfiles/.config/qutebrowser/keybindings.py

57 lines
2.5 KiB
Python
Raw Normal View History

2024-07-02 13:42:26 +00:00
import os
def init(c):
2024-07-02 13:42:26 +00:00
c.unbind('d') # I prefer ctrl+w to close tabs. I hit d by mistake too often.
2024-02-15 18:27:18 +00:00
c.bind(',v', 'spawn io.freetubeapp.FreeTube {url}')
c.bind(',V', 'hint links spawn io.freetubeapp.FreeTube {hint-url}')
2024-03-27 17:52:31 +00:00
# external
2024-07-02 13:42:26 +00:00
browser_chromium = os.getenv('BROWSER_CHROMIUM', 'chromium')
c.bind(',eb', f'spawn {browser_chromium} {{url}}')
c.bind(',eB', f'hint links spawn {browser_chromium} {{hint-url}}')
2024-03-27 17:52:31 +00:00
c.bind(',ef', 'spawn firefox {url}')
c.bind(',eF', 'hint links spawn firefox {hint-url}')
c.bind(',es', 'spawn xdg-open steam://openurl/{url}')
2024-06-13 16:29:58 +00:00
c.bind(',ep', 'spawn kdeconnect-cli -n Fairphone3 --share {url}')
2024-07-02 13:42:26 +00:00
c.bind(',et', 'spawn ts-control message {url}')
c.bind(',eT', 'hint links spawn ts-control message {hint-url}')
c.bind(',g', 'open {url:scheme}://github1s.com{url:path}{url:query}')
2022-06-30 12:24:33 +00:00
c.bind(',rr', 'open {url:scheme}://unddit.com{url:path}{url:query}')
2022-11-15 23:17:08 +00:00
c.bind(',rt', 'open {url:scheme}://teddit.net{url:path}{url:query}')
2021-12-21 11:13:11 +00:00
gpg_key = '723B78C0BF8D8C721D2C4EEF41E544A54E2533B2'
2024-07-02 13:42:26 +00:00
c.bind(',p', f'spawn --userscript qutebrowser-keepassxc --key {gpg_key}', mode='normal')
c.bind(',Pu', f'spawn --userscript qutebrowser-keepassxc --only-username --key {gpg_key}', mode='normal')
c.bind(',Pi', f'spawn --userscript qutebrowser-keepassxc --only-password --key {gpg_key}', mode='normal')
c.bind(',Po', f'spawn --userscript qutebrowser-keepassxc --only-otp --key {gpg_key}', mode='normal')
c.bind(',Pp', f'spawn --userscript qutebrowser-keepassxc --autotype --key {gpg_key}', mode='normal')
2024-03-27 17:52:31 +00:00
# output
c.bind(',oq', 'spawn --userscript qr {url}')
c.bind(',oQ', 'hint links spawn --userscript qr {hint-url}')
c.bind(',oj', 'spawn --userscript format_json dracula')
2022-08-30 21:03:21 +00:00
# cookies
c.bind(',cd', 'jseval document.cookie = "XDEBUG_SESSION=phpstorm; expires=Fri, 01 Jan 9999 00:00:00 GMT; path=/"')
2024-03-27 17:52:31 +00:00
# query
c.bind(',qd', 'jseval let sp = new URLSearchParams(window.location.search); sp.append("filter-source", "1"); sp.append("filter-source", "2"); window.location.search = sp.toString();')
2022-08-30 21:03:21 +00:00
c.bind('<Alt-9>', 'tab-focus 9')
c.bind('<Ctrl-Tab>', 'tab-next')
c.bind('<Ctrl-Shift-Tab>', 'tab-prev')
2022-01-13 18:23:21 +00:00
2024-03-27 17:52:31 +00:00
c.unbind('M')
c.bind('M', 'spawn --userscript qutebrowser-linkwarden', mode='normal')
2022-01-13 18:23:21 +00:00
try:
import unalix
c.unbind('yy')
c.unbind('yY')
c.bind('yy', 'spawn --userscript qutebrowser-clear-url', mode='normal')
c.bind('yY', 'spawn --userscript qutebrowser-clear-url -s', mode='normal')
2022-01-13 18:23:21 +00:00
except:
pass