1
0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-11-23 12:27:50 +01:00

feat: custom image (#6)

* allow custom main image

* undo for general option

* fix warning: line is too long

---------

Co-authored-by: SIGMazer <mazinasd7@gmail.com>
This commit is contained in:
Jiří Štefka 2023-09-29 00:56:29 +02:00 committed by GitHub
parent 76935caabd
commit 85180bcc85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,