Skip to main content

A CLI tool to help manage your tmux sessions

Project description

Hivemux

Hivemux is a cli tool allowing easy management of your tmux environments.

What Hivemux provides the following features:

  • create pre-defined sessions based on projects found in your workspace
  • join pre-started session if one already exists in your environment

Installation

pipx install hivemux

Configuration

Hivemux can be configured through a TOML file in $HOME/.config/hivemux/config.toml.

If you have XDG_CONFIG_HOME or XDG_CONFIG_DIRS set, Hivemux will look in these locations as described in the XDG specification.

Hivemux works well without a config file set, by default, it acts with the default values described below.

config.toml

# Path to your workspace containing all your projects
workspace_path = "~/workspace"

# Pattern to match to find all the projects in the first level of your workspace folder. Must match Python's Path.glob() definition https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob
workspace_markers = ["*/.git"]

# Additional search paths to add to your list of projects. The list is taken as-is and added to the project list.
additional_search_paths = []

# .hmrc file used to define how to create the session for all projects
hmrc = """
  new-session -d -c {{cwd}} -s {{session}} -n source nvim .
  new-window -c {{cwd}} -t {{session}} -n shell
  select-window -t {{session}}:source
"""

A note on hmrc

Hivemux creates TMUX sessions based on a template. By default, this template lives in the Hivemux code unless overriden by the config.toml file. This gives the ability to define a personal and custom session creator.

To override the default hmrc, the config.toml file provides a field called hmrc that will be used instead of the default hmrc script provided by Hivemux.

A hmrc file can also be created per project. For example, if your project is under $HOME/workspace/my_project, you can override the global hmrc file with a file $HOME/workspace/my_project/.hmrc

The content of the hmrc file is parsed through Jinja and therefore allows for some templating.

The following variables are passed to the template:

  • session: name of the session
  • cwd: absolute path of the project

After the rendering of the template is done, the content is passed directly to tmux without modifications.

The commands defined in the TMUX documentation can all be used.

What must the hmrc file contain

A hmrc script must contain the following line at the beginning.

new-session -d -c {{cwd}} -s {{session}}

This allows tmux to create the session without attaching to it, allowing Hivemux to finish its execution.

If you want, you can always add other flags to the new-session command such as -n or even a shell command.

Usage

hm --help

hm list-projects

hm attach myproject or hm a myproject

Shell auto-completion

ZSH

In your .zshrc, add the following line.

eval "$(_HM_COMPLETE=zsh_source hm)"

bash

In your .bashrc, add the following line.

eval "$(_HM_COMPLETE=bash_source hm)"

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

hivemux-0.0.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hivemux-0.0.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file hivemux-0.0.2.tar.gz.

File metadata

  • Download URL: hivemux-0.0.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hivemux-0.0.2.tar.gz
Algorithm Hash digest
SHA256 27fd39deca0aa5c66aa1f355db9f5e45b92ac9aceeba8ae524221acea17f04d0
MD5 a6aa29ac5e5b5a4828f055846a8f9629
BLAKE2b-256 292791c60ae3241a2de501a03e5f96ec0bbacd2b6032dcd76ab5e02216952e1d

See more details on using hashes here.

File details

Details for the file hivemux-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hivemux-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hivemux-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c33bcfc18729022642a6d1701c00c8870c9b6b3ef0089cd42c13436e0eecf93
MD5 42c8ce6f7afb3c6a469b3b9da75f9a43
BLAKE2b-256 647f9ade876fcb992ea10ac3c81f8f77569a0830d723d1c1a428fead658b0811

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page