set colorscheme based on system theme

This commit is contained in:
Ray Elliott 2026-01-19 19:16:47 +00:00
parent fc4f980c25
commit 53502acd6e
3 changed files with 22 additions and 0 deletions

View File

@ -5,6 +5,24 @@ vim.g.loaded_ruby_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_node_provider = 0
-- Auto-detect system theme (Linux/GNOME)
local function set_background_from_system()
local handle = io.popen('gsettings get org.gnome.desktop.interface color-scheme 2>/dev/null')
if handle then
local result = handle:read("*a")
handle:close()
if result:match("dark") then
vim.o.background = 'dark'
else
vim.o.background = 'light'
end
end
end
-- Set background based on system theme on startup
set_background_from_system()
-- Store initial working directory as project root
-- Used by netrw navigation to return to project root after following symlinks
vim.g.project_root = vim.fn.getcwd()

View File

@ -783,3 +783,7 @@ param
int
bool
#/!
bspwm
composable
XDG
configs

Binary file not shown.