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 font_size = 16.0 local font = wez.font 'Cousine' cfg.font = font cfg.font_size = font_size cfg.warn_about_missing_glyphs = false end