local wezterm = require("wezterm") ---@type Wezterm -- This table will hold the configuration. ---@type Config local config = {} -- In newer versions of wezterm, use the config_builder which will -- help provide clearer error messages if wezterm.config_builder then config = wezterm.config_builder() end config.audible_bell = "Disabled" config.cursor_blink_ease_in = "Linear" config.cursor_blink_ease_out = "EaseIn" config.cursor_blink_rate = 400 config.default_cursor_style = "BlinkingBlock" config.enable_scroll_bar = true config.hide_tab_bar_if_only_one_tab = false config.inactive_pane_hsb = { brightness = 0.5, saturation = 0.5, } config.scrollback_lines = 9999 config.swallow_mouse_click_on_pane_focus = true config.swallow_mouse_click_on_window_focus = true config.window_decorations = "RESIZE" config.window_padding = { left = "1.5cell", right = "1.5cell", top = "0.5cell", bottom = "0.5cell", } require("dko/typography").setup(config) require("dko/mappings").setup(config) require("dko/theme").setup(config) require("dko/panes").setup() wezterm.on("gui-startup", function(cmd) ---@diagnostic disable-next-line: unused-local local _tab, _pane, window = wezterm.mux.spawn_window(cmd or {}) local w = window:gui_window() -- Maximize on start? -- w:maximize() -- ========================================================================= -- DPI-based overrides -- ========================================================================= local d = w:get_dimensions() wezterm.log_info("DPI: " .. d.dpi) local overrides = w:get_config_overrides() or {} local DPI_MAP = { [72] = 16, [96] = 11, } local override_size = DPI_MAP[d.dpi] if override_size ~= nil then overrides.font_size = override_size w:set_config_overrides(overrides) end end) local ldotdir = os.getenv("LDOTDIR") if not ldotdir and os.getenv("XDG_DATA_HOME") then ldotdir = os.getenv("XDG_DATA_HOME") .. "/ldotdir" end if ldotdir then wezterm.log_info("Trying lpath: " .. ldotdir) -- Define the file name and the path format you want to add local file = io.open(ldotdir .. "/local-wezterm.lua", "r") if file then file:close() -- Get the current working directory (or specify a absolute path if needed) -- This appends the directory to the package search path package.path = package.path .. ";" .. ldotdir .. "/?.lua" end local has_after, l = pcall(require, "local-wezterm") if has_after then wezterm.log_info("local-wezterm FOUND: " .. ldotdir) l.setup(config) else wezterm.log_info("local-wezterm NOT FOUND" .. ldotdir) end end return config