This PR introduces 2 new changes to the behaviour of the plugin, which can be optionally configured.
The default colours/rainbow of the tabs can be overridden by the user
The titles can be overridden by the user (and additionally, the colours of specific tabs can be overridden based on arbitrary conditions defined by the user)
Code quality and semantics aside, I'd like to clarify the intended behaviour of the new functionality with some examples below. If you agree, I can update the documentation with some examples and switch the status of this PR to ready for review.
Examples
Case 1: Overriding Default Colours
Config:
tabs = {
colours = {
2,
3,
"#FFFFFF"
}
}
Intended Behaviour:
The above config would result in all tabs cycling through 3 colours that the user has defined. The first 2 colours are indices to be retrieved from Wezterm's palette via ANSI colours. The 3rd is a hex colour and should be directly passed to the configuration.
Intended Behaviour:
All tabs should follow the default colours defined. However, on tabs that contain the string nvim or ssh in their titles, the colours should be overridden as per the foreground and background values. In this example, nvim tabs should have a background of the 4th ANSI colour and ssh tabs should have a white background with a dark foreground.
Case 3: Modifying Title Based On Tab
Config:
tabs = {
overrides = {
ssh = {
title = function(title)
return "🐎 " .. title
end
}
}
}
Intended Behaviour:
All tabs should follow the default colours defined. On tabs that contain the string ssh in their titles, the title of the tab should always be pre-pended with the string "🐎 "
Case 4: Modifying Title Based On Some Abitrary Condition
Config:
tabs = {
overrides = {
ssh = {
matcher = function(override, title)
return tab.active_pane.foreground_process_name:find(override)
end,
title = function(title)
return "🐎 " .. title
end
}
}
}
Intended Behaviour:
All tabs should follow the default colours defined. The definition of the matcher() function allows the user to define their own custom condition on when the override should be applied. In this particular example, on all tabs that have the foreground process ssh running - the title of the tab should always be pre-pended with the string "🐎 "
There are, of course, more permutations that can be showcased but I think these cases cover the majority of them. Let me know what you think!
Hiya :wave:
This PR introduces 2 new changes to the behaviour of the plugin, which can be optionally configured.
Code quality and semantics aside, I'd like to clarify the intended behaviour of the new functionality with some examples below. If you agree, I can update the documentation with some examples and switch the status of this PR to ready for review.
Examples
Case 1: Overriding Default Colours
Config:
Intended Behaviour:
The above config would result in all tabs cycling through 3 colours that the user has defined. The first 2 colours are indices to be retrieved from Wezterm's palette via ANSI colours. The 3rd is a hex colour and should be directly passed to the configuration.Case 2: Overriding Colours Based On Tab Title
Config:
Intended Behaviour:
All tabs should follow the default colours defined. However, on tabs that contain the stringnvim
orssh
in their titles, the colours should be overridden as per the foreground and background values. In this example,nvim
tabs should have a background of the 4th ANSI colour andssh
tabs should have a white background with a dark foreground.Case 3: Modifying Title Based On Tab
Config:
Intended Behaviour:
All tabs should follow the default colours defined. On tabs that contain the stringssh
in their titles, the title of the tab should always be pre-pended with the string"🐎 "
Case 4: Modifying Title Based On Some Abitrary Condition
Config:
Intended Behaviour:
All tabs should follow the default colours defined. The definition of thematcher()
function allows the user to define their own custom condition on when the override should be applied. In this particular example, on all tabs that have the foreground processssh
running - the title of the tab should always be pre-pended with the string"🐎 "
There are, of course, more permutations that can be showcased but I think these cases cover the majority of them. Let me know what you think!