O'Reilly logo

Learning Cython Programming - Second Edition by Philip Herron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending Tmux

Tmux is a terminal multiplexer inspired by GNU Screen (http://tmux.github.io/), but it supports much simpler and better configuration. More importantly, the implementation is much cleaner and easier to maintain, and it also uses libevent and very well-written C code.

I want to show you how you can extend Tmux with new built-in commands by writing Python code instead of C. Overall, there are several parts to this project, as follows:

  • Hack the autotool's build system to compile in Cython
  • Create PXD declarations to the relevant declarations such as struct cmd_entry
  • Embed Python into Tmux
  • Add the Python command to the global Tmux cmd_table

Let's take a quick look at the Tmux source, and in particular any of the cmd-*.c files that contain ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required