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
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 ">
# 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
    
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Dec 3, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functional build process. This repository is intended as a quick reference to help others start similar projects using the referenced libraries and will not be actively maintained.

Dec 3, 2022
An example desktop system tray application that can launch HTML5 windows. Go source with a build process for Windows, Mac and Linux.

ExampleTrayGUI An example cross-platform (Mac, Windows, Linux) system tray application that can launch HTML5 windows, developed in Go including functi

Dec 3, 2022
W32find - Find parent windows and their children windows using win32api.

w32find Package w32find provides a set of interface to win32 APIs that can be used to find windows and their controls. Install go get -v github.com/mo

Jan 5, 2022
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

Jan 9, 2023
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Dec 28, 2022
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Jan 1, 2023
Windows API and GUI in idiomatic Go.
Windows API and GUI in idiomatic Go.

Windigo Win32 API and GUI in idiomatic Go. Overview The UI library is divided in the following packages: Package Description ui High-level UI wrappers

Dec 27, 2022
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly

Introduction Qt is a free and open-source widget toolkit for creating graphical user interfaces as well as cross-platform applications that run on var

Jan 2, 2023
A Windows GUI toolkit for the Go Programming Language
A Windows GUI toolkit for the Go Programming Language

About Walk Walk is a "Windows Application Library Kit" for the Go Programming Language. Its primarily useful for Desktop GUI development, but there is

Dec 30, 2022
Common library for Go GUI apps on Windows
Common library for Go GUI apps on Windows

winc Common library for Go GUI apps on Windows. It is for Windows OS only. This makes library smaller than some other UI libraries for Go.

Dec 12, 2022
Windows GUI framework for Go.

gform is an easy to use Windows GUI toolkit for Go It provides two approaches to create UI. 1. Pure code. gform.Init() mainWindow := gform.NewForm(ni

Jan 1, 2023
Windows GUI library for Go (Golang). Comes with a graphical UI designer.

Version 2 Please go to Version 2 of this library for the latest version. Windows GUI Library This is a pure Go library to create native Windows GUIs.

Jan 1, 2023
Zenity dialogs for Golang, Windows, macOS

Zenity dialogs for Golang, Windows and macOS This repo includes both a cross-platform Go package providing Zenity-like dialogs (simple dialogs that in

Dec 31, 2022
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.
Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.

XCGUI 项目文档 帮助文档 程序示例 介绍 English | 简体中文 DirectUI设计思想: 在窗口内没有子窗口,界面元素都是逻辑上的区域(无HWND句柄,安全,灵活), 所有UI元素都是自主开发(不受系统限制), 更加灵活的实现各种程序界面,满足不同用户的需求.

Dec 22, 2022
Wmi - One hot Go WMI package. Package wmi provides an interface to WMI. (Windows Management Instrumentation)

wmi Package wmi provides an interface to WMI. (Windows Management Instrumentation) Install go get -v github.com/moonchant12/wmi Import import "github.

Apr 22, 2022
Proof-of-concept Windows-like clipboard manager for Linux in Go

Goclip Simple Windows-like clipboard manager for linux. This application is just a proof-of-concept and might be highly unstable. Features Clipboard t

Jan 28, 2022
Calculate slope and r2 in your dataset for a defined rolling window
Calculate slope and r2 in your dataset for a defined rolling window

Hit The Slopes Calculate slope and r2 in your dataset for a defined rolling window. This is useful if you want to see the evolution of trends in your

Feb 9, 2022
Built Virtual Operating System and integrated application like calculator, gallery app , weather app, and text editor.
Built Virtual Operating System and integrated application like calculator, gallery app , weather app, and text editor.

Virtual Operating System Built Virtual Operating System and integrated application like calculator, gallery app , weather app, and text editor. Langua

Nov 2, 2021