From 85180bcc85c425119f5cdd463326cd6ba58baa26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Fri, 29 Sep 2023 00:56:29 +0200 Subject: [PATCH] feat: custom image (#6) * allow custom main image * undo for general option * fix warning: line is too long --------- Co-authored-by: SIGMazer --- lua/presence/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/presence/init.lua b/lua/presence/init.lua index e8a3d53..590eec0 100644 --- a/lua/presence/init.lua +++ b/lua/presence/init.lua @@ -118,8 +118,8 @@ function Presence:setup(...) self:set_option("auto_update", 1) self:set_option("client_id", "793271441293967371") self:set_option("debounce_timeout", 10) - self:set_option("main_image", "neovim") self:set_option("neovim_image_text", "The One True Text Editor") + self:set_option("main_image", "neovim") self:set_option("enable_line_number", false) -- Status text options self:set_option("editing_text", "Editing %s") @@ -841,8 +841,10 @@ function Presence:update_for_buffer(buffer, should_debounce) local file_text = description or name local neovim_image_text = self.options.neovim_image_text local use_file_as_main_image = self.options.main_image == "file" + local use_neovim_as_main_image = self.options.main_image == "neovim" local assets = { - large_image = use_file_as_main_image and asset_key or "neovim", + large_image = use_file_as_main_image and asset_key or use_neovim_as_main_image + and "neovim" or self.options.main_image, large_text = use_file_as_main_image and file_text or neovim_image_text, small_image = use_file_as_main_image and "neovim" or asset_key, small_text = use_file_as_main_image and neovim_image_text or file_text,