-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local wezterm = require("wezterm") | ||
|
||
local M = {} | ||
|
||
local process_icons = { | ||
["docker"] = wezterm.nerdfonts.linux_docker, | ||
["docker-compose"] = wezterm.nerdfonts.linux_docker, | ||
["psql"] = wezterm.nerdfonts.dev_postgresql, | ||
["nvim"] = wezterm.nerdfonts.custom_vim, | ||
["make"] = wezterm.nerdfonts.seti_makefile, | ||
["vim"] = wezterm.nerdfonts.dev_vim, | ||
["zsh"] = wezterm.nerdfonts.dev_terminal, | ||
["bash"] = wezterm.nerdfonts.cod_terminal_bash, | ||
["htop"] = wezterm.nerdfonts.mdi_chart_donut_variant, | ||
["cargo"] = wezterm.nerdfonts.dev_rust, | ||
["sudo"] = wezterm.nerdfonts.fa_hashtag, | ||
["git"] = wezterm.nerdfonts.dev_git, | ||
["lua"] = wezterm.nerdfonts.seti_lua, | ||
["wget"] = wezterm.nerdfonts.mdi_arrow_down_box, | ||
["curl"] = wezterm.nerdfonts.mdi_flattr, | ||
["gh"] = wezterm.nerdfonts.dev_github_badge, | ||
["ruby"] = wezterm.nerdfonts.cod_ruby, | ||
["node"] = wezterm.nerdfonts.dev_nodejs_small, | ||
["tmux"] = wezterm.nerdfonts.cod_terminal_tmux, | ||
} | ||
|
||
function M.get_process(tab) | ||
local process_name = tab.active_pane.foreground_process_name:match("([^/\\]+)$") | ||
local icon = process_icons[process_name] or wezterm.nerdfonts.seti_checkbox_unchecked | ||
|
||
return icon | ||
end | ||
|
||
-- This function returns the suggested title for a tab. | ||
-- It prefers the title that was set via `tab:set_title()` | ||
-- or `wezterm cli set-tab-title`, but falls back to the | ||
-- title of the active pane in that tab. | ||
function M.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 tab_info.active_pane.title | ||
end | ||
|
||
return M |