Fix & redesign qutebrowser config

This commit is contained in:
Henrik Lissner 2021-02-02 00:24:47 -05:00
parent b7d49362a8
commit 526dc19eeb
6 changed files with 260 additions and 116 deletions

View file

@ -9,102 +9,17 @@ c.content.user_stylesheets = glob.glob(os.path.expanduser('~/.local/share/qutebr
# c.confirm_quit = ['never']
c.editor.command = ['emacsclient', '-c', '-a', ' ', '+{line}:{column}', '{}']
## Colors
# c.colors.completion.category.fg = 'white'
c.colors.completion.category.bg = '#343537'
# c.colors.completion.category.border.bottom = 'black'
c.colors.completion.category.border.top = '#343537'
# c.colors.completion.fg = 'white'
c.colors.completion.even.bg = '#141517'
c.colors.completion.odd.bg = c.colors.completion.even.bg
c.colors.completion.item.selected.fg = 'white'
c.colors.completion.item.selected.bg = '#545557'
# c.colors.completion.item.selected.border.bottom = '#bbbb00'
c.colors.completion.item.selected.border.top = '#545557'
c.colors.completion.match.fg = '#b5bd68'
c.colors.completion.scrollbar.fg = '#c678dd'
c.colors.completion.scrollbar.bg = c.colors.completion.category.bg
# c.colors.downloads.bar.bg = 'black'
# c.colors.downloads.error.bg = 'red'
# c.colors.downloads.error.fg = 'white'
# c.colors.downloads.start.bg = '#0000aa'
# c.colors.downloads.start.fg = 'white'
# c.colors.downloads.stop.bg = '#00aa00'
# c.colors.downloads.stop.fg = 'white'
# c.colors.downloads.system.bg = 'rgb'
# c.colors.downloads.system.fg = 'rgb'
c.colors.hints.bg = '#18191b'
c.colors.hints.fg = '#ffffff'
c.colors.hints.match.fg = '#b5bd68'
# c.colors.keyhint.fg = '#FFFFFF'
# c.colors.keyhint.bg = 'rgba(0, 0, 0, 80%)'
# c.colors.keyhint.suffix.fg = '#FFFF00'
# c.colors.messages.error.fg = 'white'
# c.colors.messages.error.bg = 'red'
# c.colors.messages.error.border = '#bb0000'
# c.colors.messages.info.fg = 'white'
# c.colors.messages.info.bg = 'black'
# c.colors.messages.info.border = '#333333'
# c.colors.messages.warning.fg = 'white'
# c.colors.messages.warning.bg = 'darkorange'
# c.colors.messages.warning.border = '#d47300'
# c.colors.prompts.bg = '#444444'
# c.colors.prompts.fg = 'white'
# c.colors.prompts.selected.bg = 'grey'
# c.colors.prompts.border = '1px solid gray'
# c.colors.statusbar.caret.bg = 'purple'
# c.colors.statusbar.caret.fg = 'white'
# c.colors.statusbar.caret.selection.bg = '#a12dff'
# c.colors.statusbar.caret.selection.fg = 'white'
c.colors.statusbar.command.bg = '#1a1b1d'
# c.colors.statusbar.command.fg = 'white'
# c.colors.statusbar.command.private.bg = 'grey'
# c.colors.statusbar.command.private.fg = 'white'
c.colors.statusbar.normal.bg = '#1a1b1d'
# c.colors.statusbar.normal.fg = 'white'
c.colors.statusbar.insert.bg = 'darkgreen'
# c.colors.statusbar.insert.fg = 'white'
c.colors.statusbar.private.bg = '#2a8fed'
# c.colors.statusbar.private.fg = 'white'
# c.colors.statusbar.progress.bg = 'white'
# c.colors.statusbar.url.fg = 'white'
c.colors.statusbar.url.success.http.fg = '#b5bd68'
c.colors.statusbar.url.success.https.fg = '#bc77a8'
c.colors.statusbar.url.error.fg = '#cc6666'
c.colors.statusbar.url.warn.fg = '#f0c674'
c.colors.statusbar.url.hover.fg = '#8abeb7'
c.colors.tabs.even.bg = c.colors.statusbar.command.bg
c.colors.tabs.even.fg = 'white'
c.colors.tabs.odd.bg = c.colors.statusbar.command.bg
c.colors.tabs.odd.fg = 'white'
c.colors.tabs.selected.even.bg = '#38393b'
c.colors.tabs.selected.even.fg = c.colors.statusbar.command.fg
c.colors.tabs.selected.odd.bg = c.colors.tabs.selected.even.bg
c.colors.tabs.selected.odd.fg = c.colors.tabs.selected.even.fg
c.colors.tabs.indicator.error = '#da8548'
c.colors.tabs.indicator.start = '#c678dd'
c.colors.tabs.indicator.stop = '#51afef'
# c.colors.tabs.indicator.system = 'rgb'
# c.colors.webpage.bg = 'white'
c.completion.height = '30%'
c.completion.web_history.max_items = 1500
# c.completion.cmd_history_max_items = 100
# c.completion.quick = True
c.completion.scrollbar.padding = 0
c.completion.scrollbar.width = 6
# c.completion.show = 'always'
# c.completion.shrink = False
# c.completion.timestamp_format = '%Y-%m-%d'
# c.completion.web_history.max_items = -1
# c.completion.height = '30%'
# c.completion.web_history.max_items = 1500
# # c.completion.cmd_history_max_items = 100
# # c.completion.quick = True
# c.completion.scrollbar.padding = 0
# c.completion.scrollbar.width = 6
# # c.completion.show = 'always'
# # c.completion.shrink = False
# # c.completion.timestamp_format = '%Y-%m-%d'
# # c.completion.web_history.max_items = -1
# c.content.notifications = False # unavailable on QtWebEngine
c.content.mute = True # mute tabs by default
@ -125,7 +40,7 @@ c.content.host_blocking.lists = [
c.content.host_blocking.whitelist = []
c.downloads.position = 'bottom'
c.downloads.location.directory = os.path.expanduser("~/share/dl")
c.downloads.location.directory = os.path.expanduser("~/dl")
c.downloads.location.prompt = False
# c.downloads.location.remember = True
# c.downloads.location.suggestion = 'path'
@ -142,10 +57,10 @@ c.fonts.keyhint = '8pt monospace'
c.fonts.messages.error = '8pt monospace'
c.fonts.messages.info = '8pt monospace'
c.fonts.messages.warning = '8pt monospace'
c.fonts.monospace = '"xos4 Terminus", Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal'
# c.fonts.monospace = '"xos4 Terminus", Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal'
c.fonts.prompts = '8pt sans-serif'
c.fonts.statusbar = '8pt monospace'
c.fonts.tabs = '8pt monospace'
# c.fonts.tabs = '8pt monospace'
# c.fonts.web.family.cursive = ''
# c.fonts.web.family.fantasy = ''
# c.fonts.web.family.fixed = ''
@ -159,7 +74,7 @@ c.fonts.tabs = '8pt monospace'
# c.hints.auto_follow = 'unique-match'
# c.hints.auto_follow_timeout = 0
c.hints.border = '6px solid #18191b'
# c.hints.border = '6px solid #18191b'
# c.hints.chars = 'asdfghjkl'
# c.hints.dictionary = '/usr/share/dict/words'
# c.hints.find_implementation = 'python'
@ -200,14 +115,14 @@ c.scrolling.smooth = False
c.spellcheck.languages = ['en-US']
c.session.lazy_restore = False
c.statusbar.padding = {'top': 4, 'bottom': 4, 'left': 4, 'right': 4}
# c.statusbar.padding = {'top': 4, 'bottom': 4, 'left': 4, 'right': 4}
# c.statusbar.hide = False
# c.statusbar.position = 'bottom'
c.tabs.background = True
c.tabs.padding = {'top': 4, 'bottom': 4, 'left': 0, 'right': 3}
c.tabs.indicator.padding = {'top': 0, 'bottom': 0, 'left': 0, 'right': 5}
c.tabs.mousewheel_switching = False
# c.tabs.background = True
# c.tabs.padding = {'top': 4, 'bottom': 4, 'left': 0, 'right': 3}
# c.tabs.indicator.padding = {'top': 0, 'bottom': 0, 'left': 0, 'right': 5}
# c.tabs.mousewheel_switching = False
# c.tabs.close_mouse_button = 'middle'
# c.tabs.favicons.scale = 1.0
# c.tabs.favicons.show = True
@ -512,3 +427,16 @@ config.bind('<Ctrl-F>', 'rl-forward-word', mode='prompt')
## Bindings for register mode
# config.bind('<Escape>', 'leave-mode', mode='register')
## Load theme
# NixOS symlinks screw up python module scope for this file, so we must load
# extra config files manually -- if they exists.
for path in glob.glob(os.path.expanduser('~/.config/qutebrowser/extra/*.py')):
try:
f = open(path)
exec(compile(f.read(), path, 'exec'))
theme_init(c)
f.close()
except IOError:
pass

View file

@ -18,6 +18,7 @@
default = "brave";
brave.enable = true;
firefox.enable = true;
qutebrowser.enable = true;
};
gaming = {
steam.enable = true;

View file

@ -7,9 +7,9 @@ with lib;
let fileName = baseNameOf file;
compiledStyles =
pkgs.runCommand "compileScssFile"
{ buildInputs = [ sass ]; } ''
{ buildInputs = [ pkgs.sass ]; } ''
mkdir "$out"
scss --sourcekkmap=none \
scss --sourcemap=none \
--no-cache \
--style compressed \
--default-encoding utf-8 \

View file

@ -12,6 +12,7 @@ in {
options.modules.desktop.browsers.qutebrowser = with types; {
enable = mkBoolOpt false;
userStyles = mkOpt lines "";
extraConfig = mkOpt lines "";
};
config = mkIf cfg.enable {
@ -22,15 +23,18 @@ in {
desktopName = "Qutebrowser (Private)";
genericName = "Open a private Qutebrowser window";
icon = "qutebrowser";
exec = "${qutebrowser}/bin/qutebrowser ':open -p'";
exec = ''${qutebrowser}/bin/qutebrowser ":open -p"'';
categories = "Network";
})
];
home = {
configFile."qutebrowser" = {
source = "${configDir}/qutebrowser";
recursive = true;
configFile = {
"qutebrowser" = {
source = "${configDir}/qutebrowser";
recursive = true;
};
"qutebrowser/extra/00-extraConfig.py".text = cfg.extraConfig;
};
dataFile."qutebrowser/userstyles.css".text = cfg.userStyles;
};

View file

@ -0,0 +1,208 @@
def theme_init(c, cfg = {}):
## Colors
palette = {
'background': '#282a36',
'background-alt': '#282a36',
'background-attention': '#181920',
'border': '#282a36',
'current-line': '#44475a',
'selection': '#44475a',
'foreground': '#f8f8f2',
'foreground-alt': '#e0e0e0',
'foreground-attention': '#ffffff',
'comment': '#6272a4',
'cyan': '#8be9fd',
'green': '#50fa7b',
'orange': '#ffb86c',
'pink': '#ff79c6',
'purple': '#bd93f9',
'red': '#ff5555',
'yellow': '#f1fa8c'
}
spacing = cfg.get('spacing', {
'vertical': 5,
'horizontal': 5
})
padding = cfg.get('padding', {
'top': spacing['vertical'],
'right': spacing['horizontal'],
'bottom': spacing['vertical'],
'left': spacing['horizontal']
})
## Background color of the completion widget category headers.
c.colors.completion.category.bg = palette['background']
## Bottom border color of the completion widget category headers.
c.colors.completion.category.border.bottom = palette['border']
## Top border color of the completion widget category headers.
c.colors.completion.category.border.top = palette['border']
## Foreground color of completion widget category headers.
c.colors.completion.category.fg = palette['foreground']
## Background color of the completion widget for even rows.
c.colors.completion.even.bg = palette['background']
## Background color of the completion widget for odd rows.
c.colors.completion.odd.bg = palette['background-alt']
## Text color of the completion widget.
c.colors.completion.fg = palette['foreground']
## Background color of the selected completion item.
c.colors.completion.item.selected.bg = palette['selection']
## Bottom border color of the selected completion item.
c.colors.completion.item.selected.border.bottom = palette['selection']
## Top border color of the completion widget category headers.
c.colors.completion.item.selected.border.top = palette['selection']
## Foreground color of the selected completion item.
c.colors.completion.item.selected.fg = palette['foreground']
## Foreground color of the matched text in the completion.
c.colors.completion.match.fg = palette['orange']
## Color of the scrollbar in completion view
c.colors.completion.scrollbar.bg = palette['background']
## Color of the scrollbar handle in completion view.
c.colors.completion.scrollbar.fg = palette['foreground']
## Background color for the download bar.
c.colors.downloads.bar.bg = palette['background']
## Background color for downloads with errors.
c.colors.downloads.error.bg = palette['background']
## Foreground color for downloads with errors.
c.colors.downloads.error.fg = palette['red']
## Color gradient stop for download backgrounds.
c.colors.downloads.stop.bg = palette['background']
## Color gradient interpolation system for download backgrounds.
## Type: ColorSystem
## Valid values:
## - rgb: Interpolate in the RGB color system.
## - hsv: Interpolate in the HSV color system.
## - hsl: Interpolate in the HSL color system.
## - none: Don't show a gradient.
c.colors.downloads.system.bg = 'none'
## Background color for hints. Note that you can use a `rgba(...)` value
## for transparency.
c.colors.hints.bg = palette['background']
## Font color for hints.
c.colors.hints.fg = palette['purple']
## Hints
c.hints.border = '1px solid ' + palette['background-alt']
## Font color for the matched part of hints.
c.colors.hints.match.fg = palette['foreground-alt']
## Background color of the keyhint widget.
c.colors.keyhint.bg = palette['background']
## Text color for the keyhint widget.
c.colors.keyhint.fg = palette['purple']
## Highlight color for keys to complete the current keychain.
c.colors.keyhint.suffix.fg = palette['selection']
## Background color of an error message.
c.colors.messages.error.bg = palette['background']
## Border color of an error message.
c.colors.messages.error.border = palette['background-alt']
## Foreground color of an error message.
c.colors.messages.error.fg = palette['red']
## Background color of an info message.
c.colors.messages.info.bg = palette['background']
## Border color of an info message.
c.colors.messages.info.border = palette['background-alt']
## Foreground color an info message.
c.colors.messages.info.fg = palette['comment']
## Background color of a warning message.
c.colors.messages.warning.bg = palette['background']
## Border color of a warning message.
c.colors.messages.warning.border = palette['background-alt']
## Foreground color a warning message.
c.colors.messages.warning.fg = palette['red']
## Background color for prompts.
c.colors.prompts.bg = palette['background']
# ## Border used around UI elements in prompts.
c.colors.prompts.border = '1px solid ' + palette['background-alt']
## Foreground color for prompts.
c.colors.prompts.fg = palette['cyan']
## Background color for the selected item in filename prompts.
c.colors.prompts.selected.bg = palette['selection']
## Background color of the statusbar in caret mode.
c.colors.statusbar.caret.bg = palette['background']
## Foreground color of the statusbar in caret mode.
c.colors.statusbar.caret.fg = palette['orange']
## Background color of the statusbar in caret mode with a selection.
c.colors.statusbar.caret.selection.bg = palette['background']
## Foreground color of the statusbar in caret mode with a selection.
c.colors.statusbar.caret.selection.fg = palette['orange']
## Background color of the statusbar in command mode.
c.colors.statusbar.command.bg = palette['background']
## Foreground color of the statusbar in command mode.
c.colors.statusbar.command.fg = palette['pink']
## Background color of the statusbar in private browsing + command mode.
c.colors.statusbar.command.private.bg = palette['background']
## Foreground color of the statusbar in private browsing + command mode.
c.colors.statusbar.command.private.fg = palette['foreground-alt']
## Background color of the statusbar in insert mode.
c.colors.statusbar.insert.bg = palette['background-attention']
## Foreground color of the statusbar in insert mode.
c.colors.statusbar.insert.fg = palette['foreground-attention']
## Background color of the statusbar.
c.colors.statusbar.normal.bg = palette['background']
## Foreground color of the statusbar.
c.colors.statusbar.normal.fg = palette['foreground']
## Background color of the statusbar in passthrough mode.
c.colors.statusbar.passthrough.bg = palette['background']
## Foreground color of the statusbar in passthrough mode.
c.colors.statusbar.passthrough.fg = palette['orange']
## Background color of the statusbar in private browsing mode.
c.colors.statusbar.private.bg = palette['background-alt']
## Foreground color of the statusbar in private browsing mode.
c.colors.statusbar.private.fg = palette['foreground-alt']
## Background color of the progress bar.
c.colors.statusbar.progress.bg = palette['background']
## Foreground color of the URL in the statusbar on error.
c.colors.statusbar.url.error.fg = palette['red']
## Default foreground color of the URL in the statusbar.
c.colors.statusbar.url.fg = palette['foreground']
## Foreground color of the URL in the statusbar for hovered links.
c.colors.statusbar.url.hover.fg = palette['cyan']
## Foreground color of the URL in the statusbar on successful load
c.colors.statusbar.url.success.http.fg = palette['green']
## Foreground color of the URL in the statusbar on successful load
c.colors.statusbar.url.success.https.fg = palette['green']
## Foreground color of the URL in the statusbar when there's a warning.
c.colors.statusbar.url.warn.fg = palette['yellow']
## Status bar padding
c.statusbar.padding = padding
## Background color of the tab bar.
c.colors.tabs.bar.bg = palette['selection']
## Background color of unselected even tabs.
c.colors.tabs.even.bg = palette['selection']
## Foreground color of unselected even tabs.
c.colors.tabs.even.fg = palette['foreground']
## Color for the tab indicator on errors.
c.colors.tabs.indicator.error = palette['red']
## Color gradient start for the tab indicator.
c.colors.tabs.indicator.start = palette['orange']
## Color gradient end for the tab indicator.
c.colors.tabs.indicator.stop = palette['green']
## Color gradient interpolation system for the tab indicator.
## Type: ColorSystem
## Valid values:
## - rgb: Interpolate in the RGB color system.
## - hsv: Interpolate in the HSV color system.
## - hsl: Interpolate in the HSL color system.
## - none: Don't show a gradient.
c.colors.tabs.indicator.system = 'none'
## Background color of unselected odd tabs.
c.colors.tabs.odd.bg = palette['selection']
## Foreground color of unselected odd tabs.
c.colors.tabs.odd.fg = palette['foreground']
# ## Background color of selected even tabs.
c.colors.tabs.selected.even.bg = palette['background']
# ## Foreground color of selected even tabs.
c.colors.tabs.selected.even.fg = palette['foreground']
# ## Background color of selected odd tabs.
c.colors.tabs.selected.odd.bg = palette['background']
# ## Foreground color of selected odd tabs.
c.colors.tabs.selected.odd.fg = palette['foreground']
## Tab padding
c.tabs.padding = padding
c.tabs.indicator.width = 1
c.tabs.favicons.scale = 1

View file

@ -26,12 +26,12 @@ in {
./config/firefox/userChrome.css
];
qutebrowser.userStyles = concatMapStringsSep "\n" toCSSFile [
./config/qutebrowser/github.scss
./config/qutebrowser/monospace-textareas.scss
./config/qutebrowser/quora.scss
./config/qutebrowser/stackoverflow.scss
./config/qutebrowser/xkcd.scss
./config/qutebrowser/youtube.scss
./config/userstyles/qutebrowser/github.scss
./config/userstyles/qutebrowser/monospace-textareas.scss
./config/userstyles/qutebrowser/quora.scss
./config/userstyles/qutebrowser/stackoverflow.scss
./config/userstyles/qutebrowser/xkcd.scss
./config/userstyles/qutebrowser/youtube.scss
];
};
};
@ -105,6 +105,9 @@ in {
(mkIf desktop.media.graphics.vector.enable {
"inkscape/templates/default.svg".source = ./config/inkscape/default-template.svg;
})
(mkIf desktop.browsers.qutebrowser.enable {
"qutebrowser/extra/theme.py".source = ./config/qutebrowser/theme.py;
})
];
})
]);