vis: theme switching based on existance of ~/.lightmode

This commit is contained in:
2025-10-08 22:39:36 +02:00
parent cef92f13c9
commit 95fdacdd31

View File

@@ -158,25 +158,15 @@ local function add_global_mark()
end end
end end
local last_theme = 'default'
local function set_current_theme() local function set_current_theme()
local path = os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf' local path = os.getenv('HOME') .. '/.lightmode'
local theme = 'lupan-dark'
local f = io.open(path) local f = io.open(path)
if f then if f then
local s = f:read('*all')
f:close() f:close()
local theme = s:match('light') and 'light' or 'dark' theme = 'lupan-light'
if theme == last_theme then
return
end
last_theme = theme
if theme == 'light' then
vis:command('set theme lupan-light')
else
vis:command('set theme lupan-dark')
end
end end
vis:command('set theme ' .. theme)
end end
local ripgrep = 'rg --column --line-number --color=always --smart-case' local ripgrep = 'rg --column --line-number --color=always --smart-case'