Show your wezterms #628
Replies: 50 comments 62 replies
-
Would be great to see wezterm.lua along with picture. |
Beta Was this translation helpful? Give feedback.
-
Thats a good Idea. Will update |
Beta Was this translation helpful? Give feedback.
-
Here's mine! |
Beta Was this translation helpful? Give feedback.
-
Thx for your cool term 👍 , the below is my quick config to work on wsl2 mainly local wezterm = require 'wezterm';
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
-- Configs for Windows only
-- font_dirs = {
-- 'C:\\Users\\whoami\\.dotfiles\\.fonts'
-- }
default_prog = {'wsl.exe', '~', '-d', 'Ubuntu-20.04'}
end
if wezterm.target_triple == 'x86_64-apple-darwin' then
-- Configs for OSX only
-- font_dirs = { '$HOME/.dotfiles/.fonts' }
end
if wezterm.target_triple == 'x86_65-unknown-linux-gnu' then
-- Configs for Linux only
-- font_dirs = { '$HOME/.dotfiles/.fonts' }
end
return {
default_prog = default_prog,
hide_tab_bar_if_only_one_tab = true,
-- Do not hold on exit by default.
-- Because the default 'CloseOnCleanExit' can be annoying when exiting with
-- Ctrl-D and the last command exited with non-zero: the shell will exit
-- with non-zero and the terminal would hang until the window is closed manually.
exit_behavior = 'Close',
-- Pad window to avoid the content to be too close to the border,
-- so it's easier to see and select.
window_padding = {
left = 3, right = 3,
top = 3, bottom = 3,
},
inactive_pane_hsb = {
saturation = 0.9,
brightness = 0.8,
},
-- Fonts
font_size = 12,
line_height = 1.1,
font = wezterm.font('Iosevka Fixed', { stretch = 'Expanded', weight = 'Light' }),
}
|
Beta Was this translation helpful? Give feedback.
-
Playing with random colors. wezterm.luamath.randomseed(os.time())
local hue = math.random(0, 360);
return {
window_background_gradient = {
colors = {string.format("hwb(%f,%f%%,0%%)", hue, math.random(25, 40)), string.format("hwb(%f,0%%,%f%%)", hue, math.random(70, 100))},
blend = "Oklab",
orientation = {
Radial = {
cx = 0.8,
cy = 0.8,
radius = 1.2,
}
},
}
} |
Beta Was this translation helpful? Give feedback.
-
Feature:
https://github.com/azzamsa/dotfiles/blob/master/wezterm/.config/wezterm/wezterm.lua |
Beta Was this translation helpful? Give feedback.
-
Features
|
Beta Was this translation helpful? Give feedback.
-
wezterm.lualocal wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0ba)
local SOLID_LEFT_MOST = utf8.char(0x2588)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0bc)
local ADMIN_ICON = utf8.char(0xf49c)
local CMD_ICON = utf8.char(0xe62a)
local NU_ICON = utf8.char(0xe7a8)
local PS_ICON = utf8.char(0xe70f)
local ELV_ICON = utf8.char(0xfc6f)
local WSL_ICON = utf8.char(0xf83c)
local YORI_ICON = utf8.char(0xf1d4)
local NYA_ICON = utf8.char(0xf61a)
local VIM_ICON = utf8.char(0xe62b)
local SUP_IDX = {"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","¹⁰",
"¹¹","¹²","¹³","¹⁴","¹⁵","¹⁶","¹⁷","¹⁸","¹⁹","²⁰"}
local SUB_IDX = {"₁","₂","₃","₄","₅","₆","₇","₈","₉","₁₀",
"₁₁","₁₂","₁₃","₁₄","₁₅","₁₆","₁₇","₁₈","₁₉","₂₀"}
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local edge_background = "#121212"
local background = "#4E4E4E"
local foreground = "#1C1B19"
local dim_foreground = "#3A3A3A"
if tab.is_active then
background = "#FBB829"
foreground = "#1C1B19"
elseif hover then
background = "#FF8700"
foreground = "#1C1B19"
end
local edge_foreground = background
local shell_cmd, shell_name
if tab.active_pane.title:find("nvim") then
shell_cmd = ""
shell_name = VIM_ICON .. tab.active_pane.title:gsub("^(%S+)%s+(%d+/%d+) %- nvim", " %2 %1")
elseif tab.active_pane.title:find("NYAGOS") then
shell_cmd = tab.active_pane.title
shell_name = NYA_ICON .. " " .. shell_cmd:gsub(".*: (.+) %- .+", "%1")
elseif tab.active_pane.title:find("Yori") then
shell_cmd = tab.active_pane.title:gsub(" %- Yori", "")
shell_name = YORI_ICON .. " " .. shell_cmd
else
shell_cmd, shell_name = tab.active_pane.title:match("^(.*\\(%w+)%.exe)")
end
local real_title = tab.active_pane.title:match(".*\\cmd%.exe %- (.+)$") or "CMD"
local clean_title
if shell_name == "nu" then
clean_title = NU_ICON .. " NuShell"
elseif shell_name == "pwsh" then
clean_title = PS_ICON .. " PS"
elseif shell_name == "cmd" then
clean_title = CMD_ICON .. " " .. real_title
elseif shell_name == "elvish" then
clean_title = ELV_ICON .. " Elvish"
elseif shell_name == "wsl" then
clean_title = WSL_ICON .. " WSL"
else
clean_title = shell_name
end
if shell_cmd and shell_cmd:match("Administrator: ") then
clean_title = clean_title .. " " .. ADMIN_ICON
end
local left_arrow = SOLID_LEFT_ARROW
if tab.tab_index == 0 then
left_arrow = SOLID_LEFT_MOST
end
local id = SUB_IDX[tab.tab_index+1]
local pid = SUP_IDX[tab.active_pane.pane_index+1]
local title = " " .. wezterm.truncate_right(clean_title, max_width-6) .. " "
return {
{Attribute={Intensity="Bold"}},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=left_arrow},
{Background={Color=background}},
{Foreground={Color=foreground}},
{Text=id},
{Text=title},
{Foreground={Color=dim_foreground}},
{Text=pid},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=SOLID_RIGHT_ARROW},
{Attribute={Intensity="Normal"}},
}
end)
return {
color_scheme = "srcery",
font_dirs = {"fonts"},
font_size = 11.0,
dpi = 96.0,
freetype_load_target = "Normal",
font = wezterm.font_with_fallback({
"Iosevka Mayukai Codepro",
"Sarasa Mono Slab CL"
}),
tab_max_width = 60,
enable_scroll_bar = true,
exit_behavior = "Close",
window_background_opacity = 0.94,
default_prog = {"nu.exe"},
set_environment_variables = {
LANG = "en_US.UTF-8",
PATH = "D:/dev_env/WezTerm;" .. os.getenv("PATH"),
},
colors = {
tab_bar = {
background = "#121212",
new_tab = {bg_color = "#121212", fg_color = "#FCE8C3", intensity = "Bold"},
new_tab_hover = {bg_color = "#121212", fg_color = "#FBB829", intensity = "Bold"},
active_tab = {bg_color = "#121212", fg_color = "#FCE8C3"},
}
},
window_background_gradient = {
orientation = "Vertical",
interpolation = "Linear",
blend = "Rgb",
colors = {
"#121212",
"#202020"
}
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
launch_menu = {
{
label = "Bottom",
args = {"btm.exe"},
},
{
label = "ntop",
args = {"ntop.exe"},
},
{
label = "Cmder",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0"},
},
{
label = "Pwsh",
args = {"pwsh.exe", "-nol", "-noe"},
},
{
label = "NyaGOS",
args = {"nyagos.exe", "--glob"},
},
{
label = "NuShell",
args = {"nu.exe"},
},
{
label = "Elvish",
args = {"elvish.exe"},
},
{
label = "Yori",
args = {"yori.exe"},
},
{
label = "VS",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0", "/VS"},
},
{
label = "PSVS",
args = {"pwsh.exe", "-noe", "-c", "&{Import-Module \"D:\\dev_env\\vs\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 1c952f20}"},
}
},
disable_default_key_bindings = true,
leader = { key="`"},
keys = {
{key="Tab", mods="CTRL", action=wezterm.action{ActivateTabRelative=1}},
{key="Tab", mods="CTRL|SHIFT", action=wezterm.action{ActivateTabRelative=-1}},
{key="Enter", mods="ALT", action="ToggleFullScreen"},
{key="Insert", mods="SHIFT", action=wezterm.action{PasteFrom="PrimarySelection"}},
{key="Insert", mods="CTRL", action=wezterm.action{CopyTo="PrimarySelection"}},
{key="v", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="s", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="h", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Left"}},
{key="l", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Right"}},
{key="j", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Down"}},
{key="k", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Up"}},
{key="z", mods="LEADER", action="TogglePaneZoomState"},
{key="/", mods="LEADER", action=wezterm.action{Search={CaseInSensitiveString=""}}},
{key="q", mods="LEADER", action="QuickSelect"},
{key="1", mods="LEADER", action=wezterm.action{ActivateTab=0}},
{key="2", mods="LEADER", action=wezterm.action{ActivateTab=1}},
{key="3", mods="LEADER", action=wezterm.action{ActivateTab=2}},
{key="4", mods="LEADER", action=wezterm.action{ActivateTab=3}},
{key="5", mods="LEADER", action=wezterm.action{ActivateTab=4}},
{key="6", mods="LEADER", action=wezterm.action{ActivateTab=5}},
{key="7", mods="LEADER", action=wezterm.action{ActivateTab=6}},
{key="8", mods="LEADER", action=wezterm.action{ActivateTab=7}},
{key="9", mods="LEADER", action=wezterm.action{ActivateTab=8}},
{key="o", mods="LEADER", action="ActivateLastTab"},
{key="g", mods="LEADER", action="ShowTabNavigator"},
{key="c", mods="LEADER", action="ShowLauncher"},
{key="r", mods="LEADER", action="ReloadConfiguration"},
{key="x", mods="LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="x", mods="LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
{key="`", mods="LEADER", action=wezterm.action{SendString="`"}},
}
} Improved Version:local wezterm = require 'wezterm';
-- Equivalent to POSIX basename(3)
-- Given "/foo/bar" returns "bar"
-- Given "c:\\foo\\bar" returns "bar"
local function basename(s)
return string.gsub(s, "(.*[/\\])(.*)", "%2")
end
local SOLID_LEFT_ARROW = utf8.char(0xe0ba)
local SOLID_LEFT_MOST = utf8.char(0x2588)
local SOLID_RIGHT_ARROW = utf8.char(0xe0bc)
local ADMIN_ICON = utf8.char(0xf49c)
local CMD_ICON = utf8.char(0xe62a)
local NU_ICON = utf8.char(0xe7a8)
local PS_ICON = utf8.char(0xe70f)
local ELV_ICON = utf8.char(0xfc6f)
local WSL_ICON = utf8.char(0xf83c)
local YORI_ICON = utf8.char(0xf1d4)
local NYA_ICON = utf8.char(0xf61a)
local VIM_ICON = utf8.char(0xe62b)
local PAGER_ICON = utf8.char(0xf718)
local FUZZY_ICON = utf8.char(0xf0b0)
local HOURGLASS_ICON = utf8.char(0xf252)
local SUNGLASS_ICON = utf8.char(0xf9df)
local PYTHON_ICON = utf8.char(0xf820)
local NODE_ICON = utf8.char(0xe74e)
local DENO_ICON = utf8.char(0xe628)
local LAMBDA_ICON = utf8.char(0xfb26)
local SUP_IDX = {"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","¹⁰",
"¹¹","¹²","¹³","¹⁴","¹⁵","¹⁶","¹⁷","¹⁸","¹⁹","²⁰"}
local SUB_IDX = {"₁","₂","₃","₄","₅","₆","₇","₈","₉","₁₀",
"₁₁","₁₂","₁₃","₁₄","₁₅","₁₆","₁₇","₁₈","₁₉","₂₀"}
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local edge_background = "#121212"
local background = "#4E4E4E"
local foreground = "#1C1B19"
local dim_foreground = "#3A3A3A"
if tab.is_active then
background = "#FBB829"
foreground = "#1C1B19"
elseif hover then
background = "#FF8700"
foreground = "#1C1B19"
end
local edge_foreground = background
local process_name = tab.active_pane.foreground_process_name
local pane_title = tab.active_pane.title
local exec_name = basename(process_name):gsub("%.exe$", "")
local title_with_icon
if exec_name == "nu" then
title_with_icon = NU_ICON .. " NuShell"
elseif exec_name == "pwsh" then
title_with_icon = PS_ICON .. " PS"
elseif exec_name == "cmd" then
title_with_icon = CMD_ICON .. " CMD"
elseif exec_name == "elvish" then
title_with_icon = ELV_ICON .. " Elvish"
elseif exec_name == "wsl" or exec_name == "wslhost" then
title_with_icon = WSL_ICON .. " WSL"
elseif exec_name == "nyagos" then
title_with_icon = NYA_ICON .. " " .. pane_title:gsub(".*: (.+) %- .+", "%1")
elseif exec_name == "yori" then
title_with_icon = YORI_ICON .. " " .. pane_title:gsub(" %- Yori", "")
elseif exec_name == "nvim" then
title_with_icon = VIM_ICON .. pane_title:gsub("^(%S+)%s+(%d+/%d+) %- nvim", " %2 %1")
elseif exec_name == "bat" or exec_name == "less" or exec_name == "moar" then
title_with_icon = PAGER_ICON .. " " .. exec_name:upper()
elseif exec_name == "fzf" or exec_name == "hs" or exec_name == "peco" then
title_with_icon = FUZZY_ICON .. " " .. exec_name:upper()
elseif exec_name == "btm" or exec_name == "ntop" then
title_with_icon = SUNGLASS_ICON .. " " .. exec_name:upper()
elseif exec_name == "python" or exec_name == "hiss" then
title_with_icon = PYTHON_ICON .. " " .. exec_name
elseif exec_name == "node" then
title_with_icon = NODE_ICON .. " " .. exec_name:upper()
elseif exec_name == "deno" then
title_with_icon = DENO_ICON .. " " .. exec_name:upper()
elseif exec_name == "bb" or exec_name == "cmd-clj" or exec_name == "janet" or exec_name == "hy" then
title_with_icon = LAMBDA_ICON .. " " .. exec_name:gsub("bb", "Babashka"):gsub("cmd%-clj", "Clojure")
else
title_with_icon = HOURGLASS_ICON .. " " .. exec_name
end
if pane_title:match("^Administrator: ") then
title_with_icon = title_with_icon .. " " .. ADMIN_ICON
end
local left_arrow = SOLID_LEFT_ARROW
if tab.tab_index == 0 then
left_arrow = SOLID_LEFT_MOST
end
local id = SUB_IDX[tab.tab_index+1]
local pid = SUP_IDX[tab.active_pane.pane_index+1]
local title = " " .. wezterm.truncate_right(title_with_icon, max_width-6) .. " "
return {
{Attribute={Intensity="Bold"}},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=left_arrow},
{Background={Color=background}},
{Foreground={Color=foreground}},
{Text=id},
{Text=title},
{Foreground={Color=dim_foreground}},
{Text=pid},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=SOLID_RIGHT_ARROW},
{Attribute={Intensity="Normal"}},
}
end)
return {
color_scheme = "srcery",
font_dirs = {"fonts"},
font_size = 11.0,
dpi = 96.0,
freetype_load_target = "Normal",
font = wezterm.font_with_fallback({
"Iosevka Mayukai Codepro",
"Sarasa Mono Slab CL"
}),
tab_max_width = 60,
enable_scroll_bar = true,
use_fancy_tab_bar = false,
window_background_opacity = 0.94,
default_prog = {"nu.exe"},
set_environment_variables = {
LANG = "en_US.UTF-8",
PATH = wezterm.executable_dir .. ";" .. os.getenv("PATH"),
},
colors = {
tab_bar = {
background = "#121212",
new_tab = {bg_color = "#121212", fg_color = "#FCE8C3", intensity = "Bold"},
new_tab_hover = {bg_color = "#121212", fg_color = "#FBB829", intensity = "Bold"},
active_tab = {bg_color = "#121212", fg_color = "#FCE8C3"},
}
},
window_background_gradient = {
orientation = "Vertical",
interpolation = "Linear",
blend = "Rgb",
colors = {
"#121212",
"#202020"
}
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
launch_menu = {
{
label = "Bottom",
args = {"btm.exe"},
},
{
label = "ntop",
args = {"ntop.exe"},
},
{
label = "Cmder",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0"},
},
{
label = "Pwsh",
args = {"pwsh.exe", "-nol", "-noe"},
},
{
label = "NyaGOS",
args = {"nyagos.exe", "--glob"},
},
{
label = "NuShell",
args = {"nu.exe"},
},
{
label = "Elvish",
args = {"elvish.exe"},
},
{
label = "Yori",
args = {"yori.exe"},
},
{
label = "VS",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0", "/VS"},
},
{
label = "PSVS",
args = {"pwsh.exe", "-noe", "-c", "&{Import-Module \"D:\\dev_env\\vs\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 1c952f20}"},
}
},
disable_default_key_bindings = true,
leader = { key="`"},
keys = {
{key="Tab", mods="CTRL", action=wezterm.action{ActivateTabRelative=1}},
{key="Tab", mods="CTRL|SHIFT", action=wezterm.action{ActivateTabRelative=-1}},
{key="Enter", mods="ALT", action="ToggleFullScreen"},
{key="Insert", mods="SHIFT", action=wezterm.action{PasteFrom="PrimarySelection"}},
{key="Insert", mods="CTRL", action=wezterm.action{CopyTo="PrimarySelection"}},
{key="v", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="s", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="h", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Left"}},
{key="l", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Right"}},
{key="j", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Down"}},
{key="k", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Up"}},
{key="z", mods="LEADER", action="TogglePaneZoomState"},
{key="/", mods="LEADER", action=wezterm.action{Search={CaseInSensitiveString=""}}},
{key="q", mods="LEADER", action="QuickSelect"},
{key="1", mods="LEADER", action=wezterm.action{ActivateTab=0}},
{key="2", mods="LEADER", action=wezterm.action{ActivateTab=1}},
{key="3", mods="LEADER", action=wezterm.action{ActivateTab=2}},
{key="4", mods="LEADER", action=wezterm.action{ActivateTab=3}},
{key="5", mods="LEADER", action=wezterm.action{ActivateTab=4}},
{key="6", mods="LEADER", action=wezterm.action{ActivateTab=5}},
{key="7", mods="LEADER", action=wezterm.action{ActivateTab=6}},
{key="8", mods="LEADER", action=wezterm.action{ActivateTab=7}},
{key="9", mods="LEADER", action=wezterm.action{ActivateTab=8}},
{key="o", mods="LEADER", action="ActivateLastTab"},
{key="g", mods="LEADER", action="ShowTabNavigator"},
{key="c", mods="LEADER", action="ShowLauncher"},
{key="r", mods="LEADER", action="ReloadConfiguration"},
{key="x", mods="LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="x", mods="LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
{key="`", mods="LEADER", action=wezterm.action{SendString="`"}},
}
} |
Beta Was this translation helpful? Give feedback.
-
If you are fan of these plugins, you might want to check https://github.com/aca/wezterm.nvim
|
Beta Was this translation helpful? Give feedback.
-
I made an airline-like tab bar. Yet-to-do:
Very happy to read feedback and improvements wezterm.lualocal wezterm = require 'wezterm'
local function font_with_fallback(name, params)
local names = { name, "Noto Color Emoji", "FiraCode Nerd Font" }
return wezterm.font_with_fallback(names, params)
end
-- local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
local Grey = "#0f1419"
local LightGrey = "#191f26"
local TAB_BAR_BG = "Black"
local ACTIVE_TAB_BG = "Yellow"
local ACTIVE_TAB_FG = "Black"
local HOVER_TAB_BG = Grey
local HOVER_TAB_FG = "White"
local NORMAL_TAB_BG = LightGrey
local NORMAL_TAB_FG = "White"
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
panes = panes
config = config
max_width = max_width
local background = NORMAL_TAB_BG
local foreground = NORMAL_TAB_FG
local is_first = tab.tab_id == tabs[1].tab_id
local is_last = tab.tab_id == tabs[#tabs].tab_id
if tab.is_active then
background = ACTIVE_TAB_BG
foreground = ACTIVE_TAB_FG
elseif hover then
background = HOVER_TAB_BG
foreground = HOVER_TAB_FG
end
local leading_fg = NORMAL_TAB_FG
local leading_bg = background
local trailing_fg = background
local trailing_bg = NORMAL_TAB_BG
if is_first then
leading_fg = TAB_BAR_BG
else
leading_fg = NORMAL_TAB_BG
end
if is_last then
trailing_bg = TAB_BAR_BG
else
trailing_bg = NORMAL_TAB_BG
end
local title = tab.active_pane.title
-- broken?
-- local title = " " .. wezterm.truncate_to_width(tab.active_pane.title, 30) .. " "
return {
{Attribute={Italic=false}},
{Attribute={Intensity=hover and "Bold" or "Normal"}},
{Background={Color=leading_bg}}, {Foreground={Color=leading_fg}},
{Text=SOLID_RIGHT_ARROW},
{Background={Color=background}}, {Foreground={Color=foreground}},
{Text=" "..title.." "},
{Background={Color=trailing_bg}}, {Foreground={Color=trailing_fg}},
{Text=SOLID_RIGHT_ARROW},
}
end)
return {
window_decorations = "RESIZE",
native_macos_fullscreen_mode = true,
hide_tab_bar_if_only_one_tab = true,
tab_bar_at_bottom = true,
use_fancy_tab_bar = false,
enable_tab_bar = true,
tab_max_width = 32,
leader = { key="b", mods="CTRL", timeout_milliseconds=1000 },
inactive_pane_hsb = {
saturation = 0.5,
brightness = 0.5,
},
color_scheme = "duskfox",
colors = {
tab_bar = {
background = TAB_BAR_BG,
},
},
tab_bar_style = {
new_tab = wezterm.format{
{Background={Color=HOVER_TAB_BG}}, {Foreground={Color=TAB_BAR_BG}}, {Text=SOLID_RIGHT_ARROW}, {Background={Color=HOVER_TAB_BG}}, {Foreground={Color=HOVER_TAB_FG}},
{Text=" + "},
{Background={Color=TAB_BAR_BG}}, {Foreground={Color=HOVER_TAB_BG}}, {Text=SOLID_RIGHT_ARROW},
},
new_tab_hover = wezterm.format{
{Attribute={Italic=false}},
{Attribute={Intensity="Bold"}},
{Background={Color=NORMAL_TAB_BG}}, {Foreground={Color=TAB_BAR_BG}}, {Text=SOLID_RIGHT_ARROW}, {Background={Color=NORMAL_TAB_BG}}, {Foreground={Color=NORMAL_TAB_FG}},
{Text=" + "},
{Background={Color=TAB_BAR_BG}}, {Foreground={Color=NORMAL_TAB_BG}}, {Text=SOLID_RIGHT_ARROW},
},
},
keys = {
{ key="-", mods="SUPER", action=wezterm.action{ SplitVertical={ domain="CurrentPaneDomain" } } },
{ key="\\", mods="SUPER", action=wezterm.action{ SplitHorizontal={ domain="CurrentPaneDomain" } } },
{ key="h", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Left" } },
{ key="l", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Right" } },
{ key="j", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Down" } },
{ key="k", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Up" } },
{ key="w", mods="SUPER", action=wezterm.action{ CloseCurrentPane={confirm=true} } },
},
font = font_with_fallback("FiraCode Nerd Font"),
font_rules = {
{ -- BOLD
intensity = "Bold",
weight = "Bold",
font = font_with_fallback("FiraCode Nerd Font", { weight = "Bold" }),
},
{ -- ITALIC
italic = true,
weight = "Light",
font = font_with_fallback("Operator Mono SSm Lig", { italic = true }),
},
{ -- BOLD ITALIC
italic = true,
intensity = "Bold",
weight = "Book",
font = font_with_fallback("Operator Mono SSm Lig", { weight = "Bold", italic = true }),
},
{ -- LIGHT
intensity = "Half",
weight = "Light",
font = font_with_fallback("Operator Mono SSm Lig"),
},
},
}
|
Beta Was this translation helpful? Give feedback.
-
Code is here.: https://github.com/jtsagata/Autodot/blob/master/configs/wterm/get_weather |
Beta Was this translation helpful? Give feedback.
-
Somewhat complete with background image cycler |
Beta Was this translation helpful? Give feedback.
-
config: https://github.com/yutkat/dotfiles/tree/main/.config/wezterm |
Beta Was this translation helpful? Give feedback.
-
I've created a tab-bar plugin that should work with all color schemes. A bit unorthodox way to display tabs, but I like it. The plugin can be found here |
Beta Was this translation helpful? Give feedback.
-
Some what finalized my setup, config here |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
And my dotfiles containing wezterm.lua. |
Beta Was this translation helpful? Give feedback.
-
I don't see anyone show git on status bar so I did it myself. I'm used to have git status on statusbar in tmux. |
Beta Was this translation helpful? Give feedback.
-
Can anyone help me out with a config to make my wz look like this |
Beta Was this translation helpful? Give feedback.
-
Here's my use-case:
(Note: everything is very much alpha) ~/.config/westerm/westerm.luathe main config with some modular structure. local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.automatically_reload_config = true
require('appearence').apply(config)
require('colors-wezterm').apply(config)
return config ~/.config/westerm/appearence.lua
local wezterm = require 'wezterm'
local colors = require('colors-wezterm')
local module = {}
function module.apply(config)
config.dpi = 120
config.font_size = 9.0
-- config.font = wezterm.font 'FiraCode Nerd Font Propo'
config.font = wezterm.font_with_fallback {
'FiraCode Nerd Font Propo',
'Fira Code',
'Fira Code',
'Droid Sans Mono',
'monospace',
}
config.window_background_opacity = 0.8
config.text_background_opacity = 0.5
-- Tab configs
config.use_fancy_tab_bar = true
config.hide_tab_bar_if_only_one_tab = true
config.window_frame = {
font_size = 9.0,
active_titlebar_bg = colors.color_titlebar.active_bg,
inactive_titlebar_bg = colors.color_titlebar.inactive_bg,
}
-- config.window_background_image = colors.window_background
end
return module quake module
|
Beta Was this translation helpful? Give feedback.
-
wezterm.lualocal wezterm = require("wezterm")
local action = wezterm.action
local nerdfonts = wezterm.nerdfonts
local mux = wezterm.mux
local F = require("functions")
local colors = {}
local config = {}
local custom = {}
local projects = {}
-- Custom
custom = {
color_scheme = {
dark = "Catppuccin Frappe",
light = "Catppuccin Mocha",
},
hostname = {
current = string.lower(wezterm.hostname()),
work = "pc-xxxxxx",
},
timeout = {
key = 3000,
leader = 1000
},
username = os.getenv("USER") or os.getenv("LOGNAME") or os.getenv("USERNAME"),
}
projects = {
default_workspace = "default",
repositories = {
{ type = "personal", workspace = "default", name = "home", path = os.getenv("HOME") },
{ type = "personal", workspace = "dotfiles", name = "project", path = os.getenv("HOME") .. "/Repositories/personal/gitlab.com/user/dotfiles" },
{ type = "work", workspace = "project1", name = "template", path = os.getenv("HOME") .. "/Repositories/work/github.com/user/project1" },
{ type = "work", workspace = "project2", name = "tab1", path = os.getenv("HOME") .. "/Repositories/work/gitlab.com/group", tabs = { 'tab1', 'tab2' } },
}
}
-- Path
config.set_environment_variables = {
PATH = wezterm.home_dir .. ":" .. os.getenv("PATH") .. ":" .. os.getenv("HOME") .. "/.nix-profile/bin"
}
-- Lauching
config.default_prog = { "zsh" }
config.automatically_reload_config = true
-- Colorscheme
config.color_scheme = F.scheme_for_appearance(
wezterm.gui.get_appearance(),
custom.color_scheme.dark,
custom.color_scheme.light
)
colors = wezterm.get_builtin_color_schemes()[config.color_scheme]
config.colors = {
compose_cursor = colors.ansi[2],
cursor_bg = colors.indexed[16],
split = colors.indexed[16],
tab_bar = { background = colors.background }
}
-- Cursor
config.xcursor_theme = "Adwaita"
-- Pane
config.inactive_pane_hsb = {
saturation = 0.6,
brightness = 0.6
}
-- IME
config.use_ime = false
-- Keys Mapping
config.disable_default_key_bindings = true
config.leader = { key = "f", mods = "CTRL", timeout_milliseconds = custom.timeout.leader }
config.keys = {
{ key = "o", mods = "LEADER",
action = action.ActivateKeyTable {
name = "open",
one_shot = false,
until_unknown = true,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "m", mods = "LEADER",
action = action.ActivateKeyTable {
name = "move",
one_shot = false,
until_unknown = false,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "r", mods = "LEADER",
action = action.ActivateKeyTable {
name = "resize",
one_shot = false,
until_unknown = true,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "c", mods = "LEADER", action = action.ShowLauncherArgs { flags = "FUZZY|LAUNCH_MENU_ITEMS" } },
{ key = "h", mods = "LEADER", action = action.ActivateCommandPalette },
{ key = "l", mods = "LEADER", action = action.Multiple {
wezterm.action_callback(function(window,pane)
F.switch_previous_workspace(window,pane)
end),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "p", mods = "LEADER", action = action.PasteFrom("Clipboard") },
{ key = "q", mods = "LEADER", action = action.QuitApplication },
{ key = "s", mods = "LEADER", action = action.Multiple {
action.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" },
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "t", mods = "CTRL", action = action.SpawnTab("DefaultDomain") },
{ key = "v", mods = "LEADER", action = action.ActivateCopyMode },
{ key = "w", mods = "LEADER", action = action.ShowLauncherArgs { flags = "TABS" } },
{ key = "y", mods = "LEADER", action = action.Multiple {
action.CopyTo("ClipboardAndPrimarySelection"),
action.ClearSelection
}
},
{ key = "z", mods = "LEADER", action = action.TogglePaneZoomState, },
{ key = "DownArrow", mods = "ALT", action = action.ActivatePaneDirection("Down") },
{ key = "DownArrow", mods = "SHIFT", action = action.ScrollByLine(1) },
{ key = "End", mods = "SHIFT", action = action.ScrollToBottom },
{ key = "Home", mods = "SHIFT", action = action.ScrollToTop },
{ key = "LeftArrow", mods = "ALT", action = action.ActivatePaneDirection("Left") },
{ key = "PageDown", mods = "SHIFT", action = action.ScrollByPage(1) },
{ key = "PageUp", mods = "SHIFT", action = action.ScrollByPage(-1) },
{ key = "RightArrow", mods = "ALT", action = action.ActivatePaneDirection("Right") },
{ key = "UpArrow", mods = "ALT", action = action.ActivatePaneDirection("Up") },
{ key = "UpArrow", mods = "SHIFT", action = action.ScrollByLine(-1) },
{ key = "0", mods = "ALT", action = action.EmitEvent 'toggle-opacity-reset' },
{ key = "0", mods = "CTRL", action = action.ResetFontSize },
{ key = "-", mods = "ALT", action = action.EmitEvent 'toggle-opacity-minus' },
{ key = "-", mods = "CTRL", action = action.DecreaseFontSize },
{ key = "=", mods = "ALT", action = action.EmitEvent 'toggle-opacity-plus' },
{ key = "=", mods = "CTRL", action = action.IncreaseFontSize },
{ key = "[", mods = "ALT", action = action.ActivateTabRelative(-1) },
{ key = "[", mods = "CTRL", action = action.Multiple {
action.SwitchWorkspaceRelative(-1),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "]", mods = "ALT", action = action.ActivateTabRelative(1) },
{ key = "]", mods = "CTRL", action = action.Multiple {
action.SwitchWorkspaceRelative(1),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "/", mods = "LEADER", action = action.Search { CaseInSensitiveString = "" } },
{ key = "-", mods = "LEADER", action = action.SplitVertical { domain = "CurrentPaneDomain" } },
{ key = "|", mods = "LEADER|SHIFT", action = action.SplitHorizontal { domain = "CurrentPaneDomain" } },
{ key = ",", mods = "LEADER", action = action.PromptInputLine
{
description = wezterm.format {
{ Attribute = { Intensity = "Bold" }},
{ Foreground = { Color = colors.indexed[16] }},
{ Text = "Renaming tab title:" }},
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end),
}
},
{ key = "$", mods = "LEADER|SHIFT", action = action.PromptInputLine
{
description = wezterm.format {
{ Attribute = { Intensity = "Bold" }},
{ Foreground = { Color = colors.indexed[16] }},
{ Text = "Renaming session/workspace:" }},
action = wezterm.action_callback(function(_, _, line)
if line then
mux.rename_workspace(mux.get_active_workspace(),line)
end
end),
}
},
}
-- Active tab by index
for i = 1, 9 do
table.insert(config.keys, { key = tostring(i), mods = "ALT", action = action.ActivateTab(i - 1) })
end
config.key_tables = {
move = {
{ key = 'r', action = action.RotatePanes 'CounterClockwise' },
{ key = 's', action = action.PaneSelect },
{ key = 'Enter', action = 'PopKeyTable' },
{ key = 'Escape', action = 'PopKeyTable' },
{ key = 'LeftArrow', mods = 'SHIFT', action = action.MoveTabRelative(-1) },
{ key = 'RightArrow', mods = 'SHIFT', action = action.MoveTabRelative(1) },
},
resize = {
{ key = 'DownArrow', action = action.AdjustPaneSize { 'Down', 1 } },
{ key = 'LeftArrow', action = action.AdjustPaneSize { 'Left', 1 } },
{ key = 'RightArrow', action = action.AdjustPaneSize { 'Right', 1 } },
{ key = 'UpArrow', action = action.AdjustPaneSize { 'Up', 1 } },
{ key = 'Enter', action = 'PopKeyTable' },
{ key = 'Escape', action = 'PopKeyTable' },
},
open = {
{ key = "g", action = action {
QuickSelectArgs = {
label = "execute 'gcloud auth login --remote-bootstrap'",
patterns = { "gcloud auth login --remote-bootstrap=\".*\"" },
scope_lines = 30,
action = action.EmitEvent "trigger-gcloud-auth"
}
},
},
{ key = "p", action = action.SpawnCommandInNewWindow {
label = "open current path on file manager",
args = { "xdg-open", "." },
}
},
{ key = "u", action = action {
QuickSelectArgs = {
label = "open URL on browser",
patterns = { "https?://\\S+" },
scope_lines = 30,
action = wezterm.action_callback(function(window, pane)
local url = window:get_selection_text_for_pane(pane)
wezterm.log_info("opening: " .. url)
wezterm.open_with(url)
end)
}
},
},
}
}
-- Window
config.bold_brightens_ansi_colors = true
config.initial_cols = 200
config.initial_rows = 50
config.text_background_opacity = 0.90
config.window_background_opacity = 0.90
config.window_decorations = "RESIZE"
config.window_padding = {
left = 3,
right = 3,
top = 10,
bottom = 3,
}
-- Graphics
config.front_end = "WebGpu"
config.webgpu_power_preference = "HighPerformance"
-- Cursor
config.bypass_mouse_reporting_modifiers = "SHIFT"
config.cursor_blink_ease_in = "Linear"
config.cursor_blink_rate = 500
config.default_cursor_style = "BlinkingBlock"
config.hide_mouse_cursor_when_typing = false
config.mouse_bindings = {
{ event = { Down = { streak = 1, button = 'Middle' }}, mods = 'NONE', action = action.PasteFrom("Clipboard") },
{ event = { Down = { streak = 1, button = "Left" }}, mods = "NONE", action = action.Multiple { action.ClearSelection }},
{ event = { Up = { streak = 1, button = "Left" }}, mods = "NONE", action = action.Nop },
{ event = { Up = { streak = 2, button = "Left" }}, mods = "NONE", action = action.Multiple { action.CopyTo "ClipboardAndPrimarySelection", action.ClearSelection }},
{ event = { Up = { streak = 3, button = "Left" }}, mods = "NONE", action = action.Multiple { action.CopyTo "ClipboardAndPrimarySelection", action.ClearSelection }},
{ event = { Up = { streak = 1, button = "Left" }}, mods = "CTRL", action = action.OpenLinkAtMouseCursor },
}
-- Font
config.font = wezterm.font("JetBrainsMonoNL Nerd Font")
config.font_size = 10
-- Hyperlink
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- e-mail fulano-ciclano@example.com fulano_ciclano@example.com
table.insert(config.hyperlink_rules,{
regex = "\\b[A-Z-a-z0-9-_\\.]+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
})
-- Scrolling
config.enable_scroll_bar = false
config.scrollback_lines = 10000
config.alternate_buffer_wheel_scroll_speed = 5
-- Tab
config.enable_tab_bar = true
config.hide_tab_bar_if_only_one_tab = false
config.show_new_tab_button_in_tab_bar = false
config.show_tab_index_in_tab_bar = true
config.status_update_interval = 1000
config.tab_bar_at_bottom = false
config.tab_max_width = 64
config.use_fancy_tab_bar = false
-- Launch commands
config.launch_menu = {
{
label = "HTTP 8080 - Open URL http://localhost:8080",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "http://localhost:8080" },
},
{
label = "HTTPS 8080 - Open URL https://localhost:8080",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "https://localhost:8080" },
},
{
label = "HTTPS 8433 - Open URL https://localhost:8433",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "https://localhost:8433" },
}
}
-- Events update status
wezterm.on("update-status", function(window, pane)
-- Workspace name
local stat = window:active_workspace()
local workspace_color = colors.ansi[3]
local time = wezterm.strftime("%Y-%m-%d %H:%M")
if window:active_key_table() then
stat = window:active_key_table()
workspace_color = colors.ansi[4]
elseif window:leader_is_active() then
stat = 'leader'
workspace_color = colors.ansi[2]
end
-- Current working directory
local cwd = pane:get_current_working_dir()
if cwd then
if type(cwd) == "userdata" then
-- Wezterm introduced the URL object in 20240127-113634-bbcac864
if string.len(cwd.path) > 32 then
cwd = ".." .. string.sub(cwd.path, -32, -1)
else
cwd = cwd.path
end
end
else
cwd = ""
end
-- Left status (left of the tab line)
window:set_left_status(wezterm.format({
{ Background = { Color = colors.background } },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = workspace_color } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = workspace_color } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.cod_terminal_tmux .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. stat },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}))
-- Right status
window:set_right_status(wezterm.format({
-- Wezterm has a built-in nerd fonts
-- https://wezfurlong.org/wezterm/config/lua/wezterm/nerdfonts.html
--
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[5] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[5] } },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.md_folder .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. cwd },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[6] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[6] } },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.fa_user .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. custom.username },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[7] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[7] } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.cod_server .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. custom.hostname.current },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[8]} },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[8]} },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.md_calendar_clock .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. time },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
}))
end)
-- Events define tab title
wezterm.on("format-tab-title", function(tab)
local pane = tab.active_pane
local title = F.tab_title(tab) .. " "
local tab_number = " " .. tostring(tab.tab_index + 1)
-- Default tab title
local icon = nerdfonts.dev_terminal .. " " .. title
-- Add zoom icon
if pane.is_zoomed then
icon = nerdfonts.cod_zoom_in .. " " .. icon
end
-- Add copy icon
if string.find(pane.title,"^Copy mode:") then
icon = nerdfonts.md_content_copy .. " " .. icon
end
if tab.is_active then
return {
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.indexed[16]} },
{ Text = icon },
{ Background = { Color = colors.indexed[16]} },
{ Foreground = { Color = colors.background } },
{ Text = tab_number },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.indexed[16]} },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}
else
return {
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = title },
{ Background = { Color = colors.ansi[5] } },
{ Foreground = { Color = colors.background } },
{ Text = tab_number },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[5] } },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}
end
end)
-- Events when wezterm is started
wezterm.on("gui-startup", function()
-- Iterate projects
for _, project in pairs(projects.repositories) do
-- Create personal's projects
if project.type == "personal" then
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
end
-- Create work's projects
if project.type == "work" and custom.hostname.current == custom.hostname.work then
-- Create workspace and tab
if project.tabs then
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path .. '/' .. project.tabs[1] }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
for tab = 2, #project.tabs do
window:spawn_tab { cwd = project.path .. '/' .. project.tabs[tab] }
wezterm.log_info('Creating tab ' .. project.tabs[tab] .. ' on workspace ' .. project.workspace )
end
else
-- Create workspace
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
end
end
end
-- Default workspace
mux.set_active_workspace(projects.default_workspace)
wezterm.log_info('Setting default workspace: ' .. projects.default_workspace )
end)
-- Open a new pane and execute gcloud auth login --remote-bootstrap
wezterm.on('trigger-gcloud-auth', function(window, pane)
-- Get command and url from gcloud
local cmd = window:get_selection_text_for_pane(pane)
-- Append command sleep to have some time to copy content
cmd = cmd .. " " .. "<<< y 2>&1 | grep -E '^https:\\S+' | wl-copy -n"
-- Open new pane and execute command
-- Execute
window:perform_action(
pane:split {
direction = 'Bottom',
label = 'execute gcloud auth --remote-bootstrap',
args = { 'bash', '-c', cmd }
},
pane
)
end)
wezterm.on('toggle-compose', function(window, pane)
local overrides = window:get_config_overrides() or {}
overrides.colors = config.colors
if window:active_key_table() then
overrides.colors.cursor_bg = colors.ansi[4]
else
overrides.colors.cursor_bg = colors.ansi[3]
end
window:set_config_overrides(overrides)
end)
wezterm.on('toggle-opacity-minus', function(window, pane)
local overrides = window:get_config_overrides() or {}
if window:get_config_overrides() then
overrides.text_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().text_background_opacity))
overrides.window_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().window_background_opacity))
else
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
end
if overrides.window_background_opacity > 0 and overrides.window_background_opacity <= 1 then
overrides.text_background_opacity = overrides.text_background_opacity - 0.10
overrides.window_background_opacity = overrides.window_background_opacity - 0.10
window:set_config_overrides(overrides)
end
end)
wezterm.on('toggle-opacity-plus', function(window, pane)
local overrides = window:get_config_overrides() or {}
if window:get_config_overrides() then
overrides.text_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().text_background_opacity))
overrides.window_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().window_background_opacity))
else
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
end
if overrides.window_background_opacity >= 0 and overrides.window_background_opacity < 1 then
overrides.text_background_opacity = overrides.text_background_opacity + 0.10
overrides.window_background_opacity = overrides.window_background_opacity + 0.10
window:set_config_overrides(overrides)
end
end)
wezterm.on('toggle-opacity-reset', function(window, pane)
local overrides = window:get_config_overrides() or {}
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
window:set_config_overrides(overrides)
end)
wezterm.on('set-previous-workspace', function(window, pane)
local current_workspace = window:active_workspace()
if wezterm.GLOBAL.previous_workspace ~= current_workspace then
wezterm.GLOBAL.previous_workspace = current_workspace
end
end)
return config
functions.lualocal wezterm = require("wezterm")
local action = wezterm.action
local F = {}
-- Check if file exists
function F.file_exists(name)
local file = io.open(name,"r")
if file ~= nil then
io.close(file)
return true
else
return false
end
end
-- Match the appearance to the system's style
function F.scheme_for_appearance(appearance, dark, light)
if appearance:find "Dark" then
return dark
else
return light
end
end
-- Get basename of path
function F.basename(string)
return string.gsub(string, "(.*[/\\])(.*)", "%2")
end
-- Define window title
function F.tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane in that tab
return F.basename(tab_info.active_pane.title)
end
F.switch_workspace = function(window, pane, workspace)
local current_workspace = window:active_workspace()
if current_workspace == workspace then
return
end
window:perform_action(
action.SwitchToWorkspace({
name = workspace,
}),
pane
)
wezterm.GLOBAL.previous_workspace = current_workspace
end
F.switch_previous_workspace = function(window, pane)
local current_workspace = window:active_workspace()
local workspace = wezterm.GLOBAL.previous_workspace
if current_workspace == workspace or wezterm.GLOBAL.previous_workspace == nil then
return
end
F.switch_workspace(window, pane, workspace)
end
return F |
Beta Was this translation helpful? Give feedback.
-
show ya moves!
initial setup, no lsp for wren yet. aura theme for wezterm and boo berry theme for helix until i port aura.. :/ can't wait to add some crazy flashing text, lmao. don't quite know how to easily move the window without a title bar on windows-os.. :/ will update my configs over time! update: of note: wezterm handles bold, italics, dim, and even flashing text of helix beautifully. 👨🍳 (..but can't show flashing selection without video.. 😞) |
Beta Was this translation helpful? Give feedback.
-
I found WezTerm about 5 months ago - I'm late to the party, but I've been loving it! I smile a little bit every time I pull up this terminal. I rotate the memes but this one has stuck around for the last couple months. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Zen / minimalist style. |
Beta Was this translation helpful? Give feedback.
-
I'll start with my current work setup:
wezterm.lua
Beta Was this translation helpful? Give feedback.
All reactions