feat(nvim/theme): support macos theme changeing

This commit is contained in:
Tine 2025-01-28 17:50:57 +01:00
parent 665f4fe4f0
commit 70b247edd4
Signed by: mentos1386
SSH key fingerprint: SHA256:4BKPWFv1LPB4F1GyyXlMF1SnzGwvURTZ6fMejXIThhI
3 changed files with 1 additions and 39 deletions

View file

@ -8,6 +8,7 @@ Plug("nvim-lua/plenary.nvim")
-- General
Plug("ojroques/nvim-osc52")
-- Look
Plug('f-person/auto-dark-mode.nvim')
Plug("rose-pine/neovim", { as = "rose-pine", tag = "v3.*" })
Plug("nvim-lualine/lualine.nvim")
Plug("Yggdroot/indentLine")

View file

@ -129,7 +129,6 @@ require("mason").setup({
require("mason-lspconfig").setup({
ensure_installed = {
"typos_lsp", -- all
"angularls", -- angular
"ansiblels", -- ansible
"bashls", -- bash
"buf_ls", -- buf

View file

@ -12,41 +12,3 @@ require("rose-pine").setup({
},
})
vim.cmd("colorscheme rose-pine")
vim.o.background = "light"
local debounce = function(ms, fn)
local running = false
return function()
if running then
return
end
vim.defer_fn(function()
running = false
end, ms)
running = true
vim.schedule(fn)
end
end
-- Create a job to detect current gnome color scheme and set background
local Job = require("plenary.job")
local set_background = function()
local j = Job:new({ command = "gsettings", args = { "get", "org.gnome.desktop.interface", "color-scheme" } })
j:sync()
if j:result()[1] == "'default'" then
vim.o.background = "light"
else
vim.o.background = "dark"
end
end
-- Call imidiatly to set initially
set_background()
-- Listen for SIGUSR1 signal to update background
local group = vim.api.nvim_create_augroup("BackgroundWatch", { clear = true })
vim.api.nvim_create_autocmd("Signal", {
pattern = "SIGUSR1",
callback = debounce(500, set_background),
group = group,
})