Slice and dice your TMUX windows and panes

chaakoo

Test

  1. Introduction
  2. Configuration
  3. Using Chaakoo
  4. Examples
  5. Download
  6. License

Introduction

Chaakoo is a wrapper over TMUX that can create sessions, windows and panes from a grid based layout. The idea here is inspired by the CSS grid template areas.

For example, this grid:

vim  vim  vim  term
vim  vim  vim  term
play play play play

will create the following layout:

window1

The layout can be a little complex too based on the further pane divisions, like,

arandr  arandr  bzip    cat
vim     vim     err     cat
vim     vim     file    file
grafana grafana grafana grafana
grafana grafana grafana grafana

window2

Configuration

A configuration yaml for one window with 3 panes, like, the first example, is here:

name: code-environment
windows:
  - grid: |
      vim  vim  vim  term
      vim  vim  vim  term
      play play play play
    name: window1
    commands:
      - pane: vim
        command: |
          vim
      - pane: term
        command: |
          cd ~
          systemctl status
        workdir: /home/waterbottle/code
      - pane: play
        command: |
          tail -f /var/log/messages
  • name is the TMUX session name
  • windows is an array of windows
  • Each window contains
    • name - The name of the window
    • grid - 2D layout or the grid, each distinct name in the layout represents a pane.
    • commands is an array of the commands that will be executed in a pane
    • Each command object contains:
      • pane - Name of the pane
      • command - Can contain multi line text for the commands
      • workdir - Pane's first directory. It can further be changed by cd present in command

Note: The commands section or commands for a pane are not a required field. Chaakoo can just be used to create the pane layout and then the user can take over and execute their commands.

Using Chaakoo

  • Starting a session
# Start a TMUX server
$ tmux start-server

# and then pass the config to Chaakoo
$ chaakoo -c examples/1/chaakoo.yaml 
4:43PM ERR github.com/pallavJha/chaakoo/tmux_wrapper.go:349 > unable to get the list of the present sessions error="exit status 1" sessionName=code-environment stderr="no server running on /tmp/tmux-1000/default\n" stdout=
4:43PM INF github.com/pallavJha/chaakoo/cmd/chaakoo.go:66 > session created successfully, it can be attached by executing:
4:43PM INF github.com/pallavJha/chaakoo/cmd/chaakoo.go:67 > tmux a -t code-environment

# Attach the TMUX session
$ tmux a -t code-environment
  • Starting with the --verbose or -v flag will set the log level to DEBUG and time format to RFC3339
$ chaakoo -c examples/1/chaakoo.yaml -v
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:128 > setting global log level to DEBUG as verbose log is enabled
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:98 > using examples/1/chaakoo.yaml
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:114 > using config file: examples/1/chaakoo.yaml
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:50 > finding the dimensions
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:56 > found dimensions height=81 width=274
-- more logs --
  • For more info:
$ chaakoo --help
chaakoo converts the 2D grids or matrix into TMUX windows and panes

Usage:
  chaakoo [flags]

Flags:
  -c, --config string   config file (default is ./chaakoo.yaml)
  -d, --dry-run         if true then commands will only be shown and not executed
  -e, --exit-on-error   if true then chaakoo will exit after it encounters the first error during command execution
  -r, --height int      terminal dimension for rows or height, if 0 then rows and cols will be found internally
  -h, --help            help for chaakoo
  -v, --verbose         enable verbose logging
  -V, --version         print the version
  -w, --width int       terminal dimension for cols or width

Examples

There are more examples present in the examples directory with configurations and snapshots.

Download

The latest binary can be downloaded from the latest GitHub release. The binaries are statically linked.

License

Copyright 2021 Pallav Jha

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Owner
Pallav Jha
https://stackoverflow.com/cv/pallavjha
Pallav Jha
Comments
  • "Standard" go install support

    Hi,

    Found your tool through your post on Reddit, thank you, and it's a very promising tool.

    However, one thing that IMO is lacking is the support to install the binary the standard way (go install ...@latest for go 1.16+). If you want, you can also support the old way of doing go get ....

    This for me personally is a blocker because go install is the way I use to install plugins, without the hastle of searching Github for the latest release, download, chmod, copy to PATH, etc.

    Of course, just a friendly suggestion :slightly_smiling_face:

  • Can't read YAML file with -c option

    Can't read YAML file with -c option

    I'm having what's probably a silly issue, but having trouble getting to the bottom of it. Reading the YAML file from its default location works (./chaakoo is just this) -

    scripts -> tmux start-server
    scripts -> chaakoo
    10:35AM ERR ../../go/pkg/mod/github.com/pallav!jha/[email protected]/tmux_wrapper.go:365 > unable to get the list of the present sessions error="exit status 1" sessionName=code-environment stderr="no server running on /private/tmp/tmux-503/default\n" stdout=
    10:35AM INF ../../go/pkg/mod/github.com/pallav!jha/[email protected]/cmd/root.go:66 > session created successfully, it can be attached by executing:
    10:35AM INF ../../go/pkg/mod/github.com/pallav!jha/[email protected]/cmd/root.go:67 > tmux a -t code-environment
    scripts -> tmux kill-server
    

    However, trying to open the same file as a -c argument makes it fail to read the config file:

    scripts -> tmux start-server
    scripts -> chaakoo -c chaakoo 
    10:36AM FTL ../../go/pkg/mod/github.com/pallav!jha/[email protected]/cmd/root.go:112 > cannot read the config file: chaakoo error="Unsupported Config Type \"\""
    

    I am on macOS 12.4 21F79 arm64.

  • Support multiple tabs

    Support multiple tabs

    Currently Chaakoo supports multiple panes within a single tab. But there is no provision for configuring multiple tabs. Multiple tabs will be helpful for running processes of different modules of a project, in different tabs.

    E.g: client side build services in a tab and server side build services in another.

  • multiple tmux sessions from single yaml file

    multiple tmux sessions from single yaml file

    Currently the yaml config file has a name field.

    If the Config file is used to create a tmux session, an error is thrown if another tmux session with same name exists. But, sometimes if we want to create multiple sessions from the same config file, it is not possible. The suggestion would be to allow multiple sessions to be created from one config file with the same name followed by a numbered suffix.

    Eg: If the name is hello then sessions can be created with names 'hello', 'hello-1', 'hello-2' and so on

    A practical use case would be creating multiple instances of vim + shell layout for each different project we on.

  • Create shorthands for the environments

    Create shorthands for the environments

    We should create shorthand for the configs so that users do not have to remember the full path.

    For example,

    Instead of always executing the following command with the path to the config

    $ chaakoo -c path-to-config-file -v
    

    create a shorthand

    $ chaakoo -c path-to-config -v --save --name my-playground
    

    and then it can launched using

    $ chakoo my-playground
    
Related tags
go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves
go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves

Pimp-My-Shell Table of Contents Pimp-My-Shell Install Usage About Resources Tmux Hotkeys VIM Hotkeys Adjusting Custom Aliases Mac Fix Terminal bind ke

Dec 22, 2022
Plugin which makes tmux work and feel like i3wm

Tmux Tilish This is a plugin that makes tmux behave more like a typical dynamic window manager. It is heavily inspired by i3wm, and most keybindings a

Jan 7, 2023
Trzsz-go - A simple file transfer tools, similar to lrzsz ( rz / sz ), and compatible with tmux

Trzsz-go - A simple file transfer tools, similar to lrzsz ( rz / sz ), and compatible with tmux

Dec 31, 2022
Are you programming and suddenly your stomach is rumbling? No problem, order your Ifood without leaving your favorite text editor ❤️

vim-ifood Você ta programando e de repente bateu aquela fome? Sem problemas, peça seu Ifood sem sair do seu editor de texto favorito ❤️ Are you progra

Jun 2, 2022
Procmon is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.
Procmon is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools for Windows. Procmon provides a convenient and efficient way for Linux developers to trace the syscall activity on the system.

Process Monitor for Linux (Preview) Process Monitor (Procmon) is a Linux reimagining of the classic Procmon tool from the Sysinternals suite of tools

Dec 29, 2022
A golang library for building interactive prompts with full support for windows and posix terminals.
A golang library for building interactive prompts with full support for windows and posix terminals.

Survey A library for building interactive prompts on terminals supporting ANSI escape sequences. package main import ( "fmt" "github.com/Alec

Jan 6, 2023
Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux.
Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux.

Command-line tool to customize the official Spotify client. Supports Windows, MacOS and Linux. Features Change colors whole UI Inject CSS for advanced

Jan 2, 2023
Command line tool for adding Windows resources to executable files

go-winres A simple command line tool for embedding usual resources in Windows executables built with Go: A manifest An application icon Version inform

Dec 27, 2022
go-colorable - Colorable writer for Windows
go-colorable - Colorable writer for Windows

go-colorable Colorable writer for windows. For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But

Dec 21, 2022
gif effects CLI. single binary, no dependencies. linux, osx, windows.
gif effects CLI. single binary, no dependencies. linux, osx, windows.

yeetgif Composable GIF effects CLI, with reasonable defaults. Made for custom Slack/Discord emoji :) Get it Alternative 1: go get Alternative 2: just

Dec 11, 2022
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows.

?? Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染

Dec 30, 2022
Windows API to hide console window by golang

Doge-Hide windows API to hide console window by golang ShowWindow ShowWindowAsy

Nov 7, 2022
ets2-dlc-repacker is a Windows / Linux / MacOS CLI util to automatically repack older DLC archives for compatibility with newer versions.
ets2-dlc-repacker is a Windows / Linux / MacOS CLI util to automatically repack older DLC archives for compatibility with newer versions.

ets2-dlc-repacker is a Windows / Linux / MacOS CLI util to automatically repack older DLC archives for compatibility with newer versions.

Dec 26, 2021
Golang-video-screensaver - A work in progress Microsoft Windows video screensaver implemented in Go

golang-video-screensaver A work in progress Microsoft Windows video screensaver

Sep 5, 2022
📣 `say` command for Windows written in Go

?? winsay say command for Windows powered by Microsoft Speech API Usage Just specify the text as arugument(s). The text will read aloud. Usage: wins

Dec 3, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021
Display a message in morse code on your capslock LED, keyboard backlight or using your screen brightness!
Display a message in morse code on your capslock LED, keyboard backlight or using your screen brightness!

halp halp is a command line utility that lets you display messages in morse code on your capslock LED, keyboard backlight (if you have it) or using yo

Jan 26, 2022
Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending

Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending

Nov 28, 2022
Watch your favourite anime using the video player of your choice directly from the command line

anime-cli Watch your favourite anime using the video player of your choice direc

Feb 10, 2022