• Stars
    star
    335
  • Rank 125,904 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 4 years ago

Reviews

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

Repository Details

Automate your iTerm layouts and session setup

iTomate

Automate your iTerm layouts and session setup

Define your iTerm layouts, commands to execute in the form of yaml files and run a single command to have iTerm prepare itself for you to start working.

Requirements

  • iTerm2 Version 3.3 or later
  • Python 3.5 or later

Installation

Make sure that you are running Python 3.5 or later

pip install itomate

Enable Python API usage in iTerm preferences.

itomate --version

Example

The layout, number of panes, tabs, titles and commands is configurable and is detailed below.

Usage

Open iTerm and simply run the below command

itomate -c config.yml

If you don't provide -c flag, itomate will look for itomate.yml file in the current directory and use that.

Here is the list of options available

itomate [-c,--config <config-file>] # Sets up the iTerm session
        [-h,--help]                 # Shows the help screen
        [-v,--version]              # Shows the installed itomate version
        [-n,--new]                  # Runs itomate in a new window

Configuration

Configuration file to set up the sessions has the format below

version: "1.0"
profile: "My Profile"
tabs:
  window-1:
    root: "~/Documents/Projects/my_project"
    title: "Window 1"
    panes:
      - title: "Some Pane Title"
        position: "1/1"
        commands:
         - !ENV "db authenticate ${DB_PASSWORD}"
         - "second command"
        prompt: "populated command"
      - position: "1/2"
        focus: true
        badge: "Jobs"
      - position: "2/1"
      - position: "2/2"
  window-2:
    title: "Window 2"
    panes:
      - position: "1/1"
      - position: "1/2"
      - position: "2/1"

Details for each of the configuration objects above is given below

Key Description
version Refers to the itomate configuration version. Should always be 1.
profile Name of the profile you would like to use for all panes. If using -n argument to launch a new window, then window specific profile settings will be applied
tabs Windows or tabs in the iTerm window.
window-1 Replace with the unique project id e.g. web-catalog-pim
root Root path for all panes within a tab
title Title to be shown in the title bar of the current tab
badge Set the Badge Text of the pane
position Position of the pane in the window. It has the format of number1/number2 where number1 refers to the column and number2 refers to the row in the column. More on this later in the readme. position is the only required key in a pane
focus Pane to be in focus when itomate is finished. focus: true. There should only be one focus flag per Tab. If multiple are found, it will focus on the last pane evaluated.
commands List of commands to execute in the current pane.
prompt A command which will remain populated in the prompt after all commands have finished executing. The prompt command itself is not executed automatically.

Environment Variables

Operating System Environment Variables can be used to create templates with secrets and variables. This allows itomate files to be safely committed to version control. Note in the above configuration example the line using the environment variable is prefixed with the !ENV tag and then uses one or more Environment Variables wrapped in the ${ } syntax.

Layouts

The parameter position in each pane decides where each of the window panes will be displayed. The position value has the format below

x / y – both x and y are required parameters

x: refers to the column in the window
y: refers to the row of the given column x

Here are some of the examples for different pane layouts

Single Pane Window

For single pane, since there is one column and one row, the position for pane would be 1/1

.------------------.
| 1/1              |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
'------------------'

Here is how the configuration would look like

version: "1.0"
tabs:
  some-project:
    title: "Some Project"
    panes:
      - title: "Single Pane"
        position: "1/1"
        commands:
          - "cd ~/Workspace/some-project"
          - "git pull origin master"
          - "yarn dev"

Two Panes Vertical Split Layout

For two panes with equal split or in other words two columns with one row in each, the positions would be 1/1 for the pane on the left and 2/1 for the pane on the right i.e. the second column.

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Here is how it would look in the configuration

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/some-project"
    title: "Some Project"
    panes:
      - title: "First Half"
        position: "1/1"    # <-- Notice the position
      - title: "Second Half"
        position: "2/1"    # <-- Notice the position

Two Columns, Three Panes Layout

The layout below now has two columns. First column has only one row so position for that would be 1/1. For the second column we have two panes i.e. two rows; first pane in the second column would be 2/1 and the second one would be 2/2.

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |------------------|
|                  | 2/2              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Configuration for that would be:

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/dev-server"
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
      - position: "2/1"    # <-- Notice the position
        commands:
          - "./run"
      - position: "2/2"    # <-- Notice the position
        commands:
          - "git standup"

Note that the commands and title are optional parameters in panes. Only position is required.

Two Columns, Four Panes Layout

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|------------------|                  |
| 1/2              |                  |
|                  |                  |
|                  |                  |
|------------------|                  |
| 1/3              |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Configuration for that would be:

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/project"
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
        commands:
          - "Make clean"
      - position: "1/2"    # <-- Notice the position
        commands:
          - "git standup"
      - position: "1/3"    # <-- Notice the position
        commands:
          - "git standup"
      - position: "2/1"    # <-- Notice the position
        commands:
          - "./run"

Three Columns Five Pane Layout

.------------------.------------------.------------------.
| 1/1              | 2/1              | 3/1              |
|                  |                  |                  |
|                  |                  |                  |
|                  |                  |                  |
|                  |------------------|                  |
|                  | 2/2              |                  |
|                  |                  |                  |
|                  |                  |                  |
|                  |------------------|                  |
|                  | 2/3              |                  |
|                  |                  |                  |
|                  |                  |                  |
'------------------'------------------'------------------'

Configuration for that would be

version: "1.0"
tabs:
  some-project:
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
      - position: "2/1"    # <-- Notice the position
      - position: "2/2"    # <-- Notice the position
      - position: "2/3"    # <-- Notice the position
      - position: "3/1"    # <-- Notice the position

Contributors

Special thanks to the contributors for making iTomate possible

Similar Projects

There is itermocil which relies on Applescript that has been deprecated by iTerm, has limited layout options, and is pretty limited in terms of what it can achieve because of AppleScript. iTomate on the other hand uses iTerm's newly introduced Python API, has flexible layouts support and can be extended using iTerm's pretty powerful API.

Contributions

Feel free to submit pull requests, create issues, spread the word.

License

MIT © Kamran Ahmed

More Repositories

1

developer-roadmap

Interactive roadmaps, guides and other educational content to help developers grow in their careers.
TypeScript
293,915
star
2

design-patterns-for-humans

An ultra-simplified explanation to design patterns
45,135
star
3

driver.js

A light-weight, no-dependency, vanilla JavaScript engine to drive user's focus across the page
TypeScript
22,682
star
4

git-standup

Recall what you did on the last working day. Psst! or be nosy and find what someone else in your team did ;-)
Shell
7,605
star
5

pennywise

Cross-platform application to open any website or media in a floating window
JavaScript
3,761
star
6

githunt

Hunt the most starred projects on any date on GitHub
JavaScript
2,863
star
7

roadmap.sh

Community driven roadmaps, articles and resources for developers
Nunjucks
2,196
star
8

jquery-toast-plugin

Highly customizable jquery plugin to show toast messages
JavaScript
1,511
star
9

brusher

Create beautiful webpage backgrounds
JavaScript
748
star
10

tab-switcher

Chrome Extension - Switch between the opened tabs in the blink of an eye
JavaScript
445
star
11

aws-cost-cli

CLI tool to perform cost analysis on your AWS account with Slack integration
TypeScript
416
star
12

datastructures-in-javascript

Illustrated Data Structures — Video Series
JavaScript
175
star
13

kamranahmedse.github.io

Blog created using github-pages-blog-action
HTML
166
star
14

awesome-minimal-sites

An opinionated collection of minimal yet beautiful websites.
158
star
15

local-ses

Trap and test AWS SES emails locally
TypeScript
157
star
16

pipeline-js

Pipeline pattern implementation with the support for sync and async stages
JavaScript
147
star
17

github-pages-blog-action

Create good looking blog from your markdown files in a GitHub repository
CSS
87
star
18

redux-persist-expire

Expiring transformer for redux-persist
JavaScript
78
star
19

css-tailor

✂ Automatically generate CSS from your HTML classes
JavaScript
68
star
20

stylos

Webpack plugin to automatically generate and inject CSS utilities to your application
JavaScript
67
star
21

git-first

Chrome Extension – Takes you to the first commit of a GitHub repository
JavaScript
66
star
22

express-api-problem

Express package to automatically turn your exceptions to the API Problem JSON response
TypeScript
65
star
23

laravel-faulty

Automatically turn your thrown exceptions to JSON response while conforming to API problem specification
PHP
64
star
24

smasher

Smash your directories to get JSON or Array representation and vice versa.
PHP
60
star
25

laravel-modular-boilerplate

A boilerplate to create modular application in laravel 5.1
PHP
59
star
26

copy-marker

Chrome extension — Create URLs with highlighted page selection
JavaScript
55
star
27

beetle

Abuse unicode to incite mayhem
Shell
53
star
28

db-playground

Easily create a sandbox environment for your database exploration.
Shell
50
star
29

jumper-bot

A game developed using HTML-5 canvas and Javascript
JavaScript
50
star
30

laravel-censor

A middleware for Laravel 5.* to easily redact or replace the words from the pages you want.
PHP
43
star
31

github-notable-comments

Chrome Extension – Navigate through the most reacted comments in github issues and PRs
JavaScript
40
star
32

gulp-css-tailor

✂ Gulp plugin to automatically generate CSS from your HTML classes
JavaScript
39
star
33

github-diffs

Easier code reviews by collapse/expand diffs in pull requests
JavaScript
35
star
34

laraformer

Laravel 5.* package to easily introduce a transformation layer for your data
PHP
32
star
35

brainza-fps-unity3d-game

First person shooter 3d game.
ASP
31
star
36

makers.ae

Community of makers in UAE
TypeScript
31
star
37

node-basic-auth-example

Sample implementation of Basic Authentication in Node.js
JavaScript
25
star
38

github-actions-youtube

Codebase for my youtube video on GitHub actions
HTML
25
star
39

php-shorthand

Calculate unique shorthands for a given set of strings
PHP
25
star
40

node-session-auth-example

Sample implementation of Session Authentication in Node.js
JavaScript
23
star
41

promises-examples

Codebase accompanying my YouTube video: All about Asynchronous JavaScript
23
star
42

mongo-playground

Single command to setup MongoDB playground with different datasets
Shell
22
star
43

tweet-counter

Chrome Extension - Bring back the character counters in tweet boxes
JavaScript
20
star
44

mongodumper

Docker image to back up MongoDB database and upload to S3
Shell
18
star
45

slack-msg

Dead simple CLI tool to send messages to Slack
JavaScript
18
star
46

gcuf-news-caster

Google Chrome Extension that shows the latest news from GCUF Website
JavaScript
17
star
47

mondex

CLI tool to create and manage MongoDB indexes using code
TypeScript
16
star
48

walkers

A console based fan fiction RPG for The Walking Dead TV Series
PHP
14
star
49

ng-atlas

An Angular JS application that lets you tour around the globe ..free of cost ;-)
JavaScript
13
star
50

markdown-it-class

Plugin for markdown-it to allow adding classes to HTML tags.
JavaScript
10
star
51

egghead-mongo-aggregation

Codebase for my "Aggregation in MongoDB" videos on Egghead
JavaScript
10
star
52

yaml-sample

JavaScript
8
star
53

sendy

Dockerized Sendy application with one-click deployment setup for Railway.
Shell
7
star
54

kamranahmedse

7
star
55

mulk

Gets the country details by country name, ITU or ISO codes
JavaScript
4
star
56

astro-view-transitions-bug

JavaScript
3
star
57

github-user-activity

JavaScript
3
star