configuration/packages/xcompose.nix

24 lines
666 B
Nix
Raw Normal View History

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