From 70b247edd4b11c6cd305cc410c403d72e2f482b3 Mon Sep 17 00:00:00 2001 From: Tine Date: Tue, 28 Jan 2025 17:50:57 +0100 Subject: [PATCH] feat(nvim/theme): support macos theme changeing --- nvim/init.lua | 1 + nvim/lua/code_helpers.lua | 1 - nvim/lua/theme.lua | 38 -------------------------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 6c0ddfb..bbf97c0 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -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") diff --git a/nvim/lua/code_helpers.lua b/nvim/lua/code_helpers.lua index 8f45513..06365de 100644 --- a/nvim/lua/code_helpers.lua +++ b/nvim/lua/code_helpers.lua @@ -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 diff --git a/nvim/lua/theme.lua b/nvim/lua/theme.lua index e0d0d2e..17f22ff 100644 --- a/nvim/lua/theme.lua +++ b/nvim/lua/theme.lua @@ -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, -})