From 070c85d9e69c0c585e7f93b51a00bb8e8b3e3a26 Mon Sep 17 00:00:00 2001 From: winston Date: Thu, 4 Aug 2022 05:31:50 +0200 Subject: [PATCH] fix(wezterm): improve handling of linux settings --- dot_config/wezterm/wezterm.lua | 72 +++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/dot_config/wezterm/wezterm.lua b/dot_config/wezterm/wezterm.lua index 8730d15..7844301 100644 --- a/dot_config/wezterm/wezterm.lua +++ b/dot_config/wezterm/wezterm.lua @@ -1,7 +1,46 @@ -- vim:foldmethod=marker:foldlevel=1 local wezterm = require("wezterm") +local function get_os() + local target = wezterm.target_triple + if string.find(target, "linux") then + return "linux" + elseif string.find(target, "darwin") then + return "macos" + else + -- who cares + return "OH GOD PLEASE NO" + end +end + +local opt +if get_os() == "linux" then + opt = { + window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0 + }, + font_size = 14, + sync = false + } +elseif get_os() == "macos" then + opt = { + window_padding = { + left = 2, + right = 2, + top = 2, + bottom = 2 + }, + font_size = 18, + sync = true + } +end + local catppuccin = require("colors/catppuccin/catppuccin").setup({ + sync = opt.sync, + flavour = "mocha", sync_flavours = { light = "latte", dark = "mocha", @@ -143,35 +182,6 @@ wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_wid end) -- }}} -local function get_os() - local target = wezterm.target_triple - if string.find(target, "linux") then - return "linux" - elseif string.find(target, "darwin") then - return "macos" - else - -- who cares - return "OH GOD PLEASE NO" - end -end - -local window_padding = {} -if get_os() == "linux" then - window_padding = { - left = 0, - right = 0, - top = 0, - bottom = 0, - } -elseif get_os() == "macos" then - window_padding = { - left = 2, - right = 2, - top = 2, - bottom = 2, - } -end - local act = wezterm.action return { @@ -222,7 +232,7 @@ return { { key = "v", mods = "LEADER", action = "ActivateCopyMode" }, }, -- font - font_size = 18, + font_size = opt.font_size, font = fonts.victor, use_fancy_tab_bar = false, tab_bar_at_bottom = true, @@ -230,7 +240,7 @@ return { tab_max_width = 32, -- window window_decorations = "RESIZE", - window_padding = window_padding, + window_padding = opt.window_padding, -- theme colors = catppuccin, -- nightly only