2021-12-23 00:09:24 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.notify;
|
2023-01-25 00:03:26 +00:00
|
|
|
helpers = import ../helpers.nix { lib = lib; };
|
2021-12-23 00:09:24 +01:00
|
|
|
icon = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
in
|
2021-12-23 00:09:24 +01:00
|
|
|
{
|
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 00:03:26 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vimPlugins.nvim-notify;
|
|
|
|
description = "Plugin to use for notify";
|
|
|
|
};
|
2023-01-19 10:45:15 +00:00
|
|
|
|
2021-12-23 00:09:24 +01:00
|
|
|
stages = mkOption {
|
|
|
|
type = types.nullOr (types.enum [ "fade_in_slide_out" "fade" "slide" "static" ]);
|
|
|
|
description = "Animation style";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
timeout = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
description = "Default timeout for notifications";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
backgroundColor = mkOption {
|
|
|
|
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";
|
2022-09-18 11:19:23 +01:00
|
|
|
default = { };
|
2021-12-23 00:09:24 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
setupOptions = with cfg; {
|
|
|
|
stages = stages;
|
|
|
|
timeout = timeout;
|
|
|
|
background_color = backgroundColor;
|
|
|
|
minimum_width = minimumWidth;
|
|
|
|
icons = with icons; {
|
|
|
|
ERROR = error;
|
|
|
|
WARN = warn;
|
|
|
|
INFO = info;
|
|
|
|
DEBUG = debug;
|
|
|
|
TRACE = trace;
|
|
|
|
};
|
2021-12-23 00:09:24 +01:00
|
|
|
};
|
2022-09-18 11:19:23 +01:00
|
|
|
in
|
|
|
|
mkIf cfg.enable {
|
2023-01-19 10:45:15 +00:00
|
|
|
extraPlugins = [ cfg.package ];
|
2021-12-23 00:09:24 +01:00
|
|
|
extraConfigLua = ''
|
|
|
|
vim.notify = require('notify');
|
|
|
|
require('notify').setup(${helpers.toLuaObject setupOptions})
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|