qutebrowser: Begin migrating config to nix

This commit is contained in:
Donovan Glover 2023-05-26 11:01:47 -04:00
parent c517b25312
commit 0fbd0e12e9
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -6,18 +6,62 @@
enable = true;
package = pkgs.qutebrowser-qt6;
settings = {
confirm_quit = [
"multiple-tabs"
"downloads"
];
session.lazy_restore = true;
tabs = {
show = "multiple";
mousewheel_switching = false;
last_close = "close";
new_position.unrelated = "next";
};
content = {
persistent_storage = true;
notifications.enabled = true;
register_protocol_handler = true;
mute = true;
headers.accept_language = "ja-JP,en-US";
};
editor.command = [ "kitty" "-e" "nvim" "{}" ];
};
keyBindings = {
normal = {
d = "scroll-page 0 0.5";
u = "scroll-page 0 -0.5";
D = "scroll-page 0 0.5";
U = "scroll-page 0 -0.5";
"<Alt+Left>" = "back";
"<Alt+Right>" = "forward";
"<Ctrl+Shift+Tab>" = "tab-prev";
"<Ctrl+Tab>" = "tab-next";
J = "tab-prev";
K = "tab-next";
"<F12>" = "devtools";
zb = "bookmark-del";
x = "tab-close";
X = "undo";
st = "config-cycle tabs.show multiple switching";
sTh = "set tabs.position left";
sTj = "set tabs.position bottom";
sTk = "set tabs.position top";
sTl = "set tabs.position right";
};
};
extraConfig = ''
# Mute tabs by default
from qutebrowser.mainwindow import tabwidget
tabwidget.TabWidget.MUTE_STRING = ""
tabwidget.TabWidget.AUDIBLE_STRING = "[A]"
# Don't close while browsing / downloading
c.confirm_quit = ['multiple-tabs', 'downloads']
# Restore previous tabs
c.session.lazy_restore = True
# Use ranger as the file selector
c.fileselect.handler = 'external'
c.fileselect.folder.command = ['kitty', '-e', 'ranger', '--choosedir={}']
@ -34,34 +78,12 @@
c.qt.args = ["disable-backing-store-limit", "enable-accelerated-video-decode", "disable-gpu-driver-bug-workarounds"]
c.qt.chromium.low_end_device_mode = 'never'
# Make new tab position more sane
c.tabs.new_position.unrelated = 'next'
# Download settings
c.downloads.location.directory = "$HOME/Downloads"
c.downloads.location.prompt = False
c.downloads.position = "bottom"
c.downloads.remove_finished = 5000
# Only show tabs when multiple are open
c.tabs.show = "multiple"
# Don't switch tabs with mouse
c.tabs.mousewheel_switching = False
# Edit text with neovim
c.editor.command = ['kitty', '-e', 'nvim', '{}']
# Use J/K for prev/next
config.bind('J', 'tab-prev')
config.bind('K', 'tab-next')
# Use F12 for devtools
config.bind('<F12>', 'devtools')
# Use zb to delete bookmarks
config.bind('zb', 'bookmark-del')
# Increase the default scroll offset of j/k
# NOTE: Unfortunately this breaks websites that use their own keybinds for j/k/etc
# config.bind('j', 'run-with-count 5 scroll down')
@ -71,29 +93,6 @@
# config.bind('d', 'run-with-count 12 scroll down')
# config.bind('u', 'run-with-count 12 scroll up')
# Use d/u to scroll down/up
config.bind('d', 'scroll-page 0 0.5')
config.bind('u', 'scroll-page 0 -0.5')
config.bind('D', 'scroll-page 0 0.5')
config.bind('U', 'scroll-page 0 -0.5')
# Use alt+left/right to go back/forward
config.bind('<Alt+Left>', 'back')
config.bind('<Alt+Right>', 'forward')
# Use x to close tabs and X to undo
config.bind('x', 'tab-close')
config.bind('X', 'undo')
# Toggle tab visibility for more screen space
config.bind('st', 'config-cycle tabs.show multiple switching')
# Easily change the position of tabs
config.bind('sTh', 'set tabs.position left')
config.bind('sTj', 'set tabs.position bottom')
config.bind('sTk', 'set tabs.position top')
config.bind('sTl', 'set tabs.position right')
# Don't paste something by accident
config.unbind('pp', mode='normal')
config.unbind('pP', mode='normal')
@ -108,10 +107,6 @@
config.bind('zpl', 'spawn --userscript qute-pass --password-only')
config.bind('zol', 'spawn --userscript qute-pass --otp-only')
# Support previous/next tab with traditional keybinds
config.bind('<Ctrl+Shift+Tab>', 'tab-prev')
config.bind('<Ctrl+Tab>', 'tab-next')
# Hide the status bar except under exceptional circumstances
# NOTE: This broke more things than not, which is why I ultimately decided
# to always use the status bar. More information can be found in the
@ -122,35 +117,12 @@
# config.bind(':', 'set statusbar.show always;; set-cmd-text :')
# config.bind('/', 'set statusbar.show always;; set-cmd-text /')
# config.bind('<Escape>', 'mode-enter normal;; set statusbar.show in-mode', mode='command')
# config.bind('<Return>', 'command-accept;; set statusbar.show in-mode', mode='command')
# Easily start a new temporary container
config.bind(';s', 'hint links spawn ~/.local/bin/tmp {hint-url}')
# Open the current tab / selected link in mpv
config.bind('zM', 'spawn mpv --force-window=immediate {url}')
config.bind('zm', 'hint links spawn mpv --force-window=immediate {hint-url}')
# Automatically mute tabs
c.content.mute = True
# Use proxy websites for popular services
config.bind('zu', 'hint links spawn -u untrack-url -O {hint-url}')
# Enable expected permissions to avoid websites asking every time
c.content.persistent_storage = True
c.content.notifications.enabled = True
c.content.register_protocol_handler = True
# Hide the window title bar on GNOME
# NOTE: This is no longer necessary since GNOME has an extension called
# pixel-saver that # automatically handles this for us, and without
# the downsides of not having a window bar.
# c.window.hide_decoration = True
# Close qutebrowser when there are no tabs left
c.tabs.last_close = "close"
# Don't automatically enter/leave insert mode
# NOTE: This was originally done to prevent insert mode from prematurely exiting
# in certain # cases (such as mouse usage), although keeping auto functionality
@ -158,9 +130,6 @@
c.input.insert_mode.auto_enter = False
c.input.insert_mode.auto_leave = False
# Prioritize Japanese content (en-US is necessary to avoid breaking things)
c.content.headers.accept_language = 'ja-JP,en-US'
c.url.start_pages = ['https://search.goo.ne.jp']
c.url.searchengines = {
'DEFAULT': 'https://search.goo.ne.jp/web.jsp?MT={}'