vis: set dark or light theme and start and also add key for this action

This commit is contained in:
2025-09-15 23:04:19 +02:00
parent 5464d111d0
commit d03dda4979

View File

@@ -146,6 +146,19 @@ local function add_global_mark()
end end
end end
function set_current_theme()
local f = io.open(os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf')
if f then
local s = f:read('*all')
f:close()
if s:match('light') then
vis:command('set theme lupan-light')
else
vis:command('set theme lupan-dark')
end
end
end
local ripgrep = 'rg --column --line-number --color=always --smart-case' local ripgrep = 'rg --column --line-number --color=always --smart-case'
vis.events.subscribe(vis.events.INIT, function() vis.events.subscribe(vis.events.INIT, function()
@@ -301,6 +314,9 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, ' tl', function() vis:map(vis.modes.NORMAL, ' tl', function()
vis:command('set theme lupan-light') vis:command('set theme lupan-light')
end, 'change to light theme') end, 'change to light theme')
vis:map(vis.modes.NORMAL, ' tt', set_current_theme)
set_current_theme()
end) end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis.events.subscribe(vis.events.WIN_OPEN, function(win)