Replies: 5 comments 4 replies
-
We don't have this today, but adding support for it is doable. In my mind this overlaps a bit with #3 |
Beta Was this translation helpful? Give feedback.
-
I hacked this together with uservars and a bash script that you pipe your log output into. So it won't work as something you could turn on ad-hoc for an existing long-running process, but for my use case of keeping a tail on a log file it works great. It works with Separately in the This is the most I've ever written in Lua, so happy to know if there's an easier way to do any of this. wezterm-tail-alert.sh: #!/bin/bash
while read line; do
echo $line
printf "\e]1337;SetUserVar=%s=%s\a" lastOutput $(date +'%s'| base64)
tput bel
done local wezterm = require 'wezterm';
local lastVisits = {};
local lastLines = {};
wezterm.on("format-tab-title", function( tab, tabs, panes, config, hover, max_width )
local pane_title = tab.active_pane.title
local lastOutput = tonumber( tab.active_pane.user_vars.lastOutput )
local currTime = tonumber( wezterm.strftime("%s") )
local index = tonumber( tab.tab_index )+1
local format = {}
if lastOutput ~= nil then
if lastVisits[ tab.tab_id ] == nil then
lastVisits[ tab.tab_id ] = currTime
end
if lastOutput > lastVisits[ tab.tab_id ] then
i, j = string.find( lastLines[ tab.active_pane.pane_id ], "INFO:" )
if nil == i then
pane_title = "(!) " .. pane_title
table.insert( format, { Foreground={Color="Red"} } )
end
end
if tab.is_active and lastVisits[ tab.tab_id ] < currTime then
lastVisits[ tab.tab_id ] = currTime
end
end
table.insert( format, { Text=index .. ": " .. pane_title } )
return format
end)
-- https://www.codegrepper.com/code-examples/lua/lua+split+string+by+delimiter
function Split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
wezterm.on("bell", function(window, pane)
local lastOutput = tonumber( pane:get_user_vars().lastOutput )
if lastOutput ~= nil then
local lines = Split( pane:get_logical_lines_as_text(), "\n" )
lastLines[ pane:pane_id() ] = lines[ #lines ]
end
end)
return {} |
Beta Was this translation helpful? Give feedback.
-
I checked out the nightly build last night and the new tab activity feature works great! Unfortunately for me I also ran into too many issues with my key maps on Colemak (I assume because of #1483) so I reverted back to the stable release for now. But I'll switch back to nightly when I have more time to play with it and figure out what's going on :) |
Beta Was this translation helpful? Give feedback.
-
Are we going to roll out this feature? |
Beta Was this translation helpful? Give feedback.
-
Could you please make it look like Tmux where tab name does not change with cwd and where pressing leader key and comma allows to rename tab title. |
Beta Was this translation helpful? Give feedback.
-
In iTerm2 there is a built-in option to show that there was new output in an inactive tab:
Is there an easy way to configure this?
I guess you could make it with user vars and monitoring tabs / panes in
format-tab-title
, but it seems like a hack.Beta Was this translation helpful? Give feedback.
All reactions