services/plover: update module descriptions and settings file generation

This commit is contained in:
Gabriel Arazas 2023-11-22 16:05:30 +08:00
parent 112e155aa4
commit 94f75728c4
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -23,6 +23,7 @@ let
}; };
settingsFormat = ploverIniFormat { }; settingsFormat = ploverIniFormat { };
settingsFile = settingsFormat.generate "plover-config-${config.home.username}" cfg.settings;
in in
{ {
options.services.plover = { options.services.plover = {
@ -41,17 +42,15 @@ in
description = "Configuration to be used for the application."; description = "Configuration to be used for the application.";
default = { }; default = { };
defaultText = lib.literalExpression "{}"; defaultText = lib.literalExpression "{}";
example = lib.literalExpression '' example = {
{ "Output Configuration" = {
"Output Configuration" = { undo_levels = 100;
undo_levels = 100; };
};
"Stroke Display" = { "Stroke Display" = {
show = true; show = true;
}; };
} };
'';
}; };
extraOptions = lib.mkOption { extraOptions = lib.mkOption {
@ -74,9 +73,7 @@ in
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile."plover/plover.cfg".source = xdg.configFile."plover/plover.cfg".source = lib.mkIf (cfg.settings != { }) settingsFile;
settingsFormat.generate "plover-config-${config.home.username}"
cfg.settings;
systemd.user.services.plover = { systemd.user.services.plover = {
Unit = { Unit = {
@ -85,11 +82,7 @@ in
PartOf = "default.target"; PartOf = "default.target";
}; };
Service = { Service.ExecStart = "${lib.getExe' cfg.package "plover"} ${lib.concatStringsSep " " cfg.extraOptions}";
ExecStart = "${cfg.package}/bin/plover ${
lib.concatStringsSep " " cfg.extraOptions
}";
};
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
}; };