refactor: support different pc/laptop configs
This commit is contained in:
5
modules/opts/default.nix
Normal file
5
modules/opts/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./kb-input
|
||||
];
|
||||
}
|
52
modules/opts/kb-input/default.nix
Normal file
52
modules/opts/kb-input/default.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.opts.kb-input;
|
||||
in {
|
||||
options = {
|
||||
opts.kb-input = {
|
||||
enable = lib.mkEnableOption "input method and custom keyboard layout";
|
||||
enableMinimak = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Minimak keyboard layout";
|
||||
};
|
||||
enableFcitx = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Fcitx5 input method";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.xserver.xkb.extraLayouts = lib.mkIf cfg.enableMinimak {
|
||||
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 = lib.mkIf cfg.enableFcitx {
|
||||
enable = true;
|
||||
type = "fcitx5";
|
||||
fcitx5.waylandFrontend = true;
|
||||
fcitx5.plasma6Support = true;
|
||||
fcitx5.addons = [ pkgs.fcitx5-mozc ];
|
||||
};
|
||||
};
|
||||
}
|
70
modules/opts/kb-input/minimak
Normal file
70
modules/opts/kb-input/minimak
Normal 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)"
|
||||
};
|
Reference in New Issue
Block a user