diff options
| author | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-01-01 12:36:00 +0100 |
|---|---|---|
| committer | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-01-01 12:36:00 +0100 |
| commit | fc06b1806d6f82055ccc04bb880b5efb74e03831 (patch) | |
| tree | 3da7dcee3915c7e7c9ce89c33dea03e39d84dd81 /share/hm-modules | |
| parent | 37d064197f2d24a310e31b96214cf6bc599cebca (diff) | |
Replace rofi with tofi
Diffstat (limited to 'share/hm-modules')
| -rw-r--r-- | share/hm-modules/tofi.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/share/hm-modules/tofi.nix b/share/hm-modules/tofi.nix new file mode 100644 index 0000000..4d6dbee --- /dev/null +++ b/share/hm-modules/tofi.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: +with lib; +let + cfg = config.programs.tofi; + + format = pkgs.formats.keyValue { + mkKeyValue = generators.mkKeyValueDefault + { + mkValueString = v: + if builtins.isBool v then + if v then "true" else "false" + else if builtins.isString v then + ''"${v}"'' + else generators.mkValueStringDefault { } v; + } "="; + }; + + configFile = format.generate "config" cfg.settings; +in +{ + options.programs.tofi = { + enable = mkEnableOption + "tofi - An extremely fast and simple dmenu/rofi."; + + package = mkOption { + default = pkgs.tofi; + defaultText = literalExpression "pkgs.tofi"; + type = types.package; + example = literalExpression "pkgs.tofi"; + description = "The package to use for the tofi binaries."; + }; + + settings = mkOption { + inherit (format) type; + default = { }; + description = lib.mdDoc '' + Tofi configuration. Refer to tofi(5) for supported values. + ''; + example = { + font = "Fira Code"; + font-size = "22"; + + width = "1920"; + terminal = "kitty"; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg.configFile.tofi-config = { + enable = true; + target = "tofi/config"; + source = configFile; + }; + }; +} |
