qutebrowser: add support for per domain settings (#7078)
Add `programs.qutebrowser.perDomainSettings` which let's one to set
configuration options for specific URLs [1].
It option doesn't check if the options passed to it are valid, it
translates the config to python code to be written on the file as is.
Mimicking the behaviour of `programs.qutebrowser.settings`.
Added a new test case `test-qutebrowser-url-settings` for testing the
implementation.
[1]: bb7bbb6ead/doc/help/configuring.asciidoc (per-domain-settings)
This commit is contained in:
parent
3f591550a9
commit
29dda415f5
4 changed files with 111 additions and 25 deletions
|
|
@ -3,4 +3,5 @@
|
|||
qutebrowser-keybindings = ./keybindings.nix;
|
||||
qutebrowser-quickmarks = ./quickmarks.nix;
|
||||
qutebrowser-settings = ./settings.nix;
|
||||
qutebrowser-url-settings = ./url-settings.nix;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@
|
|||
home-files/${qutebrowserConfig} \
|
||||
${builtins.toFile "qutebrowser-expected-config.py" ''
|
||||
config.load_autoconfig(False)
|
||||
c.colors.hints.bg = "#000000"
|
||||
c.colors.hints.fg = "#ffffff"
|
||||
c.colors.tabs.bar.bg = "#000000"
|
||||
c.spellcheck.languages = ["en-US", "sv-SE"]
|
||||
c.tabs.tabs_are_windows = True
|
||||
config.set("colors.hints.bg", "#000000")
|
||||
config.set("colors.hints.fg", "#ffffff")
|
||||
config.set("colors.tabs.bar.bg", "#000000")
|
||||
config.set("spellcheck.languages", ["en-US", "sv-SE"])
|
||||
config.set("tabs.tabs_are_windows", True)
|
||||
# Extra qutebrowser configuration.
|
||||
''}
|
||||
'';
|
||||
|
|
|
|||
58
tests/modules/programs/qutebrowser/url-settings.nix
Normal file
58
tests/modules/programs/qutebrowser/url-settings.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.qutebrowser = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
colors = {
|
||||
hints = {
|
||||
bg = "#000000";
|
||||
fg = "#ffffff";
|
||||
};
|
||||
tabs.bar.bg = "#000000";
|
||||
webpage.darkmode.enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
perDomainSettings = {
|
||||
"zoom.us" = {
|
||||
content = {
|
||||
autoplay = true;
|
||||
media.audio_capture = true;
|
||||
media.video_capture = true;
|
||||
};
|
||||
};
|
||||
"web.whatsapp.com".colors.webpage.darkmode.enabled = false;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
# Extra qutebrowser configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script =
|
||||
let
|
||||
qutebrowserConfig =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||
".qutebrowser/config.py"
|
||||
else
|
||||
".config/qutebrowser/config.py";
|
||||
in
|
||||
''
|
||||
assertFileContent \
|
||||
home-files/${qutebrowserConfig} \
|
||||
${builtins.toFile "qutebrowser-expected-config.py" ''
|
||||
config.load_autoconfig(False)
|
||||
config.set("colors.hints.bg", "#000000")
|
||||
config.set("colors.hints.fg", "#ffffff")
|
||||
config.set("colors.tabs.bar.bg", "#000000")
|
||||
config.set("colors.webpage.darkmode.enabled", True)
|
||||
# Extra qutebrowser configuration.
|
||||
|
||||
config.set("colors.webpage.darkmode.enabled", False, "web.whatsapp.com")
|
||||
config.set("content.autoplay", True, "zoom.us")
|
||||
config.set("content.media.audio_capture", True, "zoom.us")
|
||||
config.set("content.media.video_capture", True, "zoom.us")''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue