2020-03-28 22:48:43 -07:00
|
|
|
# modules/browser/qutebrowser.nix --- https://github.com/qutebrowser/qutebrowser
|
|
|
|
#
|
|
|
|
# Qutebrowser is cute because it's not enough of a browser to be handsome.
|
|
|
|
# Still, we can all tell he'll grow up to be one hell of a lady-killer.
|
|
|
|
|
2020-10-01 15:46:04 -07:00
|
|
|
{ options, config, lib, pkgs, ... }:
|
|
|
|
|
2020-03-28 22:48:43 -07:00
|
|
|
with lib;
|
2020-10-01 15:46:04 -07:00
|
|
|
with lib.my;
|
|
|
|
let cfg = config.modules.desktop.browsers.qutebrowser;
|
2021-02-01 23:28:55 -08:00
|
|
|
pkg = pkgs.unstable.qutebrowser;
|
2021-03-01 17:43:12 -08:00
|
|
|
configDir = config.dotfiles.configDir;
|
2020-10-01 15:46:04 -07:00
|
|
|
in {
|
2020-10-17 20:38:38 -07:00
|
|
|
options.modules.desktop.browsers.qutebrowser = with types; {
|
2020-10-01 15:46:04 -07:00
|
|
|
enable = mkBoolOpt false;
|
2020-10-17 20:38:38 -07:00
|
|
|
userStyles = mkOpt lines "";
|
2021-02-01 21:24:47 -08:00
|
|
|
extraConfig = mkOpt lines "";
|
2021-02-01 23:28:55 -08:00
|
|
|
dicts = mkOpt (listOf str) [ "en-US" ];
|
2020-03-28 22:48:43 -07:00
|
|
|
};
|
|
|
|
|
2020-10-01 15:46:04 -07:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
user.packages = with pkgs; [
|
2021-02-01 23:28:55 -08:00
|
|
|
pkg
|
2020-03-28 22:48:43 -07:00
|
|
|
(makeDesktopItem {
|
|
|
|
name = "qutebrowser-private";
|
|
|
|
desktopName = "Qutebrowser (Private)";
|
|
|
|
genericName = "Open a private Qutebrowser window";
|
|
|
|
icon = "qutebrowser";
|
2021-02-09 19:07:07 -08:00
|
|
|
exec = ''${pkg}/bin/qutebrowser -T -s content.private_browsing true'';
|
2020-03-28 22:48:43 -07:00
|
|
|
categories = "Network";
|
|
|
|
})
|
2021-02-09 19:01:55 -08:00
|
|
|
# For Brave adblock in qutebrowser, which is significantly better than the
|
|
|
|
# built-in host blocking. Works on youtube and crunchyroll ads!
|
2021-02-01 23:28:55 -08:00
|
|
|
python39Packages.adblock
|
2020-03-28 22:48:43 -07:00
|
|
|
];
|
2020-10-01 15:46:04 -07:00
|
|
|
|
|
|
|
home = {
|
2021-02-01 21:24:47 -08:00
|
|
|
configFile = {
|
|
|
|
"qutebrowser" = {
|
|
|
|
source = "${configDir}/qutebrowser";
|
|
|
|
recursive = true;
|
|
|
|
};
|
|
|
|
"qutebrowser/extra/00-extraConfig.py".text = cfg.extraConfig;
|
2020-10-01 15:46:04 -07:00
|
|
|
};
|
2020-10-17 20:38:38 -07:00
|
|
|
dataFile."qutebrowser/userstyles.css".text = cfg.userStyles;
|
2020-03-28 22:48:43 -07:00
|
|
|
};
|
2021-02-01 23:28:55 -08:00
|
|
|
|
|
|
|
# Install language dictionaries for spellcheck backends
|
|
|
|
system.userActivationScripts.qutebrowserInstallDicts =
|
|
|
|
concatStringsSep "\\\n" (map (lang: ''
|
|
|
|
if ! find "$XDG_DATA_HOME/qutebrowser/qtwebengine_dictionaries" -type d -maxdepth 1 -name "${lang}*" 2>/dev/null | grep -q .; then
|
|
|
|
${pkgs.python3}/bin/python ${pkg}/share/qutebrowser/scripts/dictcli.py install ${lang}
|
|
|
|
fi
|
|
|
|
'') cfg.dicts);
|
2020-03-28 22:48:43 -07:00
|
|
|
};
|
|
|
|
}
|