remove auto theme switch (leave that to darkman)
This commit is contained in:
@@ -36,8 +36,7 @@ vim.schedule(function()
|
|||||||
require "mappings"
|
require "mappings"
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Start theme sync with system (darkman)
|
-- Apply correct theme on startup based on current darkman mode
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local theme_sync = require "theme-sync"
|
require("theme-sync").sync()
|
||||||
theme_sync.watch()
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
+1
-21
@@ -25,15 +25,9 @@ end
|
|||||||
-- Apply theme based on mode (mirrors NvChad's toggle_theme logic)
|
-- Apply theme based on mode (mirrors NvChad's toggle_theme logic)
|
||||||
function M.apply_theme(mode)
|
function M.apply_theme(mode)
|
||||||
local theme = M.themes[mode] or M.themes.dark
|
local theme = M.themes[mode] or M.themes.dark
|
||||||
local opts = require("nvconfig").base46
|
|
||||||
|
|
||||||
-- Update in-memory config so base46.compile() picks up the new theme
|
-- Update in-memory config so base46.compile() picks up the new theme
|
||||||
opts.theme = theme
|
require("nvconfig").base46.theme = theme
|
||||||
|
|
||||||
-- Bust chadrc cache, read old theme from file, then replace it
|
|
||||||
package.loaded.chadrc = nil
|
|
||||||
local old_theme = require("chadrc").base46.theme
|
|
||||||
require("nvchad.utils").replace_word('theme = "' .. old_theme, 'theme = "' .. theme)
|
|
||||||
|
|
||||||
require("base46").load_all_highlights()
|
require("base46").load_all_highlights()
|
||||||
end
|
end
|
||||||
@@ -44,18 +38,4 @@ function M.sync()
|
|||||||
M.apply_theme(mode)
|
M.apply_theme(mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Watch for theme changes (checks periodically)
|
|
||||||
function M.watch()
|
|
||||||
local timer = vim.loop.new_timer()
|
|
||||||
local last_mode = M.get_system_mode()
|
|
||||||
|
|
||||||
timer:start(0, 5000, vim.schedule_wrap(function()
|
|
||||||
local current_mode = M.get_system_mode()
|
|
||||||
if current_mode ~= last_mode then
|
|
||||||
M.apply_theme(current_mode)
|
|
||||||
last_mode = current_mode
|
|
||||||
end
|
|
||||||
end))
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user