local wez = require 'wezterm' local codefont = require 'bugabinga.code_font' wez.on( 'inc-font-size', function ( window ) local size = window:effective_config().font_size + 1 local overrides = window:get_config_overrides() or {} overrides.font_size = size window:set_config_overrides( overrides ) end ) wez.on( 'dec-font-size', function ( window ) local size = window:effective_config().font_size - 1 local overrides = window:get_config_overrides() or {} overrides.font_size = size window:set_config_overrides( overrides ) end ) wez.on( 'reset-font-size', function ( window ) local size = nil local overrides = window:get_config_overrides() or {} overrides.font_size = size window:set_config_overrides( overrides ) end ) wez.on( 'random-codefont', function ( window ) local random_font = codefont.random() local overrides = window:get_config_overrides() or {} overrides.font = random_font window:set_config_overrides( overrides ) end ) wez.on( 'change-font-size', function ( window, pane ) local font_sizes = {} for size = 8, 32 do table.insert( font_sizes, { id = tostring( size ), label = ' ' .. size, } ) end window:perform_action( wez.action.InputSelector { action = wez.action_callback( function ( win, _, id, label ) if not id and not label then window:toast_notification( 'font', 'Cancelled font size selection!', nil, 500 ) return end local overrides = win:get_config_overrides() or {} overrides.font_size = tonumber( id ) window:set_config_overrides( overrides ) window:toast_notification( 'font', 'Font set to size ' .. label, nil, 500 ) end ), title = 'Select font size', choices = font_sizes, alphabet = '1234567890', description = 'Pick the font size to apply to wezterm.', fuzzy = true, }, pane ) end ) return function ( cfg ) local harfbuzz_features = { 'calt', 'liga', 'dlig', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', } local font = wez.font { family = 'Monaspace Neon Var', weight = 'Medium', harfbuzz_features = harfbuzz_features, } local font_rules = { { -- Normal intensity = 'Normal', italic = false, font = wez.font { family = 'Monaspace Neon Var', weight = 'Medium', harfbuzz_features = harfbuzz_features, }, }, { -- Bold intensity = 'Bold', italic = false, font = wez.font { family = 'Monaspace Argon Var', weight = 'ExtraBold', harfbuzz_features = harfbuzz_features, }, }, { -- Half intensity = 'Half', italic = false, font = wez.font { family = 'Monaspace Krypton Var', weight = 'Book', harfbuzz_features = harfbuzz_features, }, }, { -- Normal italic intensity = 'Normal', italic = true, font = wez.font { family = 'Monaspace Argon Var', weight = 'Regular', style = 'Italic', harfbuzz_features = harfbuzz_features, }, }, { -- Bold italic intensity = 'Bold', italic = true, font = wez.font { family = 'Monaspace Argon Var', weight = 'DemiBold', style = 'Italic', harfbuzz_features = harfbuzz_features, }, }, { -- Half italic intensity = 'Half', italic = true, font = wez.font { family = 'Monaspace Argon Var', weight = 'Thin', style = 'Italic', harfbuzz_features = hrfbuzz_features, }, }, } cfg.font = font cfg.freetype_load_flags = 'NO_HINTING' cfg.font_shaper = 'Harfbuzz' cfg.font_size = 12.0 cfg.font_rules = font_rules cfg.underline_position = '142%' cfg.warn_about_missing_glyphs = false end