mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 19:01:35 +00:00
modules/rich-presence: deprecate presence-nvim in favor of neocord
This commit is contained in:
parent
2b4683fa81
commit
428e49d303
8 changed files with 95 additions and 67 deletions
44
modules/rich-presence/neocord/config.nix
Normal file
44
modules/rich-presence/neocord/config.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim boolToString;
|
||||
inherit (lib.nvim.lua) listToLuaTable;
|
||||
inherit (builtins) toString;
|
||||
|
||||
cfg = config.vim.presence.neocord;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["neocord"];
|
||||
|
||||
vim.luaConfigRC.neocord = nvim.dag.entryAnywhere ''
|
||||
-- Description of each option can be found in https://github.com/IogaMaster/neocord#lua
|
||||
require("neocord").setup({
|
||||
-- General options
|
||||
logo = "${cfg.logo}",
|
||||
logo_tooltip = "${cfg.logo_tooltip}",
|
||||
main_image = "${cfg.main_image}",
|
||||
client_id = "${cfg.client_id}",
|
||||
log_level = "${
|
||||
if cfg.log_level == null
|
||||
then "nil"
|
||||
else cfg.log_level
|
||||
}",
|
||||
debounce_timeout = ${toString cfg.debounce_timeout},
|
||||
blacklist = ${listToLuaTable cfg.blacklist},
|
||||
show_time = "${boolToString cfg.show_time}",
|
||||
|
||||
-- Rich Presence text options
|
||||
editing_text = "${cfg.rich_presence.editing_text}",
|
||||
file_explorer_text = "${cfg.rich_presence.file_explorer_text}",
|
||||
git_commit_text = "${cfg.rich_presence.git_commit_text}",
|
||||
plugin_manager_text = "${cfg.rich_presence.plugin_manager_text}",
|
||||
reading_text = "${cfg.rich_presence.reading_text}",
|
||||
workspace_text = "${cfg.rich_presence.workspace_text}",
|
||||
line_number_text = "${cfg.rich_presence.line_number_text}",
|
||||
terminal_text = "${cfg.rich_presence.terminal_text}",
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/rich-presence/neocord/default.nix
Normal file
6
modules/rich-presence/neocord/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./neocord.nix
|
||||
];
|
||||
}
|
131
modules/rich-presence/neocord/neocord.nix
Normal file
131
modules/rich-presence/neocord/neocord.nix
Normal file
|
@ -0,0 +1,131 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types literalExpression mkRemovedOptionModule;
|
||||
in {
|
||||
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.
|
||||
|
||||
Please see neocord documentation and the neovim-flake options for more info
|
||||
'')
|
||||
];
|
||||
|
||||
options.vim.presence.neocord = {
|
||||
enable = mkEnableOption "neocord plugin for discord rich presence";
|
||||
|
||||
logo = mkOption {
|
||||
type = types.str; # TODO: can the default be documented better, maybe with an enum?
|
||||
default = "auto";
|
||||
description = ''
|
||||
Logo to be displayed on the RPC item
|
||||
|
||||
This must be either "auto" or an URL to your image of choice
|
||||
'';
|
||||
};
|
||||
|
||||
logo_tooltip = mkOption {
|
||||
type = types.str;
|
||||
default = "The One True Text Editor";
|
||||
description = "Text displayed when hovering over the Neovim image";
|
||||
};
|
||||
|
||||
main_image = mkOption {
|
||||
type = types.enum ["language" "logo"];
|
||||
default = "language";
|
||||
description = "Main image to be displayed";
|
||||
};
|
||||
|
||||
client_id = mkOption {
|
||||
type = types.str;
|
||||
default = "1157438221865717891";
|
||||
description = "Client ID of the application";
|
||||
};
|
||||
|
||||
log_level = mkOption {
|
||||
type = with types; nullOr (enum ["debug" "info" "warn" "error"]);
|
||||
default = null;
|
||||
description = "Log level to be used by the plugin";
|
||||
};
|
||||
|
||||
debounce_timeout = mkOption {
|
||||
type = types.int;
|
||||
default = 10;
|
||||
description = "Number of seconds to debounce events";
|
||||
};
|
||||
|
||||
auto_update = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Automatically update the presence";
|
||||
};
|
||||
|
||||
enable_line_number = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Show line number on the RPC item";
|
||||
};
|
||||
|
||||
show_time = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Show time on the RPC item";
|
||||
};
|
||||
|
||||
blacklist = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
example = literalExpression ''["Alpha"]'';
|
||||
description = "List of filetypes to ignore";
|
||||
};
|
||||
|
||||
rich_presence = {
|
||||
editing_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Editing %s";
|
||||
description = "Text displayed when editing a file";
|
||||
};
|
||||
|
||||
file_explorer_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Browsing %s";
|
||||
description = "Text displayed when browsing files";
|
||||
};
|
||||
|
||||
git_commit_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Committing changes";
|
||||
description = "Text displayed when committing changes";
|
||||
};
|
||||
|
||||
plugin_manager_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Managing plugins";
|
||||
description = "Text displayed when managing plugins";
|
||||
};
|
||||
|
||||
reading_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Reading %s";
|
||||
description = "Text displayed when reading a file";
|
||||
};
|
||||
|
||||
workspace_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Working on %s";
|
||||
description = "Text displayed when working on a project";
|
||||
};
|
||||
|
||||
line_number_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Line %s out of %s";
|
||||
description = "Text displayed when showing line number";
|
||||
};
|
||||
|
||||
terminal_text = mkOption {
|
||||
type = types.str;
|
||||
default = "Working on the terminal";
|
||||
description = "Text displayed when working on the terminal";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue