From c847918937bc02ef6730371bbff7e5152bd42060 Mon Sep 17 00:00:00 2001 From: ant Date: Thu, 7 Mar 2024 14:03:36 +0100 Subject: [PATCH] Add check for dark mode --- init.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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")