mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
qutebrowser: add quickmark support (#2059)
Closes: https://github.com/nix-community/home-manager/issues/1230
This commit is contained in:
parent
e0f2949c98
commit
be0e73a308
3 changed files with 68 additions and 0 deletions
|
|
@ -32,6 +32,8 @@ let
|
|||
''config.bind("${k}", "${escape [ ''"'' ] c}", mode="${m}")'';
|
||||
in concatStringsSep "\n" (mapAttrsToList (formatKeyBinding m) b);
|
||||
|
||||
formatQuickmarks = n: s: "${n} ${s}";
|
||||
|
||||
in {
|
||||
options.programs.qutebrowser = {
|
||||
enable = mkEnableOption "qutebrowser";
|
||||
|
|
@ -251,6 +253,21 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
quickmarks = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = ''
|
||||
Quickmarks to add to qutebrowser's <filename>quickmarks</filename> file.
|
||||
Note that when Home Manager manages your quickmarks, you cannot edit them at runtime.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
nixpkgs = "https://github.com/NixOS/nixpkgs";
|
||||
home-manager = "https://github.com/nix-community/home-manager";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
@ -274,13 +291,26 @@ in {
|
|||
++ optional (!cfg.enableDefaultBindings) "c.bindings.default = {}"
|
||||
++ mapAttrsToList formatKeyBindings cfg.keyBindings
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig);
|
||||
|
||||
quickmarksFile = optionals (cfg.quickmarks != { }) concatStringsSep "\n"
|
||||
((mapAttrsToList formatQuickmarks cfg.quickmarks));
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file.".qutebrowser/config.py" =
|
||||
mkIf pkgs.stdenv.hostPlatform.isDarwin { text = qutebrowserConfig; };
|
||||
|
||||
home.file.".qutebrowser/quickmarks" =
|
||||
mkIf (cfg.quickmarks != { } && pkgs.stdenv.hostPlatform.isDarwin) {
|
||||
text = quickmarksFile;
|
||||
};
|
||||
|
||||
xdg.configFile."qutebrowser/config.py" =
|
||||
mkIf pkgs.stdenv.hostPlatform.isLinux { text = qutebrowserConfig; };
|
||||
|
||||
xdg.configFile."qutebrowser/quickmarks" =
|
||||
mkIf (cfg.quickmarks != { } && pkgs.stdenv.hostPlatform.isLinux) {
|
||||
text = quickmarksFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue