configuration/packages/xcompose.nix
2023-06-16 11:11:55 -07:00

23 lines
666 B
Nix

{ config, lib, ... }:
let
inherit (lib) concatLines concatMapStringsSep mapAttrsToList mkIf mkOption;
inherit (lib.types) attrsOf listOf str;
in
{
options.xcompose = {
sequences = mkOption { type = attrsOf (listOf str); };
};
config =
mkIf (config.xcompose ? "sequences") {
home.file.".XCompose" = {
onChange = "rm -rfv ${config.home.homeDirectory}/.cache/gtk-3.0/compose";
text = concatLines (mapAttrsToList
(glyph: sequence:
let keys = [ "Multi_key" ] ++ sequence;
in "${concatMapStringsSep " " (k: "<${k}>") keys} : \"${glyph}\"")
config.xcompose.sequences);
};
};
}