Gered
9731e4c3e5
this "feature" appears to be full of holes, seemingly limited by what process info wezterm is able to provide to you (which is probably limited by other things, etc etc). ugh.
188 lines
5.1 KiB
Lua
188 lines
5.1 KiB
Lua
-- Ctrl+Shift+R to force config reload
|
|
-- Ctrl+Shift+L to enter WezTerm REPL/Console
|
|
-- Ctrl+Shift+P to bring up WezTerm command palette
|
|
-- wezterm.log_info("debug")
|
|
|
|
local wezterm = require("wezterm")
|
|
local config = wezterm.config_builder()
|
|
|
|
config.initial_cols = 150
|
|
config.initial_rows = 48
|
|
|
|
config.hide_tab_bar_if_only_one_tab = true
|
|
config.tab_bar_at_bottom = true
|
|
config.use_fancy_tab_bar = false
|
|
config.show_new_tab_button_in_tab_bar = false
|
|
config.tab_max_width = 32
|
|
config.enable_scroll_bar = true
|
|
config.window_background_opacity = 0.8
|
|
config.window_padding = {
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0,
|
|
}
|
|
config.use_resize_increments = true
|
|
|
|
config.colors = {
|
|
foreground = "#ffffff",
|
|
background = "#000000",
|
|
cursor_fg = "#000000",
|
|
cursor_bg = "#ffffff",
|
|
cursor_border = "#ffffff",
|
|
ansi = {
|
|
"#171421", -- black
|
|
"#c01c28", -- red
|
|
"#26a269", -- green
|
|
"#a2734c", -- yellow
|
|
"#12488b", -- blue
|
|
"#a347ba", -- magenta
|
|
"#2aa1b3", -- cyan
|
|
"#d0cfcc", -- white
|
|
},
|
|
brights = {
|
|
"#5e5c64", -- black
|
|
"#f66151", -- red
|
|
"#33d17a", -- green
|
|
"#e9ad0c", -- yellow
|
|
"#2a7bde", -- blue
|
|
"#c061cb", -- magenta
|
|
"#33c7de", -- cyan
|
|
"#ffffff", -- white
|
|
},
|
|
}
|
|
-- config.color_scheme = "Gnometerm (terminal.sexy)"
|
|
|
|
config.font = wezterm.font({
|
|
family = "Cascadia Mono",
|
|
harfbuzz_features = { "calt=0", "clig=0", "liga=0" },
|
|
})
|
|
config.font_size = 12
|
|
config.line_height = 1.0
|
|
config.freetype_load_target = "Light"
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- borrowed from: https://github.com/protiumx/.dotfiles/blob/main/stow/wezterm/.config/wezterm/wezterm.lua
|
|
|
|
-- wezterm.nerdfonts reference: https://wezfurlong.org/wezterm/config/lua/wezterm/nerdfonts.html
|
|
local process_icons = {
|
|
["bash"] = wezterm.nerdfonts.dev_terminal,
|
|
["btop"] = wezterm.nerdfonts.md_chart_bar,
|
|
["cargo"] = wezterm.nerdfonts.dev_rust,
|
|
["clj"] = wezterm.nerdfonts.dev_clojure,
|
|
["clojure"] = wezterm.nerdfonts.dev_clojure,
|
|
["curl"] = wezterm.nerdfonts.mdi_flattr,
|
|
["docker"] = wezterm.nerdfonts.linux_docker,
|
|
["docker-compose"] = wezterm.nerdfonts.linux_docker,
|
|
["git"] = wezterm.nerdfonts.dev_git,
|
|
["go"] = wezterm.nerdfonts.seti_go,
|
|
["htop"] = wezterm.nerdfonts.md_chart_bar,
|
|
["java"] = wezterm.nerdfonts.dev_java,
|
|
["kubectl"] = wezterm.nerdfonts.linux_docker,
|
|
["lein"] = wezterm.nerdfonts.dev_clojure,
|
|
["less"] = wezterm.nerdfonts.md_less_than,
|
|
["lua"] = wezterm.nerdfonts.seti_lua,
|
|
["make"] = wezterm.nerdfonts.seti_makefile,
|
|
["man"] = wezterm.nerdfonts.fa_book,
|
|
["nano"] = wezterm.nerdfonts.md_file_edit,
|
|
["node"] = wezterm.nerdfonts.mdi_hexagon,
|
|
["nvim"] = wezterm.nerdfonts.custom_neovim,
|
|
["perl"] = wezterm.nerdfonts.seti_perl,
|
|
["psql"] = "",
|
|
["python3"] = "",
|
|
["Python"] = "",
|
|
["ruby"] = wezterm.nerdfonts.cod_ruby,
|
|
["ssh"] = wezterm.nerdfonts.md_server,
|
|
["ssh-add"] = wezterm.nerdfonts.md_server,
|
|
["stern"] = wezterm.nerdfonts.linux_docker,
|
|
["sudo"] = wezterm.nerdfonts.fa_hashtag,
|
|
["vim"] = wezterm.nerdfonts.dev_vim,
|
|
["wget"] = wezterm.nerdfonts.mdi_arrow_down_box,
|
|
}
|
|
|
|
local process_use_suggested_title = {
|
|
["ssh"] = true,
|
|
}
|
|
|
|
local function get_suggested_tab_title(tab_info)
|
|
local title = tab_info.tab_title
|
|
if title and #title > 0 then
|
|
return title
|
|
end
|
|
return tab_info.active_pane.title
|
|
end
|
|
|
|
local function get_current_working_dir(tab)
|
|
local current_dir = tab.active_pane and tab.active_pane.current_working_dir or { file_path = "" }
|
|
local HOME_DIR = os.getenv("HOME")
|
|
|
|
return current_dir.file_path == HOME_DIR and "~" or string.gsub(current_dir.file_path, "(.*[/\\])(.*)", "%2")
|
|
end
|
|
|
|
local function get_process(tab)
|
|
if not tab.active_pane or tab.active_pane.foreground_process_name == "" then
|
|
return nil
|
|
end
|
|
|
|
local process_name = string.gsub(tab.active_pane.foreground_process_name, "(.*[/\\])(.*)", "%2")
|
|
if string.find(process_name, "kubectl") then
|
|
process_name = "kubectl"
|
|
end
|
|
if string.find(process_name, "python3") then
|
|
process_name = "python3"
|
|
end
|
|
|
|
return {
|
|
Icon = process_icons[process_name] or string.format("[%s]", process_name),
|
|
Process = process_name,
|
|
}
|
|
end
|
|
|
|
local SOLID_LEFT_ARROW = wezterm.nerdfonts.pl_right_hard_divider
|
|
local SOLID_RIGHT_ARROW = wezterm.nerdfonts.pl_left_hard_divider
|
|
|
|
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
|
|
local has_unseen_output = false
|
|
if not tab.is_active then
|
|
for _, pane in ipairs(tab.panes) do
|
|
if pane.has_unseen_output then
|
|
has_unseen_output = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
local cwd = wezterm.format({
|
|
{ Text = get_current_working_dir(tab) },
|
|
})
|
|
|
|
local process = get_process(tab)
|
|
|
|
local title
|
|
if process then
|
|
local icon = process.Icon or string.format("[%s]", process.Process)
|
|
if process_use_suggested_title[process.Process] then
|
|
title = string.format(" %s %s ", icon, get_suggested_tab_title(tab))
|
|
else
|
|
title = string.format(" %s (%s) ", icon, cwd)
|
|
end
|
|
else
|
|
title = string.format(" %s %s ", wezterm.nerdfonts.cod_terminal_bash, get_suggested_tab_title(tab))
|
|
end
|
|
|
|
if has_unseen_output then
|
|
return {
|
|
{ Foreground = { Color = "#ffffff" } },
|
|
{ Text = title },
|
|
}
|
|
end
|
|
|
|
return {
|
|
{ Text = title },
|
|
}
|
|
end)
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
return config
|