wezterm: update configuration settings to more appropriate modules

This commit is contained in:
Gabriel Arazas 2023-04-03 10:07:47 +08:00
parent ec5a9c3ed4
commit 82dd0261f4
3 changed files with 38 additions and 34 deletions

View File

@ -3,29 +3,47 @@ local module = {}
local wezterm = require("wezterm") local wezterm = require("wezterm")
local light_theme = "Albino bark on a tree" local light_scheme, light_scheme_metadata =
local dark_theme = "Bark on a tree" wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/albino-bark-on-a-tree.yaml")
local dark_theme, dark_theme_metadata =
wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/bark-on-a-tree.yaml")
local function scheme_for_appearance() local function scheme_for_appearance()
local scheme = wezterm.gui.get_appearance() local scheme = wezterm.gui.get_appearance()
if scheme == "Dark" then if scheme == "Dark" then
return dark_theme return dark_theme_metadata.name
else else
return light_theme return light_scheme_metadata.name
end end
end end
local albino_bark_on_a_tree = function module.add_base16_scheme_to_config(path, config)
wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/albino-bark-on-a-tree.yaml") local scheme, metadata = wezterm.color.load_base16_scheme(path)
local bark_on_a_tree = config.color_schemes[metadata.name] = scheme
wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/bark-on-a-tree.yaml")
return config
end
--- Apply the configuration with the given table. --- Apply the configuration with the given table.
-- @param config: the table containing Wezterm configuration. -- @param config: the table containing Wezterm configuration.
function module.apply_to_config(config) function module.apply_to_config(config)
config.color_schemes = {} config.color_schemes = {}
config.color_schemes[light_theme] = albino_bark_on_a_tree
config.color_schemes[dark_theme] = bark_on_a_tree -- Thankfully, wezterm can detect fontconfig aliases.
config.font = wezterm.font_with_fallback({
"monospace",
"Noto Color Emoji",
})
-- Desaturate any inactive panes.
config.inactive_pane_hsb = {
saturation = 0.5,
brightness = 0.5,
}
-- Set with my color schemes.
config.color_schemes[dark_theme_metadata.name] = dark_theme
config.color_schemes[light_scheme_metadata.name] = light_scheme
config.color_scheme = scheme_for_appearance() config.color_scheme = scheme_for_appearance()
return config return config

View File

@ -6,9 +6,13 @@ local wezterm = require("wezterm")
function module.apply_to_config(config) function module.apply_to_config(config)
config.default_prog = { "bash" } config.default_prog = { "bash" }
-- I'm liking the workflow I have with Kitty so no thanks for the default -- Quick select-related options. Quite similar to Kitty hints which is
-- shortcuts. So this is what it feels like to be obnoxiously stubborn. -- nice.
config.disable_default_key_bindings = true config.quick_select_patterns = {
"[0-9a-f]{7,40}", -- SHA1 hashes, usually used for Git.
"[0-9a-f]{7,64}", -- SHA256 hashes, used often for getting hashes for Guix packaging.
"sha256-.{44,128}", -- SHA256 hashes in Base64, used often in getting hashes for Nix packaging.
}
-- Don't tease me with the upcoming releases, man. -- Don't tease me with the upcoming releases, man.
config.check_for_updates = false config.check_for_updates = false
@ -17,19 +21,6 @@ function module.apply_to_config(config)
config.enable_wayland = true config.enable_wayland = true
config.force_reverse_video_cursor = true config.force_reverse_video_cursor = true
-- Desaturate any inactive panes.
config.inactive_pane_hsb = {
saturation = 0.5,
brightness = 0.5,
}
-- Thankfully, wezterm can detect fontconfig aliases.
config.font = wezterm.font_with_fallback({
"monospace",
"Noto Color Emoji",
})
config.color_scheme = "Batman"
return config return config
end end

View File

@ -9,13 +9,9 @@ function module.apply_to_config(config)
-- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition. -- I'm very used to setting <SPACE> as the leader so I'm continuing the tradition.
config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 } config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 }
-- Quick select-related options. Quite similar to Kitty hints which is -- I'm liking the workflow I have with Kitty so no thanks for the default
-- nice. -- shortcuts. So this is what it feels like to be obnoxiously stubborn.
config.quick_select_patterns = { config.disable_default_key_bindings = true
"[0-9a-f]{7,40}", -- SHA1 hashes, usually used for Git.
"[0-9a-f]{7,64}", -- SHA256 hashes, used often for getting hashes for Guix packaging.
"sha256-.{44,128}", -- SHA256 hashes in Base64, used often in getting hashes for Nix packaging.
}
config.mouse_bindings = { config.mouse_bindings = {
{ {
@ -182,7 +178,6 @@ function module.apply_to_config(config)
{ key = "Enter", action = "PopKeyTable" }, { key = "Enter", action = "PopKeyTable" },
}, },
} }
return config return config
end end