refactor, add common modules

This commit is contained in:
2025-01-08 21:28:04 -08:00
parent 00af4d57aa
commit f30ff9962c
10 changed files with 144 additions and 117 deletions

View File

@@ -0,0 +1,5 @@
{...}: {
imports = [
./kb-input.nix
];
}

View File

@@ -0,0 +1,42 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.common.kb-input;
in {
options = {
common.kb-input = {
enable = lib.mkEnableOption "input method and custom keyboard layout";
};
};
config = lib.mkIf cfg.enable {
services.xserver.xkb.extraLayouts = {
minimak-4 = {
description = "English (US, Minimak-4)";
languages = [ "eng" ];
symbolsFile = ./minimak;
};
minimak-8 = {
description = "English (US, Minimak-8)";
languages = [ "eng" ];
symbolsFile = ./minimak;
};
minimak-12 = {
description = "English (US, Minimak-12)";
languages = [ "eng" ];
symbolsFile = ./minimak;
};
};
i18n.inputMethod = {
type = "fcitx5";
enable = true;
fcitx5.waylandFrontend = true;
fcitx5.plasma6Support = true;
fcitx5.addons = [ pkgs.fcitx5-mozc ];
};
};
}

70
modules/common/minimak Normal file
View File

@@ -0,0 +1,70 @@
partial default alphanumeric_keys
xkb_symbols "minimak-4" {
// Describes the differences between a basic US keyboard layout and
// Minimak-4
include "us(basic)"
name[Group1]="English (US, Minimak-4)";
key <AD03> { [ d, D ] };
key <AD05> { [ k, K ] };
key <AC03> { [ t, T ] };
key <AC08> { [ e, E ] };
include "level3(ralt_switch_multikey)"
};
partial default alphanumeric_keys
xkb_symbols "minimak-8" {
// Describes the differences between a basic US keyboard layout and
// Minimak-8
include "us(basic)"
name[Group1]="English (US, Minimak-8)";
key <AD03> { [ d, D ] };
key <AD05> { [ k, K ] };
key <AD09> { [ l, L ] };
key <AC03> { [ t, T ] };
key <AC07> { [ n, N ] };
key <AC08> { [ e, E ] };
key <AC09> { [ o, O ] };
key <AB06> { [ j, J ] };
include "level3(ralt_switch_multikey)"
};
partial default alphanumeric_keys
xkb_symbols "minimak-12" {
// Describes the differences between a basic US keyboard layout and
// Minimak-12
include "us(basic)"
name[Group1]="English (US, Minimak-12)";
key <AD03> { [ d, D ] };
key <AD04> { [ f, F ] };
key <AD05> { [ k, K ] };
key <AD09> { [ l, L ] };
key <AD10> { [ semicolon, colon ] };
key <AC03> { [ t, T ] };
key <AC04> { [ r, R ] };
key <AC07> { [ n, N ] };
key <AC08> { [ e, E ] };
key <AC09> { [ o, O ] };
key <AC10> { [ p, P ] };
key <AB06> { [ j, J ] };
include "level3(ralt_switch_multikey)"
};