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:
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
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
nameis the TMUX session name
windowsis 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.
commandsis 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
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.
- 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
-vflag will set the log level to
DEBUGand time format to
$ 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
There are more examples present in the examples directory with configurations and snapshots.
The latest binary can be downloaded from the latest GitHub release. The binaries are statically linked.
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
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.