run darkman specific code only if darkman is available
This commit is contained in:
parent
f65569dc50
commit
5fbfe594d9
1 changed files with 13 additions and 11 deletions
24
init.lua
24
init.lua
|
|
@ -70,18 +70,20 @@ end
|
||||||
vim.cmd.colorscheme "catppuccin"
|
vim.cmd.colorscheme "catppuccin"
|
||||||
|
|
||||||
function set_theme_according_to_darkman()
|
function set_theme_according_to_darkman()
|
||||||
local obj = vim.system({ 'darkman', 'get' }, { text = true }):wait()
|
if vim.fn.executable("darkman") == 1 then
|
||||||
if obj.code == 0 then
|
local obj = vim.system({ 'darkman', 'get' }, { text = true }):wait()
|
||||||
local theme = "light"
|
if obj.code == 0 then
|
||||||
if obj.stdout == "dark\n" then
|
local theme = "light"
|
||||||
theme = "dark"
|
if obj.stdout == "dark\n" then
|
||||||
end
|
theme = "dark"
|
||||||
if obj.stdout == "light\n" then
|
end
|
||||||
theme = "light"
|
if obj.stdout == "light\n" then
|
||||||
end
|
theme = "light"
|
||||||
|
end
|
||||||
|
|
||||||
opt.background = theme
|
opt.background = theme
|
||||||
vim.api.nvim_exec_autocmds("ColorScheme", {})
|
vim.api.nvim_exec_autocmds("ColorScheme", {})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue