diff --git a/init.lua b/init.lua index 32df036..07323e1 100644 --- a/init.lua +++ b/init.lua @@ -51,7 +51,14 @@ local plugins = require("plugins") require("lazy").setup(plugins) vim.cmd.colorscheme "catppuccin" -opt.background = "light" + +-- if $XDG_STATE_HOME/darkmode exists, set dark background, light other wise +local path = ( vim.fn.getenv("XDG_STATE_HOME") or "~/.local/state" ) .. "/darkmode" +if vim.fn.filereadable(path) == 1 then + opt.background = "dark" +else + opt.background = "light" +end require("mappings")