Coder Social home page Coder Social logo

duyngb / monomux Goto Github PK

View Code? Open in Web Editor NEW

This project forked from whisperity/monomux

0.0 0.0 0.0 710 KB

Monophone Terminal Multiplexer - Less intrusive than tmux, smarter than screen

License: GNU General Public License v3.0

C++ 94.54% C 0.77% CMake 4.69%

monomux's Introduction

MonoMux

MonoMux (for Monophone Terminal Multiplexer โ€” pun intended) is a system tool that allows executing terminal sessions in the background with on-demand attaching to them.

๐Ÿ“ข Important! MonoMux is in active incremental development! You are welcome using it as your daily driver, but for long-term production systems, use the proven alternatives instead!

MonoMux is a tool similar to screen and tmux. It allows most of the core features of screen or tmux, with being less intrusive about its behaviour when it comes to using these tools with modern terminal emulators.

โš ๏ธ Warning! Currently, MonoMux is designed with only supporting Linux operating systems in mind. Most of the project is written with POSIX system calls in mind, but there are some GNU extensions used.

โ„น๏ธ Note: MonoMux is NOT a terminal emulator by itself! To use it, you may use any of your favourite terminal emulators.

Dependencies

MonoMux uses modern C++ features, and as such, a C++17-capable compiler and associated standard library is needed to compile and execute the tool. There are no other dependencies.

Installation

Ubuntu (18.04, 20.04, 22.04)

Download the .deb (and optionally the .ddeb) file for the release, and install the standard way:

sudo dpkg --install monomux-*.*deb

Alternatively, a .tar.gz archive might be used. The application consists of a single self-contained binary.

Usage

The easiest use of MonoMux is simply starting it: monomux. By default, a server starts in the background, and a default session is created with the default shell of the current user, and the client automatically attaches to this session. Executing the client with a server already running will attach to the only session on the server, or if multiple sessions exist, an interactive menu will start with which a session can be selected. (The interactive menu can be explicitly requested, even if only at most one session exists, with the -i or --interactive parameter.)

โ„น๏ธ Note: Please always refer to the output of monomux -h for up-to-date information about what flags the installed tool supports.

To run multiple independent servers, specify the -s/--socket option with a path on the file system. Communication between the server and the client takes place on this socket.

Fine-tuning Client options

The client can be fine-tuned during its start-up with several flags:

  • monomux /bin/myshell will start the specified program without passing any arguments to it.
  • monomux -- /bin/myshell -a -b --arg-to-shell will start the specified program with command-line arguments, if a new session is created. (If the started program takes - or -- arguments, an explicit separator -- must be given BEFORE the program's name!)
  • monomux -n SESSION_NAME will attach or start the session SESSION_NAME, bypassing the interactive menu.
  • Environment variables can be specified or removed via -e VARIABLE=Value -u UNSET_VARIABLE.

A server can be started explicitly via monomux --server, in which case no client creation and attachment will be done.

Why?

One of the most important contexts where screen or tmux comes to mind is over remote sessions. If a remote connection breaks โ€” or the local graphical terminal closes or crashes โ€”, the terminal session behind the connection is sent a SIGHUP signal, for which most programs exit. This results in the loss of shell history, and the interrupt of running programs.

The most crucial problem from an interactive work's point-of-view with existing tools is that both screen and tmux act as terminal emulators themselves. Their behaviour is to parse the VT sequences of the output received from the "remote" terminal and emit them to the attached client(s). Programs using extensive modern, or terminal specific features will have to fall back to the older and more restrictive set of what screen or tmux understands.

A fork of screen, dtach was created which emulates only the attach/detach features of screen. However, dtach has a straightforward and non-trivial interface, e.g. the user must specify the connection socket file manually.

(Moreover, all of the aforementioned tools are written in C.)

MonoMux aims to combine the good aspects of all of these tools but remove almost all of the possible hurdles in the way of tools running in the background session.

  • Attach/detach features are supported without the need of parsing control sequences.
  • Every I/O operation to and from the client to the attached session is passed verbatim, without understanding the contents.
    • This allows using all the features of a modern terminal emulator as-is.
    • However, this also means that features found in tmux such as splits or keybinds can not and will not be implemented in this tool.
  • Better defaults than dtach: no need to specify an exit escape sequence or modern resize events.
  • Like tmux, there is meaningful session management by default, giving an interactive attach menu if multiple sessions exist.

Written in C++17, with object-oriented design in mind. This might result in a larger binary than for other tools, however, MonoMux is intended for user systems, not embedded contexts.

monomux's People

Contributors

whisperity avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.