nixos-config/config/programs/plover.nix

85 lines
3.2 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
lib,
pkgs,
2022-06-16 20:47:46 +00:00
system,
2022-07-06 18:25:34 +00:00
nix-packages,
2022-06-12 15:39:15 +00:00
...
}: let
2022-09-30 15:46:21 +00:00
inherit (pkgs) plover plover-plugins-manager plover-plugin-emoji plover-plugin-tapey-tape plover-plugin-yaml-dictionary plover-plugin-rkb1-hid;
plover-env = plover.pythonModule.withPackages (_: [plover plover-plugins-manager plover-plugin-emoji plover-plugin-tapey-tape plover-plugin-yaml-dictionary plover-plugin-rkb1-hid]);
2022-06-16 20:47:46 +00:00
plover-src = plover.src;
2022-07-06 18:25:34 +00:00
plover-dictionaries-english =
[
{
enabled = true;
2022-07-09 18:50:23 +00:00
path = "tmpdic.yaml";
}
{
enabled = true;
2022-07-09 19:12:39 +00:00
path = ../../extra/user.yaml;
2022-07-06 18:25:34 +00:00
}
]
++ (map (module: {
enabled = true;
2022-09-30 15:46:21 +00:00
path = "${nix-packages.packages.${system}.plover-dict-didoesdigital}/dictionaries/${module}.json";
2022-07-06 18:25:34 +00:00
}) [
2022-07-09 11:57:25 +00:00
#Put this first
"fingerspelling"
# put these in alphabetical order
2022-07-06 18:25:34 +00:00
"abbreviations"
"briefs"
2022-07-07 10:50:56 +00:00
"computer-use"
2022-07-06 18:25:34 +00:00
"currency"
"dict"
2022-07-07 10:50:56 +00:00
"modifiers-single-stroke"
"navigation"
2022-07-06 18:25:34 +00:00
"nouns"
"numbers"
"numbers-powerups"
2022-07-07 10:50:56 +00:00
"plover-use"
2022-07-06 18:25:34 +00:00
"proper-nouns"
"punctuation-powerups"
"punctuation-unspaced"
2022-07-07 10:50:56 +00:00
"punctuation"
2022-07-06 18:25:34 +00:00
"symbols"
"symbols-briefs"
"symbols-currency"
2022-07-07 10:50:56 +00:00
"tabbing"
2022-07-06 18:25:34 +00:00
"top-level-domains"
# Put these last
"condensed-strokes"
]);
2022-06-12 15:39:15 +00:00
plover-cfg = pkgs.writeText "plover.cfg" (lib.generators.toINI {} {
2022-07-27 21:02:53 +00:00
"Machine Configuration".machine_type = "Plover HID";
"System: English Stenotype" = {
2022-06-18 08:57:25 +00:00
dictionaries = builtins.toJSON plover-dictionaries-english;
2022-07-29 07:01:39 +00:00
"keymap[plover hid]" = ''[["#", ["X3", "X4", "X5", "X6", "X7", "X8", "X37", "X38", "X43", "X44", "X45", "X46", "X47", "X48", "X77", "X78"]], ["S-", ["X15", "X23"]], ["T-", ["X14"]], ["K-", ["X22"]], ["P-", ["X13"]], ["W-", ["X21"]], ["H-", ["X12"]], ["R-", ["X20"]], ["A-", ["X36"]], ["O-", ["X35"]], ["*", ["X11", "X19", "X56", "X64"]], ["-E", ["X80"]], ["-U", ["X79"]], ["-F", ["X55"]], ["-R", ["X63"]], ["-P", ["X54"]], ["-B", ["X62"]], ["-L", ["X53"]], ["-G", ["X61"]], ["-T", ["X52"]], ["-S", ["X60"]], ["-D", ["X51"]], ["-Z", ["X59"]], ["no-op", ["X1", "X2", "X9", "X10", "X16", "X17", "X18", "X24", "X25", "X26", "X27", "X28", "X29", "X30", "X31", "X32", "X33", "X34", "X39", "X40", "X41", "X42", "X49", "X50", "X57", "X58", "X65", "X66", "X67", "X68", "X69", "X70", "X71", "X72", "X73", "X74", "X75", "X76"]]]'';
2022-06-18 08:57:25 +00:00
};
2022-10-07 07:06:19 +00:00
Plugins.enabled_extensions = builtins.toJSON ["RKB Unicode Sender" "plover_tapey_tape"];
});
2022-06-12 15:39:15 +00:00
in {
2022-01-24 09:06:57 +00:00
home.packages = [
2022-06-18 08:23:53 +00:00
plover-env
2022-01-24 09:06:57 +00:00
];
2022-06-12 15:39:15 +00:00
home.activation.ploverSettings = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG -p $HOME/.config/plover
$DRY_RUN_CMD rm -f $HOME/.config/plover/plover.cfg
$DRY_RUN_CMD cp $VERBOSE_ARG ${plover-cfg} $HOME/.config/plover/plover.cfg
$DRY_RUN_CMD chmod +w $VERBOSE_ARG $HOME/.config/plover/plover.cfg
2022-06-01 16:59:56 +00:00
'';
systemd.user.services.plover = {
Unit = {
Description = "plover";
2022-06-12 15:39:15 +00:00
After = ["tray.target"];
PartOf = ["graphical-session.target"];
Requires = ["tray.target"];
};
Install = {
2022-06-12 15:39:15 +00:00
WantedBy = ["graphical-session.target"];
};
Service = {
2022-06-18 08:43:06 +00:00
ExecStart = "${plover-env}/bin/plover";
2022-03-04 19:20:54 +00:00
};
};
2022-01-24 09:06:57 +00:00
}