2022-12-22 00:13:52 +01:00
|
|
|
local present, presence = pcall(require, "presence")
|
|
|
|
|
|
|
|
if not present then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2022-07-30 07:17:12 +02:00
|
|
|
function string.starts(self, str)
|
2022-10-11 07:40:50 +02:00
|
|
|
return self:find("^" .. str) ~= nil
|
2022-07-30 07:17:12 +02:00
|
|
|
end
|
|
|
|
|
2022-12-07 09:30:23 +01:00
|
|
|
local home = vim.fn.expand("$HOME") .. "/Code/"
|
|
|
|
|
|
|
|
local blacklist = {
|
|
|
|
[vim.fn.resolve(home .. "work")] = "Using nvim at work.",
|
|
|
|
[vim.fn.resolve(home .. "freelance")] = "Using nvim to freelance.",
|
2023-03-11 22:52:33 +01:00
|
|
|
[vim.fn.resolve(vim.fn.stdpath("config"))] = "Configuring nvim. ("
|
|
|
|
.. require("lazy").stats().count
|
|
|
|
.. " plugins)",
|
2022-12-07 09:30:23 +01:00
|
|
|
}
|
|
|
|
|
2022-12-22 00:13:52 +01:00
|
|
|
local conceal = function(activity, info)
|
2022-10-11 07:40:50 +02:00
|
|
|
local cur_file = vim.fn.expand("%:p")
|
|
|
|
for k, v in pairs(blacklist) do
|
|
|
|
if cur_file:starts(k) then
|
|
|
|
return v
|
|
|
|
end
|
|
|
|
end
|
2022-12-22 00:13:52 +01:00
|
|
|
if info ~= nil then
|
|
|
|
return activity .. " " .. info
|
|
|
|
end
|
2022-07-30 07:17:12 +02:00
|
|
|
end
|
|
|
|
|
2022-12-07 09:30:23 +01:00
|
|
|
local v = vim.version()
|
|
|
|
local vStr = string.format("v%d.%d.%d", v.major, v.minor, v.patch)
|
|
|
|
|
2022-12-22 00:13:52 +01:00
|
|
|
presence:setup({
|
2022-10-11 07:40:50 +02:00
|
|
|
-- General options
|
|
|
|
auto_update = true,
|
2022-12-07 09:30:23 +01:00
|
|
|
debounce_timeout = 10,
|
2023-01-31 09:38:11 +01:00
|
|
|
neovim_image_text = "Neovim " .. vStr,
|
2022-10-11 07:40:50 +02:00
|
|
|
-- Main image display (either "neovim" or "file")
|
|
|
|
main_image = "file",
|
2022-12-07 09:30:23 +01:00
|
|
|
show_time = false,
|
2023-03-11 22:52:33 +01:00
|
|
|
buttons = function(buffer, repo_url)
|
|
|
|
local concealed = conceal()
|
|
|
|
if concealed then
|
|
|
|
return {
|
|
|
|
{
|
|
|
|
label = "View my config",
|
|
|
|
url = "https://github.com/nekowinston/dotfiles",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return {
|
|
|
|
{
|
|
|
|
label = "View the repository",
|
|
|
|
url = repo_url,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end,
|
2022-10-11 07:40:50 +02:00
|
|
|
file_assets = {
|
|
|
|
["k8s.yaml"] = {
|
|
|
|
"Kubernetes",
|
2022-12-07 09:30:23 +01:00
|
|
|
"https://avatars.githubusercontent.com/u/13629408",
|
2022-10-11 07:40:50 +02:00
|
|
|
},
|
|
|
|
["Chart.yaml"] = {
|
|
|
|
"Helm Chart",
|
|
|
|
"https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png",
|
|
|
|
},
|
|
|
|
["helmfile.yaml"] = {
|
|
|
|
"helmfile",
|
|
|
|
"https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png",
|
|
|
|
},
|
|
|
|
["prisma"] = {
|
|
|
|
"Prisma",
|
|
|
|
"https://avatars.githubusercontent.com/u/17219288",
|
|
|
|
},
|
2022-12-07 09:30:23 +01:00
|
|
|
["bu"] = {
|
|
|
|
"Butane Config",
|
|
|
|
"https://avatars.githubusercontent.com/u/3730757",
|
|
|
|
},
|
|
|
|
["ign"] = {
|
|
|
|
"CoreOS Ignition",
|
|
|
|
"https://avatars.githubusercontent.com/u/3730757",
|
|
|
|
},
|
2022-10-11 07:40:50 +02:00
|
|
|
},
|
|
|
|
-- Rich Presence text options
|
|
|
|
editing_text = function(s)
|
2022-12-22 00:13:52 +01:00
|
|
|
return conceal("Editing", s)
|
2022-10-11 07:40:50 +02:00
|
|
|
end,
|
|
|
|
reading_text = function(s)
|
2022-12-22 00:13:52 +01:00
|
|
|
return conceal("Reading", s)
|
2022-10-11 07:40:50 +02:00
|
|
|
end,
|
|
|
|
file_explorer_text = function(s)
|
2022-12-22 00:13:52 +01:00
|
|
|
return conceal("Browsing", s)
|
2022-10-11 07:40:50 +02:00
|
|
|
end,
|
|
|
|
workspace_text = function(s)
|
|
|
|
local concealed = conceal()
|
|
|
|
if s ~= nil and not concealed then
|
|
|
|
return "Working on " .. s
|
|
|
|
else
|
2023-03-11 22:52:33 +01:00
|
|
|
return nil
|
2022-10-11 07:40:50 +02:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
git_commit_text = "Committing changes",
|
|
|
|
plugin_manager_text = "Managing Plugins",
|
2022-07-30 07:17:12 +02:00
|
|
|
})
|