nixos-config/config/programs/plover.nix

87 lines
2.1 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-06-12 15:39:15 +00:00
...
}: let
2022-06-17 06:04:35 +00:00
inherit (pkgs) plover plover-plugins-manager;
2022-06-16 20:47:46 +00:00
plover-src = plover.src;
plover-dictionaries = [
{
enabled = true;
path = pkgs.writeText "user.json" (builtins.toJSON {
"SER/TKPWAL" = "Sergal";
"SERLG" = "Sergal";
"SER/SRAL" = "serval";
});
}
{
enabled = true;
path = "${plover-src}/plover/assets/commands.json";
}
{
enabled = true;
path = "${plover-src}/plover/assets/main.json";
}
];
2022-05-29 19:29:27 +00:00
keyboard-keymap = [
2022-06-12 15:39:15 +00:00
["#" ["1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "-" "=" "b"]]
["S-" ["q" "a"]]
["T-" ["w"]]
["K-" ["s"]]
["P-" ["e"]]
["W-" ["d"]]
["H-" ["r"]]
["R-" ["f"]]
["A-" ["c"]]
["O-" ["v"]]
["*" ["t" "y" "g" "h"]]
["-E" ["n"]]
["-U" ["m"]]
["-F" ["u"]]
["-R" ["j"]]
["-P" ["i"]]
["-B" ["k"]]
["-L" ["o"]]
["-G" ["l"]]
["-T" ["p"]]
["-S" [";"]]
["-D" ["["]]
["-Z" ["'"]]
["arpeggiate" ["space"]]
["no-op" ["\\" "]" "z" "x" "" "." "/"]]
2022-05-29 19:29:27 +00:00
];
2022-06-12 15:39:15 +00:00
plover-cfg = pkgs.writeText "plover.cfg" (lib.generators.toINI {} {
"Machine Configuration".machine_type = "Keyboard";
"System: English Stenotype" = {
dictionaries = builtins.toJSON plover-dictionaries;
2022-05-29 19:29:27 +00:00
"keymap[keyboard]" = builtins.toJSON keyboard-keymap;
};
});
2022-06-12 15:39:15 +00:00
in {
2022-01-24 09:06:57 +00:00
home.packages = [
2022-06-16 20:47:46 +00:00
plover
plover-plugins-manager
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-16 20:47:46 +00:00
ExecStart = "${plover}/bin/plover";
2022-03-04 19:20:54 +00:00
};
};
2022-01-24 09:06:57 +00:00
}