{ config, lib, ... }:

with lib;
let
  cfg = config.metacfg.gui.kbd;
in
{
  options.metacfg.gui.kbd = {
    ellipsis = mkEnableOption "ellipsis keybinding for period key";
  };

  config = mkIf cfg.ellipsis {
    xdg.configFile."xkb/symbols/mod".text = ''
      xkb_symbols "ellipsis" {
        key <AB09> { [ period, greater, ellipsis, division ] };
      };
    '';

    xdg.configFile."xkb/rules/evdev".text = ''
      ! option = symbols
        mod:ellipsis    = +mod(ellipsis)
      ! include %S/evdev
    '';
  };
}