1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-23 10:49:39 +01:00
home-manager/tests/modules/programs/qutebrowser/url-settings.nix
octvs 29dda415f5
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)
2025-05-20 12:43:52 -05:00

58 lines
1.5 KiB
Nix

{ 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")''}
'';
}