1
0
Fork 0
vdotfiles/gui/.wezterm.lua

122 lines
4.1 KiB
Lua
Raw Normal View History

2023-01-21 12:53:08 +02:00
local wt = require('wezterm')
2022-09-08 22:39:07 +03:00
local act = wt.action
2023-06-20 14:15:47 +03:00
local font = 'VascadiaMod'
2023-06-20 15:40:41 +03:00
local harfbuzz_features = nil
2023-01-21 12:53:08 +02:00
local fontsizes = { Darwin = 14, others = 11 }
local theme = 'GruvboxDark'
2023-01-21 12:53:08 +02:00
local overrides = {
2023-01-23 11:44:56 +02:00
fonts = {
font = wt.font('JetBrains Mono'),
harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }
},
2023-01-23 16:27:51 +02:00
theme = { color_scheme = 'PencilLight' }
}
local tab_bar_bg = '#ebdbae'
local tab_bar_fg = '#282828'
2023-01-23 16:27:51 +02:00
local tab_bar_defaults = {
bg_color = tab_bar_bg,
fg_color = tab_bar_fg,
italic = true
}
local tab_bar_active = {
bg_color = tab_bar_fg,
fg_color = tab_bar_bg,
italic = true
}
local custom_colors = {
tab_bar = {
background = tab_bar_bg,
active_tab = tab_bar_active,
inactive_tab = tab_bar_defaults,
inactive_tab_hover = tab_bar_defaults,
new_tab = tab_bar_defaults,
new_tab_hover = tab_bar_defaults,
}
2022-09-06 11:12:33 +03:00
}
2023-03-07 19:27:59 +02:00
2023-01-23 11:44:56 +02:00
local leader_key = { key = 'g', mods = 'CTRL', timeout_milliseconds = 1000 }
local keybinds = {
{ key = 'c', mods = 'META', action = act.CopyTo('Clipboard') },
{ key = 'v', mods = 'META', action = act.PasteFrom('Clipboard') },
2023-01-23 11:44:56 +02:00
-- themes
{ key = 'f', mods = 'LEADER', action = act.EmitEvent('override-fonts') },
{ key = 't', mods = 'LEADER', action = act.EmitEvent('override-theme') },
2023-03-07 19:27:59 +02:00
{ key = 'r', mods = 'LEADER', action = act.EmitEvent('override-reset') },
2023-01-23 11:44:56 +02:00
-- tabs
{ key = 'c', mods = 'LEADER', action = act.SpawnTab('DefaultDomain') },
{ key = 'n', mods = 'LEADER', action = act.ActivateTabRelative( 1) },
{ key = 'p', mods = 'LEADER', action = act.ActivateTabRelative(-1) },
-- panes
{ key = 's', mods = 'LEADER', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = 'v', mods = 'LEADER', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
2023-01-23 11:44:56 +02:00
{ key = 'h', mods = 'LEADER', action = act.ActivatePaneDirection('Left') },
{ key = 'j', mods = 'LEADER', action = act.ActivatePaneDirection('Down') },
{ key = 'k', mods = 'LEADER', action = act.ActivatePaneDirection('Up') },
{ key = 'l', mods = 'LEADER', action = act.ActivatePaneDirection('Right') },
{ key = 'u', mods = 'LEADER', action = act.RotatePanes('Clockwise') },
{ key = 'i', mods = 'LEADER', action = act.RotatePanes('CounterClockwise') },
{ key = 'Return', mods = 'LEADER', action = act.TogglePaneZoomState },
{ key = 'Space', mods = 'LEADER', action = act.PaneSelect },
}
for i = 1, 9 do
table.insert(
keybinds,
{ key = tostring(i), mods = 'LEADER', action = act.ActivateTab(i - 1) }
)
end
2023-01-21 12:53:08 +02:00
local function get_os()
local current_os = os.getenv('OS')
if current_os then return current_os end
return io.popen('uname -s', 'r'):read()
end
2023-01-28 03:34:59 +02:00
local function set_by_os(values)
2023-01-21 12:53:08 +02:00
local my_os = get_os()
2023-01-28 03:34:59 +02:00
if values[my_os] then return values[my_os] end
return values.others
2023-01-21 12:53:08 +02:00
end
2022-09-06 11:12:33 +03:00
2023-01-23 16:27:51 +02:00
local current_overrides = {}
2023-01-21 12:53:08 +02:00
local function toggle_overrides(window, overrides)
for k, v in pairs(overrides) do
if current_overrides[k] == v then
current_overrides[k] = nil
else
current_overrides[k] = v
end
end
window:set_config_overrides(current_overrides)
end
2022-09-06 11:12:33 +03:00
2023-01-21 12:53:08 +02:00
local function reset_overrides(window)
current_overrides = {}
window:set_config_overrides()
2022-09-07 12:30:45 +03:00
end
2023-01-21 12:53:08 +02:00
wt.on('override-theme', function(window) toggle_overrides(window, overrides.theme) end)
wt.on('override-fonts', function(window) toggle_overrides(window, overrides.fonts) end)
2023-03-07 19:27:59 +02:00
wt.on('override-reset', reset_overrides)
2022-09-06 11:12:33 +03:00
return {
2023-02-04 14:38:32 +02:00
xcursor_theme = 'Adwaita',
2023-01-21 12:53:08 +02:00
audible_bell = 'Disabled',
font = wt.font(font),
2023-01-28 03:34:59 +02:00
font_size = set_by_os(fontsizes),
2023-06-19 18:34:20 +03:00
harfbuzz_features = harfbuzz_features,
2023-01-21 12:53:08 +02:00
color_scheme = theme,
2023-07-14 13:58:18 +03:00
window_background_opacity = 0.95,
macos_window_background_blur = 20,
win32_system_backdrop = 'Acrylic',
2023-01-21 12:53:08 +02:00
cursor_blink_rate = 0,
check_for_updates = false,
bold_brightens_ansi_colors = false,
2023-01-23 16:27:51 +02:00
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
2023-01-23 11:44:56 +02:00
leader = leader_key,
2023-01-23 16:27:51 +02:00
keys = keybinds,
colors = custom_colors,
use_fancy_tab_bar = false,
hide_tab_bar_if_only_one_tab = true,
2023-02-15 16:07:34 +02:00
tab_max_width = 128
}