2023-03-22 11:20:01 +00:00
|
|
|
-- This module should set the appearance-related options.
|
|
|
|
local module = {}
|
|
|
|
|
|
|
|
local wezterm = require("wezterm")
|
|
|
|
|
2025-01-29 04:38:17 +00:00
|
|
|
-- This has to be setup outside of this configuration. I don't want to have the
|
|
|
|
-- same code fetching the colors all over various config files.
|
2024-01-20 05:56:37 +00:00
|
|
|
local xdg_data_home = os.getenv("XDG_DATA_HOME") or "~/.local/share"
|
|
|
|
local theme_dir = xdg_data_home .. "/base16/bark-on-a-tree"
|
2023-04-03 02:07:47 +00:00
|
|
|
local light_scheme, light_scheme_metadata =
|
2024-09-08 04:22:14 +00:00
|
|
|
wezterm.color.load_base16_scheme(theme_dir .. "/albino-bark-on-a-tree.yaml")
|
2023-04-03 02:07:47 +00:00
|
|
|
local dark_theme, dark_theme_metadata =
|
2024-09-08 04:22:14 +00:00
|
|
|
wezterm.color.load_base16_scheme(theme_dir .. "/bark-on-a-tree.yaml")
|
2023-03-22 11:20:01 +00:00
|
|
|
|
|
|
|
local function scheme_for_appearance()
|
2024-01-20 05:56:37 +00:00
|
|
|
-- We're just following the default XDG appearance spec.
|
2023-03-22 11:20:01 +00:00
|
|
|
local scheme = wezterm.gui.get_appearance()
|
|
|
|
if scheme == "Dark" then
|
2023-04-03 02:07:47 +00:00
|
|
|
return dark_theme_metadata.name
|
2023-03-22 11:20:01 +00:00
|
|
|
else
|
2023-04-03 02:07:47 +00:00
|
|
|
return light_scheme_metadata.name
|
2023-03-22 11:20:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-03 02:07:47 +00:00
|
|
|
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
|
2023-03-22 11:20:01 +00:00
|
|
|
|
|
|
|
--- Apply the configuration with the given table.
|
|
|
|
-- @param config: the table containing Wezterm configuration.
|
|
|
|
function module.apply_to_config(config)
|
|
|
|
config.color_schemes = {}
|
2023-04-03 02:07:47 +00:00
|
|
|
|
2023-10-28 04:37:26 +00:00
|
|
|
config.font_size = 16
|
2023-07-02 09:18:03 +00:00
|
|
|
|
2023-04-03 02:07:47 +00:00
|
|
|
-- Thankfully, wezterm can detect fontconfig aliases.
|
2023-09-05 22:55:12 +00:00
|
|
|
config.font = wezterm.font_with_fallback({
|
2023-04-03 02:07:47 +00:00
|
|
|
"monospace",
|
|
|
|
"Noto Color Emoji",
|
2023-09-05 22:55:12 +00:00
|
|
|
})
|
2023-04-03 02:07:47 +00:00
|
|
|
|
|
|
|
-- 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
|
2023-03-22 11:20:01 +00:00
|
|
|
config.color_scheme = scheme_for_appearance()
|
|
|
|
|
2023-07-25 10:25:22 +00:00
|
|
|
config.command_palette_fg_color = config.color_schemes[config.color_scheme].foreground
|
|
|
|
config.command_palette_bg_color = config.color_schemes[config.color_scheme].background
|
|
|
|
config.command_palette_font_size = config.font_size
|
|
|
|
|
2023-07-02 09:18:03 +00:00
|
|
|
-- Disable some annoying mouse thingies.
|
|
|
|
config.hide_mouse_cursor_when_typing = false
|
|
|
|
config.pane_focus_follows_mouse = true
|
|
|
|
|
|
|
|
-- Disable some more annoyances.
|
2023-07-08 03:36:55 +00:00
|
|
|
config.enable_tab_bar = true
|
2024-09-08 04:22:14 +00:00
|
|
|
config.tab_bar_at_bottom = false
|
2025-01-29 04:38:17 +00:00
|
|
|
config.window_decorations = "NONE"
|
2023-07-08 03:36:55 +00:00
|
|
|
|
|
|
|
-- Configuring the appearance of the tab bar.
|
|
|
|
config.window_frame = {
|
|
|
|
font = config.font,
|
|
|
|
font_size = config.font_size - 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Configuring the windows padding.
|
|
|
|
config.window_padding = {
|
|
|
|
left = 0,
|
2025-01-29 04:38:17 +00:00
|
|
|
right = '1cell',
|
2023-07-08 03:36:55 +00:00
|
|
|
top = 0,
|
|
|
|
bottom = 0,
|
|
|
|
}
|
2023-07-02 09:18:03 +00:00
|
|
|
|
2023-03-22 11:20:01 +00:00
|
|
|
return config
|
|
|
|
end
|
|
|
|
|
|
|
|
return module
|