• Stars
    star
    2,289
  • Rank 20,117 (Top 0.4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 14 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.

Teamocil
Teamocil is a simple tool used to automatically create
windows and panes in tmux with YAML files.


Installation

# Install the `teamocil` Ruby gem
$ gem install teamocil

# Create your layout directory
$ mkdir ~/.teamocil

# Edit ~/.teamocil/sample.yml (look for sample layouts in this very `README.md`)
$ teamocil --edit sample

# Launch tmux
$ tmux

# Run your newly-created sample layout
$ teamocil sample

Usage

$ teamocil [options] [layout-name]

Global options

Option Description
--list Lists all available layouts in ~/.teamocil

Layout options

Option Description
--layout Takes a custom file path to a YAML layout file instead of [layout-name]
--here Uses the current window as the layout’s first window
--edit Opens the layout file with $EDITOR instead of executing it
--show Shows the layout content instead of executing it

Upgrading

Teamocil 1.0 is a complete rewrite (from scratch!) of Teamocil. The code is now very much simpler, cleaner and easier to maintain.

The downside of that is that several features were dropped during the rewrite process, mostly because I didn’t actually use/need them and I got tired of maintaining features I don’t think are useful.

You might have to clean up your layout files after upgrading to 1.0. I’m sorry about that. The documentation in README.md should help you find which keys are now supported.

The 0.4-stable branch is still available with the old code. Feel free to fork the repository and add back as many features as you want :)

Configuration

Session

Key Description
name The tmux session name
windows An Array of windows

Windows

Key Description
name The tmux window name (required)
root The path where all panes in the window will be started
layout The layout that will be set after all panes are created by Teamocil
panes An Array of panes
focus If set to true, the window will be selected after the layout has been executed
options A Hash of options that will be set with the set-window-option command

Panes

A pane can either be a String or a Hash. If it’s a String, Teamocil will treat it as a single-command pane.

Key Description
commands An Array of commands that will be ran when the pane is created
focus If set to true, the pane will be selected after the layout has been executed

Examples

Simple two pane window

windows:
  - name: sample-two-panes
    root: ~/Code/sample/www
    layout: even-horizontal
    panes:
      - git status
      - rails server
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Simple three pane window

windows:
  - name: sample-three-panes
    root: ~/Code/sample/www
    layout: main-vertical
    panes:
      - vim
      - commands:
        - git pull
        - git status
      - rails server
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |------------------|
|                  | (2)              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Simple four pane window

windows:
  - name: sample-four-panes
    root: ~/Code/sample/www
    layout: tiled
    panes:
      - vim
      - foreman start web
      - git status
      - foreman start worker
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|------------------|------------------|
| (2)              | (3)              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Two pane window with focus in second pane

windows:
  - name: sample-two-panes
    root: ~/Code/sample/www
    layout: even-horizontal
    panes:
      - rails server
      - commands:
          - rails console
        focus: true
.------------------.------------------.
| (0)              | (1) <focus here> |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Extras

Zsh autocompletion

To get autocompletion when typing teamocil <Tab> in a zsh session, add this line to your ~/.zshrc file:

compctl -g '~/.teamocil/*(:t:r)' teamocil

zsh-completions also provides additional completion definitions for Teamocil.

Bash autocompletion

To get autocompletion when typing teamocil <Tab> in a bash session, add this line to your ~/.bashrc file:

complete -W "$(teamocil --list)" teamocil

Fish autocompletion

To get autocompletion when typing teamocil <Tab> in a fish session, add the following file ~/.config/fish/completions/teamocil.fish with the following content:

complete -x -c teamocil -a '(teamocil --list)'

Custom window layout

Teamocil supports all the window layout names supported by tmux.

  • even-horizontal
  • even-vertical
  • main-horizontal
  • main-vertical
  • tiled

However, it also supports the custom format understood by tmux. This is especially useful if you want to manually resize your panes and keep using that layout in the future.

You can grab the layout for the current window by running this command:

tmux list-windows -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f 2

You can then use the result as the layout key for any Teamocil window object.

windows:
  - name: sample-two-uneven-panes
    layout: 00c7,158x38,0,0[158x9,0,0,37,158x28,0,10,39]
    panes:
      - echo foo
      - echo bar

Contributors

Feel free to contribute and submit issues/pull requests on GitHub, just like these fine folks did:

License

Teamocil is © 2011-2016 Rémi Prévost and may be freely distributed under the MIT license. See the LICENSE.md file for more information.

More Repositories

1

her

Her is an ORM (Object Relational Mapper) that maps REST resources to Ruby objects. It is designed to build applications that are powered by a RESTful API instead of a database.
Ruby
2,048
star
2

annyong

Annyong starts a public static Web server in the current directory, allowing people in your local network to browse your files.
Ruby
123
star
3

pubwich

(This project is non-longer maintained) Pubwich is an open-source PHP Web application that allows you to aggregate your published data from multiple Websites and services into a single HTML page.
PHP
64
star
4

dotfiles

All my dotfiles (vim, zsh, tmux, etc.) in a single place
Vim Script
43
star
5

plug_canonical_host

PlugCanonicalHost ensures that all requests are served by a single canonical host.
Elixir
35
star
6

pentadactyl-files

My personal Pentadactyl configuration files
JavaScript
20
star
7

emojibot

Emojibot is a Slack bot that announces new custom emoji to a specific channel.
Elixir
18
star
8

plug_best

PlugBest parses HTTP “Accept-*” headers and returns the best match based on a list of values.
Elixir
12
star
9

plug_letsencrypt

PlugLetsEncrypt responds to Let’s Encrypt domain verification requests.
Elixir
11
star
10

her-example

This is an example of how Her can be used to create an application powered by a RESTful API.
Ruby
9
star
11

portugal

ActiveRecord migrations without Rails
Ruby
7
star
12

utilise.ca

Le code source de l'application Jekyll qui propulse utilise.ca
CSS
7
star
13

nid

A small Sinatra app to host, mirror and filters your own tweets.
Ruby
6
star
14

venyr

Broadcast your current Rdio playback via WebSockets and let others listen to it.
Ruby
6
star
15

lengthy

Lengthy is a Google Chrome/Chromium extension that adds a table of contents to README files on GitHub.
JavaScript
5
star
16

cryptocurrency-ticker

A cryptocurrency ticker that outputs HTML to use with GeekTool on macOS.
Shell
4
star
17

sinatra-kickstart

A typical structure for a Sinatra application.
Ruby
3
star
18

wp-francophone

A small WordPress plugin to add a few french-specific filters and actions.
PHP
3
star
19

waq-2012

Le code de ma présentation au WAQ 2012, « Introduction à Ruby »
Ruby
2
star
20

has_json_fields

Store JSON-encoded Ruby hashes in database fields
Ruby
2
star
21

wpmu-htmlelements

WordPress MU plugin to add custom elements to WPMU’s set of restricted HTML tags.
PHP
2
star
22

netman

A network manager for mIRC (circa 2004)
2
star
23

tumbz

Her-powered Ruby wrapper to interact with the Tum.bz API
Ruby
2
star
24

css-background-position

A small experiment to show the *huge* difference tweaking your background-position makes.
2
star
25

usualweather-web

The Web client for usualweather.in
JavaScript
2
star
26

flahoo

Little experiment with Django and Yahoo! Search + Flickr API
Python
2
star
27

iphonedevcampqc

Les fichiers de ma présentation au iPhone + iPad DevCamp Qc
Ruby
1
star
28

surely

Surely watches your screenshots directory and upload new files to your imgur account.
Ruby
1
star
29

advent-of-code

Elixir
1
star
30

gaston

Gaston is a Slack bot that snitches on users who remove/edit their messages from channels.
Elixir
1
star
31

wp-sample-plugin

A small sample OOP WordPress plugin
PHP
1
star
32

opencode-her

These are the files I used to present Her at the 5th OpenCode on July 17th 2012.
Ruby
1
star
33

drano

Drano is a queue cleaner for SQS. It connects to a queue as a worker, and then prints each message. Nothing else.
Ruby
1
star
34

mono.growlstyle

The Mono Webkit style for Growl.
1
star
35

Venyr.ecoute

A skin for Ecoute.app
JavaScript
1
star
36

appstoreorapplestore.com

A small one-pager website that explains the difference between the “App Store” and ”Apple Stores”, which are quite easy to mix up for french-speaking people.
Ruby
1
star
37

github-actions-concurrency-experiments

Experimentations using GitHub Actions concurrency features
1
star
38

usualweather-data

The data files used to populate usual-weather-api’s database.
Ruby
1
star
39

brave-accept-language-override

A quick proof-of-concept to explore Brave’s override of the Accept-Language header
HTML
1
star
40

mi_hermano

“Did you know that 'fratello' means 'brother' in Italian? Strange I know that. I took four years of Spanish.” Mi Hermano translates strings using the Google Spreadsheets API (since the Translate API is no longer available).
Ruby
1
star
41

notes.exomel.com

Les notes de Rémi Prévost — vim, git, ruby, html5 et autres buzzwords.
Ruby
1
star