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 light_theme = "Albino bark on a tree"
local dark_theme = "Bark on a tree"
local light_scheme, light_scheme_metadata =
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 scheme = wezterm.gui.get_appearance()
if scheme == "Dark" then
return dark_theme
return dark_theme_metadata.name
else
return light_theme
return light_scheme_metadata.name
end
end
local albino_bark_on_a_tree =
wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/albino-bark-on-a-tree.yaml")
local bark_on_a_tree =
wezterm.color.load_base16_scheme(os.getenv("HOME") .. "/library/dotfiles/base16/bark-on-a-tree.yaml")
function module.add_base16_scheme_to_config(path, config)
local scheme, metadata = wezterm.color.load_base16_scheme(path)
config.color_schemes[metadata.name] = scheme
return config
end
--- Apply the configuration with the given table.
-- @param config: the table containing Wezterm configuration.
function module.apply_to_config(config)
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()
return config

View File

@ -6,9 +6,13 @@ local wezterm = require("wezterm")
function module.apply_to_config(config)
config.default_prog = { "bash" }
-- I'm liking the workflow I have with Kitty so no thanks for the default
-- shortcuts. So this is what it feels like to be obnoxiously stubborn.
config.disable_default_key_bindings = true
-- Quick select-related options. Quite similar to Kitty hints which is
-- nice.
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.
config.check_for_updates = false
@ -17,19 +21,6 @@ function module.apply_to_config(config)
config.enable_wayland = 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
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.
config.leader = { key = "Space", mods = keymod, timeout_milliseconds = 1000 }
-- Quick select-related options. Quite similar to Kitty hints which is
-- nice.
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.
}
-- I'm liking the workflow I have with Kitty so no thanks for the default
-- shortcuts. So this is what it feels like to be obnoxiously stubborn.
config.disable_default_key_bindings = true
config.mouse_bindings = {
{
@ -182,7 +178,6 @@ function module.apply_to_config(config)
{ key = "Enter", action = "PopKeyTable" },
},
}
return config
end