From 796a6301df4f239c7213a4ff8f25ac0c618bf944 Mon Sep 17 00:00:00 2001 From: Josef Hofer Date: Mon, 11 Nov 2024 17:28:12 +0100 Subject: [PATCH] make discord presence templateable --- hosts/shared/programs/editor/default.nix | 44 +++++++++++++++++-- .../nvim/lua/plugins/discord-presence.lua | 33 -------------- 2 files changed, 41 insertions(+), 36 deletions(-) delete mode 100644 hosts/shared/programs/editor/nvim/lua/plugins/discord-presence.lua diff --git a/hosts/shared/programs/editor/default.nix b/hosts/shared/programs/editor/default.nix index 4dfbcc9f..0fbc61dc 100644 --- a/hosts/shared/programs/editor/default.nix +++ b/hosts/shared/programs/editor/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, vars, ... }: let # Filter out lazy-lock.json from the source directory nvimConfigFiltered = lib.cleanSourceWith { @@ -8,6 +8,7 @@ let in baseName != "lazy-lock.json"; }; treeSitterWithAllGrammars = pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars); + nvim.discord.blacklist = vars.nvim.discord.blacklist or ""; in { # Packages you also want to outside use outside of nvim @@ -66,14 +67,51 @@ in ]; }; - # Copy your Neovim configuration xdg.configFile = { # Copy the filtered nvim configuration directory "nvim" = { source = nvimConfigFiltered; recursive = true; }; - }; + +# Discord Rich Presence Configuration +"nvim/lua/plugins/presence.lua" = { + text = '' + return { + -- add symbols-outline + { + "andweeb/presence.nvim", + -- cmd = "SymbolsOutline", + lazy = true, + event = "VeryLazy", + -- keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + opts = { + -- General options + auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`) + neovim_image_text = "How do I exit this?", -- Text displayed when hovered over the Neovim image + main_image = "file", -- Main image display (either "neovim" or "file") + client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) + log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") + debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(, true)`) + enable_line_number = false, -- Displays the current line number instead of the current project + blacklist = { "${toString nvim.discord.blacklist}" }, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches + buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "