2023-02-05 19:18:57 +00:00
|
|
|
{ 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
|
2023-02-05 19:18:57 +00:00
|
|
|
{
|
|
|
|
options.xcompose = {
|
2023-06-16 18:11:55 +00:00
|
|
|
sequences = mkOption { type = attrsOf (listOf str); };
|
2023-02-05 19:18:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config =
|
2023-06-16 18:11:55 +00:00
|
|
|
mkIf (config.xcompose ? "sequences") {
|
2023-02-05 19:18:57 +00:00
|
|
|
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
|
2023-02-05 19:18:57 +00:00
|
|
|
(glyph: sequence:
|
|
|
|
let keys = [ "Multi_key" ] ++ sequence;
|
2023-06-16 18:11:55 +00:00
|
|
|
in "${concatMapStringsSep " " (k: "<${k}>") keys} : \"${glyph}\"")
|
2023-02-05 19:18:57 +00:00
|
|
|
config.xcompose.sequences);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|