if not vim.g.neovide then return end vim.g.neovide_transparency=1.0 _G.neovide_alpha=function()return string.format("\037\120",math.floor(255*(vim.g.transparency or.8)))end if(vim.uv.os_uname()).sysname=="\068\097\114\119\105\110"then vim.g.neovide_normal_opacity=.6 vim.g.neovide_window_blurred=true else vim.g.neovide_normal_opacity=.9 end vim.api.nvim_create_autocmd("\067\111\108\111\114\083\099\104\101\109\101",{group=vim.api.nvim_create_augroup("\110\101\111\118\105\100\101\058\098\097\099\107\103\114\111\117\110\100",{clear=true}),callback=function()local O=vim.api.nvim_get_hl(0,{name="\078\111\114\109\097\108"})or{bg=0,fg=0}local V=string.format("\037\120",O.bg)local G=string.format("\037\120",O.fg)vim.g.neovide_background_color=V.._G.neovide_alpha()vim.g.neovide_title_background_color=V vim.g.neovide_title_text_color=G end})vim.api.nvim_exec_autocmds("\067\111\108\111\114\083\099\104\101\109\101",{})vim.g.fontsize=14 local O={{family="\077\097\112\108\101 \077\111\110\111"};{family="\083\121\109\098\111\108\115 \078\101\114\100 \070\111\110\116",size=13}}vim.o.guifont=(vim.iter(O)):fold("",function(O,V)if#O>0 then O=O.."\044"end return O..string.format("\037\115\058\104\037\100",V.family,V.size or vim.g.fontsize)end)vim.g.lineheight=1.2 vim.opt.linespace=math.floor((vim.g.lineheight-1)*vim.g.fontsize)vim.g.neovide_detach_on_quit="\097\108\119\097\121\115\095\100\101\116\097\099\104"vim.keymap.set("\110","\060\109-\101\110\116\101\114\062",function()vim.g.neovide_fullscreen=not vim.g.neovide_fullscreen if vim.g.neovide_fullscreen then vim.notify("\101\110\097\098\108\105\110\103 \102\117\108\108\115\099\114\101\101\110")else vim.notify("\100\105\115\097\098\108\105\110\103 \102\117\108\108\115\099\114\101\101\110")end end,{noremap=true,silent=true})
if not vim.g.neovide then
  return
end

-- background --
vim.g.neovide_transparency = 1.0

_G.neovide_alpha = function()
  return string.format("%x", math.floor(255 * (vim.g.transparency or 0.8)))
end

if vim.uv.os_uname().sysname == "Darwin" then
  vim.g.neovide_normal_opacity = 0.6
  -- options only currently available on macOS
  vim.g.neovide_window_blurred = true
else
  -- helper function for transparency formatting
  vim.g.neovide_normal_opacity = 0.9
end

vim.api.nvim_create_autocmd("ColorScheme", {
  group = vim.api.nvim_create_augroup("neovide:background", { clear = true }),
  callback = function()
    local normal = vim.api.nvim_get_hl(0, { name = "Normal" }) or { bg = 0, fg = 0 }
    local bg = string.format("%x", normal.bg)
    local fg = string.format("%x", normal.fg)
    vim.g.neovide_background_color = bg .. _G.neovide_alpha()
    vim.g.neovide_title_background_color = bg
    vim.g.neovide_title_text_color = fg
  end,
})
vim.api.nvim_exec_autocmds("ColorScheme", {})

-- font & cursor --

vim.g.fontsize = 14
local fonts = {
  { family = "Maple Mono" },
  { family = "Symbols Nerd Font", size = 13 },
}
vim.o.guifont = vim.iter(fonts):fold("", function(acc, font)
  if #acc > 0 then
    acc = acc .. ","
  end
  return acc .. string.format("%s:h%d", font.family, font.size or vim.g.fontsize)
end)
vim.g.lineheight = 1.2

vim.opt.linespace = math.floor((vim.g.lineheight - 1) * vim.g.fontsize)

-- behavior --
vim.g.neovide_detach_on_quit = "always_detach"

vim.keymap.set("n", "<m-enter>", function()
  vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen
  if vim.g.neovide_fullscreen then
    vim.notify("enabling fullscreen")
  else
    vim.notify("disabling fullscreen")
  end
end, { noremap = true, silent = true })
