Closed Frederick888 closed 2 years ago
Hey, thanks for the contribute!
I'm aware of this issue I thought about several ways to solve it but none of them satisfy me, I opened an Issue #10 to solve this in the feature.
tmux's feature of automatic renames is buggy and clanky, actually because its so buggy I made this plugin to avoid the issues with it, unfortunately I have to decline this PR.
This is a PoC of leveraging Tmux automatic rename feature to avoid overriding users' window names. It's nowhere near ready to be merged but hopefully can serve as an inspiration for an actual solution.
According to Tmux manual:
So instead of controlling Tmux directly from the Python script, we can simply print out the names instead and use them in automatic rename templates. I added a
--window_id=<window_id>
argument to the Python script and when given, it now only prints out the window name.Then for instance, I can add this to my
.tmux.conf
(instead of usingtmux_window_name.tmux
):Now I can toggle
tmux-window-name
using<prefix>"
. If I manually rename the window,automatic-rename
will be set tooff
and hence no longer updated by our script.By the way
automatic-rename
actually has 3 states:on
,off
and empty, which can be handy if we want to program more logic into the binding.If we want
tmux-window-name
to be on by default, I believe in.tmux.conf
we can simply:Note though this comes with some strings attached to work smoothly:
Our script has to run fast enough to avoid '/path/to/tmux-window-name is not ready...' warnings and make sure the window names are up-to-date.