Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

wezterm/bugabinga/startup.lua

Raw
local wez = require 'wezterm'

return function ( cfg )
  ---@cast cfg Config
  -- Load login config and autoloads, then exit before opening the REPL.
  local ok, success = pcall( wez.run_child_process, { 'nu', '--login', '--execute', 'exit', } )
  if ok and success then
    cfg.default_prog = { 'nu', '--login', }
  else
    cfg.default_prog = nil -- Let WezTerm select the platform's default shell.
    local schemes = {}
    for name in pairs( wez.color.get_builtin_schemes() ) do
      table.insert( schemes, name )
    end
    cfg.color_scheme = schemes[math.random( #schemes )]
    cfg.window_frame = nil
    wez.log_warn( 'Nu startup failed; fallback shell + ' .. cfg.color_scheme )
  end
  if wez.target_triple:find( 'windows', 1, true ) then
    cfg.set_environment_variables = { LANG = 'en_US.UTF-8', }
  end
end