-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwezterm.lua
80 lines (66 loc) · 2.35 KB
/
wezterm.lua
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
-- Pull in the wezterm API
local wezterm = require'wezterm'
function os.capture(cmd)
local instream = assert(io.popen(cmd, 'r'))
local outstream = assert(instream:read('*a'))
instream:close()
return outstream
end
local function compute_font_size(dpi)
-- 169 dpi ⇒ 8 pt
-- 69 dpi ⇒ 13 pt
return math.floor(-.05 * dpi + 16.45 + .5) -- +.5 to round
end
-- This table will hold the configuration.
local config = {}
local dpi = os.capture[[xrdb -query | grep Xft.dpi | awk '{print $2}']]
-- 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
-- This is where you actually apply your config choices
config.font = wezterm.font("Source Code Pro", {weight="Regular", stretch="Normal", style="Normal"}) -- /usr/share/fonts/adobe-source-code-pro/SourceCodePro-Regular.otf, FontConfig
config.font_size = compute_font_size(dpi)
config.warn_about_missing_glyphs = false
-- config.color_scheme = 'Solarized Dark (Gogh)'
config.color_scheme = 'NightOwl (Gogh)'
config.colors = { -- patch Solarized Dark (Gogh) theme: make character under cursor visible
cursor_bg = '#204675',
}
-- Configure window padding.
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
-- Configure tab bar. (Must come after setting color scheme and font.)
config.enable_tab_bar = false
-- Chainging the font size adjusts the rows/columns, not the window size.
config.adjust_window_size_when_changing_font_size = false
-- Configure hyperlinks
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- Configure bindings
config.mouse_bindings = {
-- Disable copy on select
{
event = { Up = { streak = 1, button = 'Left' } },
mods = 'NONE',
action = wezterm.action.DisableDefaultAssignment,
},
-- Ctrl-click will open the link under the mouse cursor
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = wezterm.action.OpenLinkAtMouseCursor,
},
-- Disable the Ctrl-click down event to stop programs from seeing it when a URL is clicked
{
event = { Down = { streak = 1, button = "Left" } },
mods = "CTRL",
action = wezterm.action.Nop,
},
}
-- and finally, return the configuration to wezterm
return config