1
0
Fork 0

wezterm: set fontsize based on the OS

This commit is contained in:
Von Random 2022-09-07 12:30:45 +03:00
parent 212be32916
commit e3541b2bec

View file

@ -1,4 +1,7 @@
local wt = require 'wezterm' local wt = require 'wezterm'
local fontsize_darwin = 15
local fontsize_others = 12
local theme_n = 0
local theme = local theme =
'PencilDark' 'PencilDark'
local themes = { local themes = {
@ -26,7 +29,6 @@ local themes = {
'Material (terminal.sexy)', -- unusual combination, balanced 'Material (terminal.sexy)', -- unusual combination, balanced
'Medallion', -- quite fun reddish theme, dark 'Medallion', -- quite fun reddish theme, dark
'MonaLisa', -- impressively good, but very red and dark 'MonaLisa', -- impressively good, but very red and dark
'Neopolitan', -- lovely blue, shitty contrast
'Parker Brothers (terminal.sexy)', -- unique but kinda dark 'Parker Brothers (terminal.sexy)', -- unique but kinda dark
'PaulMillr', -- bright and clear 'PaulMillr', -- bright and clear
'PencilDark', -- very nice, matches PencilColors 'PencilDark', -- very nice, matches PencilColors
@ -36,7 +38,6 @@ local webinar_overrides = {
color_scheme = 'PencilLight', color_scheme = 'PencilLight',
} }
local theme_n = 0
function switch_theme(number, window) function switch_theme(number, window)
theme_n = theme_n + number theme_n = theme_n + number
if theme_n < 1 then theme_n = #themes end if theme_n < 1 then theme_n = #themes end
@ -44,6 +45,12 @@ function switch_theme(number, window)
window:set_config_overrides { color_scheme = themes[theme_n] } window:set_config_overrides { color_scheme = themes[theme_n] }
end end
function set_fontsize()
local execfile = os.getenv('WEZTERM_EXECUTABLE')
if string.match(execfile, 'MacOS') then return fontsize_darwin end
return fontsize_others
end
wt.on('update-right-status', function(window, pane) wt.on('update-right-status', function(window, pane)
local theme_info = string.format( local theme_info = string.format(
'%s %s ', wt.nerdfonts.fa_terminal, '%s %s ', wt.nerdfonts.fa_terminal,
@ -57,7 +64,7 @@ wt.on('reset-theme', function(window) window:set_config_overrides() end)
wt.on('webinar', function(window) window:set_config_overrides(webinar_overrides) end) wt.on('webinar', function(window) window:set_config_overrides(webinar_overrides) end)
return { return {
font_size = 15, font_size = set_fontsize(),
color_scheme = theme, color_scheme = theme,
cursor_blink_rate = 0, cursor_blink_rate = 0,
check_for_updates = false, check_for_updates = false,