nixos-config/config/programs/plover.nix

82 lines
2.1 KiB
Nix
Raw Normal View History

{ lib, pkgs, ... }:
2022-03-04 19:20:54 +00:00
let
plover-src = pkgs.plover.dev.src;
plover-dictionaries = [
{
enabled = true;
path = pkgs.writeText "user.json" (builtins.toJSON {
"SER/TKPWAL" = "Sergal";
"SERLG" = "Sergal";
"SER/WAL" = "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 = [
[ "#" [ "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" "" "." "/" ] ]
];
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-03-04 19:20:54 +00:00
in
{
2022-01-24 09:06:57 +00:00
home.packages = [
pkgs.plover.dev
];
2022-06-01 16:59:56 +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";
After = [ "tray.target" ];
PartOf = [ "graphical-session.target" ];
Requires = [ "tray.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.plover.dev}/bin/plover";
2022-03-04 19:20:54 +00:00
};
};
2022-01-24 09:06:57 +00:00
}