2023-02-20 11:42:13 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.notify;
|
2023-02-20 11:42:13 +01:00
|
|
|
helpers = import ../helpers.nix {inherit lib;};
|
2021-12-23 00:09:24 +01:00
|
|
|
icon = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
};
|
2023-02-20 11:42:13 +01:00
|
|
|
in {
|
2022-09-18 11:19:23 +01:00
|
|
|
options.plugins.notify = {
|
2023-01-22 03:32:08 +00:00
|
|
|
enable = mkEnableOption "notify";
|
2021-12-23 00:09:24 +01:00
|
|
|
|
2023-01-25 19:46:49 +01:00
|
|
|
package = helpers.mkPackageOption "notify" pkgs.vimPlugins.nvim-notify;
|
2023-01-19 10:45:15 +00:00
|
|
|
|
2021-12-23 00:09:24 +01:00
|
|
|
stages = mkOption {
|
2023-02-20 11:42:13 +01:00
|
|
|
type = types.nullOr (types.enum ["fade_in_slide_out" "fade" "slide" "static"]);
|
2021-12-23 00:09:24 +01:00
|
|
|
description = "Animation style";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
timeout = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = "Default timeout for notifications";
|
|
|
|
default = null;
|
|
|
|
};
|
2023-03-24 18:04:07 -04:00
|
|
|
backgroundColour = mkOption {
|
2021-12-23 00:09:24 +01:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "For stages that change opacity this is treated as the highlight between the window";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
minimumWidth = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = "Minimum width for notification windows";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
icons = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
error = icon;
|
|
|
|
warn = icon;
|
|
|
|
info = icon;
|
|
|
|
debug = icon;
|
|
|
|
trace = icon;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
description = "Icons for the different levels";
|
2023-02-20 11:42:13 +01:00
|
|
|
default = {};
|
2021-12-23 00:09:24 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
config = let
|
|
|
|
setupOptions = with cfg; {
|
|
|
|
stages = stages;
|
|
|
|
timeout = timeout;
|
2023-03-24 18:04:07 -04:00
|
|
|
background_colour = backgroundColour;
|
2023-02-20 11:42:13 +01:00
|
|
|
minimum_width = minimumWidth;
|
|
|
|
icons = with icons; {
|
|
|
|
ERROR = error;
|
|
|
|
WARN = warn;
|
|
|
|
INFO = info;
|
|
|
|
DEBUG = debug;
|
|
|
|
TRACE = trace;
|
2021-12-23 00:09:24 +01:00
|
|
|
};
|
2023-02-20 11:42:13 +01:00
|
|
|
};
|
|
|
|
in
|
2022-09-18 11:19:23 +01:00
|
|
|
mkIf cfg.enable {
|
2023-02-20 11:42:13 +01:00
|
|
|
extraPlugins = [cfg.package];
|
2021-12-23 00:09:24 +01:00
|
|
|
extraConfigLua = ''
|
|
|
|
vim.notify = require('notify');
|
|
|
|
require('notify').setup(${helpers.toLuaObject setupOptions})
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|