diff --git a/home/programs/wezterm/default.nix b/home/programs/wezterm/default.nix index 65e298e..57b1fde 100644 --- a/home/programs/wezterm/default.nix +++ b/home/programs/wezterm/default.nix @@ -20,6 +20,11 @@ in ''; }; + programs.zsh.initExtra = /*bash*/ '' + if [ -n "$WEZTERM_PANE" ]; then + alias ssh="wezterm ssh" + fi + ''; home.file.".config/wezterm" = { source = ./.; diff --git a/home/programs/wezterm/event_config.lua b/home/programs/wezterm/event_config.lua index 889cf82..93668f5 100644 --- a/home/programs/wezterm/event_config.lua +++ b/home/programs/wezterm/event_config.lua @@ -32,7 +32,7 @@ local process_icons = { } local function get_current_working_dir(tab) - local current_dir = tab.active_pane and tab.active_pane.current_working_dir or { file_path = '' } + 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') @@ -51,6 +51,16 @@ local function get_process(tab) return process_icons[process_name] or string.format('[%s]', process_name) end +wezterm.on('format-window-title', function(tab, tabs, panes, config) + local cwd = wezterm.format({ + { Text = get_current_working_dir(tab) }, + }) + + local process = get_process(tab) + local title = process and string.format(' %s (%s) ', process, cwd) or ' [?] ' + return title +end) + wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width) local has_unseen_output = false if not tab.is_active then