Skip to content

Commit

Permalink
wezterm: implement theme picker
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaschrstnsn committed Sep 9, 2024
1 parent 30818bf commit eafec04
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
2 changes: 1 addition & 1 deletion home/modules/wezterm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ in
home.packages = with pkgs; [ wezterm ];
home.file = {
".config/wezterm/wezterm.lua".text = replaceStrings
[ ''"FONTSIZE"'' ]
[ ''"FONT_SIZE"'' ]
[ (toString cfg.fontsize) ]
(readFile ./wezterm/wezterm.lua);
};
Expand Down
68 changes: 45 additions & 23 deletions home/modules/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
@@ -1,42 +1,64 @@
local wezterm = require 'wezterm'
local act = wezterm.action

return {
-- https://github.com/rebelot/kanagawa.nvim/blob/master/extras/wezterm.lua
force_reverse_video_cursor = true,
colors = {
foreground = "#dcd7ba",
background = "#1f1f28",
local function setTheme(window, _, _, label)
wezterm.log_info("Switching to: " .. label)
local overrides = window:get_config_overrides() or {}
overrides.color_scheme = label
window:set_config_overrides(overrides)
end

cursor_bg = "#c8c093",
cursor_fg = "#c8c093",
cursor_border = "#c8c093",
local function themePicker(window, pane)
-- get builting color schemes
local schemes = wezterm.get_builtin_color_schemes()
local choices = {}

selection_fg = "#c8c093",
selection_bg = "#2d4f67",
-- populate theme names in choices list
for key, _ in pairs(schemes) do
table.insert(choices, { id = tostring(key), label = tostring(key) })
end

scrollbar_thumb = "#16161d",
split = "#16161d",
-- sort choices list
table.sort(choices, function(c1, c2)
return c1.label < c2.label
end)

ansi = { "#090618", "#c34043", "#76946a", "#c0a36e", "#7e9cd8", "#957fb8", "#6a9589", "#c8c093" },
brights = { "#727169", "#e82424", "#98bb6c", "#e6c384", "#7fb4ca", "#938aa9", "#7aa89f", "#dcd7ba" },
indexed = { [16] = "#ffa066", [17] = "#ff5d62" },
},
window:perform_action(
act.InputSelector {
action = wezterm.action_callback(setTheme),
title = "🎨 Pick a Theme!",
choices = choices,
fuzzy = true,
},
pane
)
end


return {
color_scheme = 'Kanagawa (Gogh)',

font = wezterm.font_with_fallback({
font = wezterm.font_with_fallback({
"JetBrains Mono",
{ family = "Symbols Nerd Font Mono", scale = 0.95 },
}),
font_size = "FONTSIZE",
warn_about_missing_glyphs = false,
font_size = "FONT_SIZE",

keys = {
{ key = "t", mods = "CMD", action = wezterm.action_callback(themePicker) },
{ key = "t", mods = "CMD|SHIFT", action = wezterm.action.ShowDebugOverlay },
},
warn_about_missing_glyphs = false,

window_decorations = 'RESIZE',
window_decorations = 'RESIZE',
hide_tab_bar_if_only_one_tab = true,

visual_bell = {
visual_bell = {
fade_in_function = 'EaseIn',
fade_in_duration_ms = 50,
fade_out_function = 'EaseOut',
fade_out_duration_ms = 50,
},
audible_bell = 'Disabled',
audible_bell = 'Disabled',
}

0 comments on commit eafec04

Please sign in to comment.