Coder Social home page Coder Social logo

tmux-attacher's Introduction

Tmux Attacher

Interactive wrapper for tmux to facilitate session attachment

Description

The tmux-attacher script provides an interactive prompt to easily attach to existing Tmux sessions or create new ones. It serves as a user-friendly interface to the tmux command, enhancing its default behavior

When invoked without arguments, tmux-attacher will present an interactive menu that allows the user to attach to pre-existing sessions or to create new ones.

In cases where one or more arguments are provided, tmux-attacher delegates those arguments to the tmux command, ensuring backward compatibility. This script's implementation follows the Proxy Design Pattern, intercepting invocations of the tmux(1) command and extending its functionality.

Usage

Invoke tmux-attacher without any arguments to get an interactive prompt:

❯ tmux-attacher
Available Tmux sessions:
joy: 6 windows (created Sat Sep 23 21:30:54 2023) (attached)
work: 4 windows (created Tue Sep 19 11:29:54 2023) (attached)

a -- Attach to an existing session.
n -- Attach to a new session.
q -- Cancel.
What should we do? [a,n,q]: a
Which session should we attach to? joy
Available Tmux sessions:
joy: 6 windows (created Sat Sep 23 21:30:54 2023) (attached)
work: 4 windows (created Tue Sep 19 11:29:54 2023) (attached)

a -- Attach to an existing session.
n -- Attach to a new session.
q -- Cancel.
What should we do? [a,n,q]: n
How should we name the new session? foobar

Provide any arguments to delegate them to the underlying tmux command:

tmux-attacher [arguments]

Installation

To install tmux-attacher, simply copy the script to somewhere on your $PATH. This script only depends on tmux.

Since it's backwards-compatible with tmux, it is safe to override it with an alias:

export alias tmux=tmux-attacher

Authors

tmux-attacher's People

Contributors

jpcenteno avatar

Watchers

 avatar  avatar

tmux-attacher's Issues

Package script as a Nix Flake, use Gum as a dependency

Motivation

This script is simple enough that it only depends on Tmux, making it a good project to learn how to write a Nix Flake.

Also, I wrote the user interface that way because I did not want to bother including any extra dependency, but I think that that it would benefit from using gum both in terms of UX and simplicity of implementation.

Add tmux as a dep to the nix flake, but let the user override it.

Motivation

On PR #5, I packaged this script as a Nix Flake, but I left out adding tmux as a dependency because I didn't know how to allow the user to override it.

Installing this using Nix Flakes without also installing tmux will fail silently,

Tasks

  • Research how to override a dependency in a nix flake.
  • Add tmux as a runtime dependency.

Add a video demo

Motivation

  • Learn how to make a video showcasing a CLI application.

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.