A lightweight non-interactive terminal multiplexer.
Project description
minimux
A lightweight non-interactive terminal multiplexer.
What is minimux?
Minimux allows you to run multiple programs in a single terminal window. If this is useful for you, you probably already know it, but here are some reasons why it might be useful anyway:
- You are developing a program which requires running several different binaries at the same time, and you want to be able to start them all and read their logs in the same terminal window
- You have several background tasks you need to check occassionally and want one self-contained place to read them
Here are some things minimux is not:
- A replacement for tmux --- anything you can do with minimux you could definitely do better with tmux, but it could take more work and minimux might have some things included (such as colorizing output) which you'd have to hand roll with tmux
- A way to run interactive programs: minimux is dumb and doesn't send input to any of the programs it displays
Here is what it might look like if you were running a website with an API and database:
My App Development Server
───────────────────────────────────────┬──────────────────────────────────────
Frontend │ API
info: GET /index.html 200 │Starting the api
info: GET /index.html 200 │INFO: started
error: GET /doesnotexit.html 404 │WARN: this is a development api
│
│
│
│
│
├──────────────────────────────────────
│ Database
│info: running database migrations
│info: no migrations to run
│
│
Installation
Install using the python package manager of your choice, if you have
pipx on your system then simply pipx install minimux
Usage
Usage: minimux [OPTIONS] [CONFIG_FILE]
Options:
-v, --version Show the version and exit.
-d, --directory DIRECTORY The directory to set as the cwd for commands.
Additionally, if CONFIG_FILE is not set and there
is no minimux.ini file in the current directory,
this directory will be searched for a minimux.ini
file to use
-g, --debug Display a full traceback when an exception is
thrown
--help Show this message and exit.
The most common way to invoke minimux is to simply run minimux in a
directory which contains a minimux.ini configuration file in it. The
configuration file is described in the next section.
The Configuration File
The configuration file is described here in two ways
- For new users, a small example on how to build up a configuration from scratch
- For existing users who need to look something up, a reference of all the available sections and options
Guided tutorial
In the examples directory of this repo you'll find a variety of
example configurations. You can run the example configs now by cding
into one of the subdirectories and running minimux. In this tutorial
we will start with a blank config file and work our way up to the
tutorial directory.
The problem we are trying to solve is this: to test our app locally we need to run the frontend, api and database at the same time. We want to do this all with one simple command, and to be able to inspect the logs of all three programs in real time.
Let us start with a blank app.ini. The simplest way to solve the
problem above is to write a config as follows:
[main]
panels = frontend,api,database
[frontend]
command = make -C frontend dev
[api]
command = make -C api dev
[database]
command = make -C database dev
Now when we run minimux app.ini we will see all three programs run
side by side.
The main section is the entrypoint for minimux, and the panels
options holds a list of the section names which describe what to
display. In our simple case, each section just holds a command
option with a command to run.
It might be nice to add headings to each section so we know what
program it is showing the output of. We can do this by adding a
title option to each section, for example:
[api]
title = API
command = make -C api dev
Now the title is displayed at the top of the program's output. We can
also specify a title in the main section, which will be displayed at
the top of the entire window:
[main]
title = My App Development Server
panels = frontend,api,database
Now suppose that the frontend outputs far more than the other two
programs, and we wish to dedicate more space to it. We can start by
adding a weight option to it, which will alter the ratio of how the
space is divided:
[frontend]
command = make -C frontend dev
weight = 2
Now the frontend will be twice as large as the other two
sections. This makes the other two rather squeezed in though, so maybe
it would be better to have them on top of each other rather than
sharing the space side by side. To do this, we can create a new
section, let's say backend, which instead of being command is a
definition of a subpanel:
[backend]
vertical = true
panels = api,database
The vertical option ensures that the two subpanels are stacked
vertically instead of horizontally. In the main section we now
reference the rhs section:
[main]
panels = frontend,backend
And we get the frontend on the left hand side of the terminal, and the two other programs on top of each other on the right hand side.
We might have a program which we want to regularly view the output of,
like what the watch command does. We can get a program to run at a
regular interval by passing the watch option to it, which denontes how
many seconds should pass before each time it is run. Let us update the
database into a section and give it the normal dev target to run it, but
also run the status command at a regular interval:
[database]
panels=database-status,database-run
[database-run]
title = Database Runner
command = make -C database dev
[database-status]
title = Database Status
command = make -C database status
watch = 5
We might want to make some of the commands stand out by changing their
background colour. To do this we can add the bg option to a command or
panel. Let's make the frontend have a blue background and the backend
have a green background:
[frontend]
command = make -C frontend dev
weight = 2
bg = #000088
[backend]
vertical = true
panels = api,database
bg = green
Now when we run minimux we can see the background effects applied to the two sides of the window.
Any attributes which are applied to an element are are inherited by any children of that element, so although we applied the green background colour to the backend panel, bot the api and database commands inherited it.
Finally, there are two other special sections, title and seperator
which we can also add attributes to. The title section will theme
the main title at the top of the window, and the seperator section
the seperator lines between sections. If instead of lines, we just
wanted black boxes to separate the commands we could write
[seperator]
fg = black
bg = black
and to make the title bold we can write
[title]
bold = on
And there we go - that covers pretty much everything minimux can be configured to do!
Complete reference
The following syntax is used:
x: Tdenotes thatxis of typeT...Tdenotes that all options of typeTare available
Section types
This enumerates the complete list of options available to different section types. Options ending with an ellipse denote that all the options for another section type are permitted.
Options which are marked with an asterisk are required for that section.
AttrCustomise how output is displayedfg: stringThe foreground colour, see 'Colours' for allowed values.bg: stringThe background colour, see 'Colours' for allowed valuesblink: boolAdd a blinking effectbold: boolDisplay in bold facedim: boolDisplay dimmedreverse: boolInvert the foreground and background coloursstandout: boolAdd a standout effectunderline: boolDisplay with an underline
ElementA window in the outputweight: intThe number of divisions of space the element should take up...Attr
CommandA command to tail the output ofcommand: string* The command to runtitle: stringA title to be displayed above the output of the commandtitle_attr: stringName of the section defining the attributes of the titlepadding: int | int,int | int,int,int,intPadding around command output. Either one value for all sides, x value followed by y value or top, right, bottom and left valuesinput: stringA string to passed as stdin to the programno_close_stdinIf set totrue, then the stdin of the program will not be closed. This is necessary for long-running programs which halt when stdin is closed (the main candidate beingtailwindcss)charset: stringThe charset to use to decode the program's outputcwd: stringThe directory from which to launch the programwatch: intIf set to a positive integer, the program will be run at a regular interval given in seconds by this option. If the program runs longer than this interval, it will be killed and restartedtabsize: intThe distance between tabstops in the rendered output...Element
PanelA 1D arrangement of elementspanels: list* A comma separated list of section names denoting the subpanels to displayvertical: boolIf true, subpanels are stacked vertically...Element
Well-known sections
These sections are known by the config parser and will be handled in a special manner
[main]: PanelThe entrypoint of the config which defines how the top level window will be split up[seperator]: AttrDefines how separators are displayed[title]: AttrDefines how the main window title is displayed
Colours
Colours can be defined in any of the following ways:
- Using a builtin colour name:
black,blue,cyan,green,magenta,red,whiteoryellow - Using a hex code, e.g.
#fa346f - Using an rgb code, e.g.
rgb(100, 23, 46)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minimux-2.0.0.tar.gz.
File metadata
- Download URL: minimux-2.0.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f979239e8e71d29c8f13228ba2672e3c22d5c782aa17c88bede5e5fa51a6bf3c
|
|
| MD5 |
ffd3b01e3da465b38726c4044a3eba44
|
|
| BLAKE2b-256 |
552985d32f7a8ec88f089f6a3e68bcbca38bc6d02e8d6bd495721fa1a20a9eab
|
Provenance
The following attestation bundles were made for minimux-2.0.0.tar.gz:
Publisher:
deploy.yaml on dominicprice/minimux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
minimux-2.0.0.tar.gz -
Subject digest:
f979239e8e71d29c8f13228ba2672e3c22d5c782aa17c88bede5e5fa51a6bf3c - Sigstore transparency entry: 774263800
- Sigstore integration time:
-
Permalink:
dominicprice/minimux@421a1fcd55766dffd5a3da0296f0a863f3eecb3c -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/dominicprice
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@421a1fcd55766dffd5a3da0296f0a863f3eecb3c -
Trigger Event:
release
-
Statement type:
File details
Details for the file minimux-2.0.0-py3-none-any.whl.
File metadata
- Download URL: minimux-2.0.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35ec5f7d46aaff9bfd1462868a5ed4cad94ca6931ae02ed1fb6f0ba9e9bc5d41
|
|
| MD5 |
75a6c4c92d4a7f3b992ceadc2a4e5dbc
|
|
| BLAKE2b-256 |
e8d8641013df332c9d7579ed008a92ec45d3c3920cf1109c4bf27fc548abd35f
|
Provenance
The following attestation bundles were made for minimux-2.0.0-py3-none-any.whl:
Publisher:
deploy.yaml on dominicprice/minimux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
minimux-2.0.0-py3-none-any.whl -
Subject digest:
35ec5f7d46aaff9bfd1462868a5ed4cad94ca6931ae02ed1fb6f0ba9e9bc5d41 - Sigstore transparency entry: 774263801
- Sigstore integration time:
-
Permalink:
dominicprice/minimux@421a1fcd55766dffd5a3da0296f0a863f3eecb3c -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/dominicprice
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@421a1fcd55766dffd5a3da0296f0a863f3eecb3c -
Trigger Event:
release
-
Statement type: