Skip to content

amjith/pymux-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pymux

A terminal multiplexer (like tmux) in Python

pip install pymux

Issues, questions, wishes, comments, feedback, remarks? Please create a GitHub issue, I appreciate it.

Installation

Simply install pymux using pip:

pip install pymux

Start it by typing pymux.

What does it do?

A terminal multiplexer makes it possible to run multiple applications in the same terminal. It does this by emulating a vt100 terminal for each application. There are serveral programs doing this. The most famous are GNU Screen and tmux.

Pymux is written entirely in Python. It doesn't need any C extension. It runs on all Python versions from 2.6 until 3.5. It should work on OS X and Linux.

Compared to tmux

To some extend, pymux is a clone of tmux. This means that all the default shortcuts are the same; the commands are the same or very similar, and even a simple configuration file could be the same. (There are some small incompatibilities.) However, we definitely don't intend to create a fully compatible clone. Right now, only a subset of the command options that tmux provides are support.

Pymux implements a few improvements over tmux:

  • There is a completion menu for the command line. (At the bottom of the screen.)
  • The command line has fish-style suggestions.
  • Both Emacs and Vi key bindings for the command line and copy buffer are well developed, thanks to all the effort we have put earlier in prompt_toolkit.
  • Search in the copy buffer is highlighted while searching.
  • Every pane has its own titlebar.
  • When several clients are attached to the same session, each client can watch a different window. When clients are watching different windows, every client uses the full terminal size.
  • Support for 24bit true color. (Disabled by default.)

About the performance:

  • Tmux is written in C, which is obviously faster than Python. This is noticable when applications generate a lot of output. Where tmux is able to give fast real-time output for, for instance find / or yes, pymux will process the output slightly slower, and in this case render the output only a few times per second to the terminal. Usually, this should not be an issue. If it is, Pypy should provide a significant speedup.

The big advantage of using Python and prompt_toolkit is that the implementation of new features becomes very easy.

More screenshots

24 bit color support and the autocompletion menu:

What happens if another client with a smaller screen size attaches:

When a pane enters copy mode, search results are highlighted:

Why create a tmux clone?

Just like pyvim (A Vi clone in Python.), this is another experiment. A hobby project to challenge the design of prompt_toolkit. The development resulted in many improvements in prompt_toolkit, especially performance improvements, but also some functionality improvements.

The development is especially interesting, because it touches so many different areas that are unknown to most Python developers. It also proves that Python is a good tool to create terminal applications.

Further, the intension is to make all pymux code reusable as a library at some point. It should be possible to create any full screen prompt_toolkit application that embeds a vt100 terminal.

And finally, it's a nice addition for the prompt-toolkit ecosystem.

The roadmap

There is no official roadmap. All code is written for the fun. Of course, we have many ideas and all input is welcome.

Probably we'll support color schemes. Maybe, we will support extensions written in Python. Maybe we will further improve mouse support. Maybe we will make the code base reusable and allow any full screen prompt_toolkit application to embed a vt100 terminal. (Imagine a terminal emulator embedded in pyvim.) Maybe we will create some cool widgets to traverse the windows and panes.

About Mac OS X support

Pymux should work perfectly on OS X, just like on Linux systems. There is one bug however: window names are not updated automatically according to the name of the process. It displays (noname) on OS X.

The reason for this is that on Linux, it's very easy to get the process name. It works by reading the content of /proc/(process_group)/cmdline. On OS X, this appears to be a system call, named proc_pidinfo. There is a library called psutil that has the required functionality, but it's written in C. I won't include that, we don't want to depend on modules that require compilation. But if someone could contribute something based on ctypes, that would be much appreciated.

Configuring

Create a file ~/.pymux.conf, and populate it with commands, like you can enter at the command line.

What if it crashes?

If for some reason pymux crashes, it will attempt to write a stack trace to /tmp/pymux.crash. It is possible that the user interface freezes. Please create a GitHub issue with this stack trace.

Special thanks

  • Pyte, for providing a working vt100 parser. (This one is extended in order to support some xterm extensions.)
  • docopt, for parsing the command line arguments.
  • prompt_toolkit, for the UI toolkit.
  • tmux, for the inspiration.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%