Repository navigation
Expand file tree
/
Copy pathwezterm.lua
More file actions
98 lines (80 loc) · 2.61 KB
/
Copy pathwezterm.lua
File metadata and controls
98 lines (80 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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()
require("dko/tabstate").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