neovim-flake/modules/rich-presence/neocord/neocord.nix

141 lines
4.3 KiB
Nix
Raw Normal View History

{lib, ...}: let
2024-02-17 23:47:47 +01:00
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
2024-03-24 01:14:39 +01:00
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) bool int str enum nullOr listOf;
in {
2024-02-17 23:47:47 +01:00
imports =
[
(mkRemovedOptionModule ["vim" "presence" "presence-nvim"] ''
The option vim.presence.presence-nvim has been deprecated in favor of the new neocord module.
Options provided by the plugin remain mostly the same, but manual migration is required.
2024-02-17 23:47:47 +01:00
Please see neocord documentation and the neovim-flake options for more info
'')
]
++ (map
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" "rich_presence" optName] ["vim" "presence" "neocord" "setupOpts" optName])
["debounce_timeout" "blacklist" "show_time" "editing_text" "file_explorer_text" "git_commit_text" "plugin_manager_text" "reading_text" "workspace_text" "line_number_text" "terminal_text"])
++ (map
(optName: mkRenamedOptionModule ["vim" "presence" "neocord" optName] ["vim" "presence" "neocord" "setupOpts" optName])
["logo" "logo_tooltip" "main_image" "client_id" "log_level" "debounce_timeout" "blacklist" "show_time"]);
options.vim.presence.neocord = {
enable = mkEnableOption "neocord plugin for discord rich presence";
2024-02-17 23:47:47 +01:00
setupOpts = lib.nvim.mkPluginSetupOption "neocord" {
logo = mkOption {
type = str; # TODO: can the default be documented better, maybe with an enum?
default = "auto";
description = ''
Logo to be displayed on the RPC item
2024-02-17 23:47:47 +01:00
This must be either "auto" or an URL to your image of choice
'';
};
2024-02-17 23:47:47 +01:00
logo_tooltip = mkOption {
type = str;
default = "The One True Text Editor";
description = "Text displayed when hovering over the Neovim image";
};
2024-02-17 23:47:47 +01:00
main_image = mkOption {
type = enum ["language" "logo"];
default = "language";
description = "Main image to be displayed";
};
2024-02-17 23:47:47 +01:00
client_id = mkOption {
type = str;
default = "1157438221865717891";
description = "Client ID of the application";
};
2024-02-17 23:47:47 +01:00
log_level = mkOption {
type = nullOr (enum ["debug" "info" "warn" "error"]);
default = null;
description = "Log level to be used by the plugin";
};
2024-02-17 23:47:47 +01:00
debounce_timeout = mkOption {
type = int;
default = 10;
description = "Number of seconds to debounce events";
};
2024-02-17 23:47:47 +01:00
auto_update = mkOption {
type = bool;
default = true;
description = "Automatically update the presence";
};
2024-02-17 23:47:47 +01:00
enable_line_number = mkOption {
type = bool;
default = false;
description = "Show line number on the RPC item";
};
2024-02-17 23:47:47 +01:00
show_time = mkOption {
type = bool;
default = true;
description = "Show time on the RPC item";
};
2024-02-17 23:47:47 +01:00
blacklist = mkOption {
type = listOf str;
default = [];
example = literalExpression ''["Alpha"]'';
description = "List of filetypes to ignore";
};
editing_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Editing %s";
description = "Text displayed when editing a file";
};
file_explorer_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Browsing %s";
description = "Text displayed when browsing files";
};
git_commit_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Committing changes";
description = "Text displayed when committing changes";
};
plugin_manager_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Managing plugins";
description = "Text displayed when managing plugins";
};
reading_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Reading %s";
description = "Text displayed when reading a file";
};
workspace_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Working on %s";
description = "Text displayed when working on a project";
};
line_number_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Line %s out of %s";
description = "Text displayed when showing line number";
};
terminal_text = mkOption {
2024-03-24 01:14:39 +01:00
type = str;
default = "Working on the terminal";
description = "Text displayed when working on the terminal";
};
};
2023-02-05 21:56:40 +01:00
};
}