To The Point

The focus problem.

So there is an issue #326 of tmuxp repository that I also found using tmuxp. It's about using focus attribute that does not work.

Debugging

So first of all I have started installed tmuxp with pipsi with:

pipsi install tmuxp

Then I have found that pipsi actually creates virtualenv to run scripts.

So I've found where actually tmuxp is located with:

which tmuxp

That outputed with:

~/.local/bin/tmuxp

And found location of the script that should be similar to:

~/.local/venvs/tmuxp/lib/python2.7/site-packages/tmuxp

So first I tried to debug how the Tmuxp works internally and looked for focus in code.

I've finally found the tmuxp load uses code with this stack trace :

  • at cli.py command_load invokes:
  • at cli.py load_workspace then invokes builder class:
  • at cli.py builder.build from workspacebuilder: - at workspacebuilder.py
  • and in cli.py after builder.build() - invoking set_layout_hook(builder.session, 'client-attached')

After tampering and making printing and tracing down the problem I've found that making sys.exit() after builder.build() creates tmux session that properly works with focusing.

So after that I narrowed down problem and found that commenting set_layout_hook at cli.py fixes problem.

I have created a #371 PR and requested merging to branch. Let's check out what the maintainer has to say about my fix which frankly is more of a hack.

Acknowledgements

Thanks!

That's it :) Comment, share or don't - up to you.

Any suggestions what I should blog about? Post me a comment in the box below or poke me at Twitter: @anselmos88.

See you in the next episode! Cheers!



Comments

comments powered by Disqus