Automatically create windows and panes in Wezterm (like Teamocil and iTermocil).

Overview

Introduction

Weztermocil allows you to setup pre-configured layouts of windows and panes in Wezterm, having each open in a specified directory and execute specified commands. You do this by writing YAML files to save your layouts.

This project was inspired by Teamocil and iTermocil, and was designed to be able to use your existing Teamocil and iTermocil configuration files.

weztermocil-showcase.mp4

Weztermocil is still very early days, and things may break!

Installation

Homebrew

# Install `weztermocil` via Homebrew
# This may take a while to complete as it's building from source
$ brew update
$ brew install alexcaza/weztermocil 

Nix

The recommended way is to use an overlay within NixOS or home-manager.

If this package becomes stable, I might release it officially through nixpkgs.

(self: super: 
  let
    src = super.fetchFromGitHub {
      owner = "alexcaza";
      repo = "weztermocil";
      rev = "v0.1.4";
      hash = "sha256-9NWhGnLxZtHKHAUZ3Ha5NlMMZ7RZ0Irc50HyILX1MjA=";
    };
in {
    weztermocil = super.callPackage src {};
})

Post-install

# Create your layout directory
$ mkdir ~/.weztermocil

# Open a new sample file with your editor of choice (look for sample layouts in this very `README.md`)
# There are also a variety of example files in the 'samples' directory of this repo
$ $EDITOR ~/.weztermocil/sample.yml

# Run your newly-created sample layout
$ weztermocil sample

# Note that you can also use ~/.teamocil or ~/.itermocil as your directory, if you're a teamocil/itermocil user.

Usage

$ weztermocil [options] [layout-name]

Alternatively, if you have a weztermocil.yml file in the current directory you can simply run weztermocil and it will use that file, so you can have files inside your projects and sync via Github etc:

$ cd my_project
$ weztermocil

You can also add local layouts to a project by adding a .weztermocil directory. When calling weztermocil --list, you'll see the available layouts in the current directory listed as well.

To use a local layout, simply call it by name.

$ mkdir .weztermocil
$ touch .weztermocil/sample.yml
$ weztermocil sample

Weztermocil will follow this lookup path:

  • No layout name supplied
    • look for weztermocil.yml file in current directory.
  • Layout name supplied
    • Look for layout in local .weztermocil folder
    • Look for layout in global ~/.weztermocil folder

Global options

Weztermocil should be compatible with all of teamocil and itermocil's flags, and they should all work the same way.

Option Description
--list Lists all available layouts in ~/.weztermocil
--help Show all the options available to you

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

YAML Options

Session

Key Description
windows An Array of windows/tabs

Windows

Key Description
name The window/tab name
root The path where all panes in the window will be started
layout The layout that will be used by Weztermocil
panes An Array of panes
focus If set to true, the window will be selected after the layout has been executed

Panes

A pane can either be a String or a Hash. If it’s a String, Weztermocil 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 weztermocil <Tab> in a zsh session, add this line to your ~/.zshrc file:

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

zsh-completions also provides additional completion definitions for Teamocil.

Bash autocompletion

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

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

Fish autocompletion

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

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

Thanks

This was heavily inspired by Teamocil and iTermocil. Without these 2 projects, I wouldn't have decided to make the same thing for Wezterm.

License

Weztermocil is © 2024 Alex Caza and may be freely distributed under the MIT license. See the LICENSE.md file for more information.

You might also like...
A cli tool to automatically download and upload advent of code problems.

Advent of Code CLI CLI client for advent of code. The purpose of this tool is so you don't have to leave your editor while participating (if you are l

Mac App/CLI that automatically adds project logos to your locally cloned GitHub repos
Mac App/CLI that automatically adds project logos to your locally cloned GitHub repos

Download the app Automatically adds project logos to your locally cloned GitHub repos. Youtube Video This repository contains the source code for the

Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux.

Load Symbols Binary Ninja plugin written in Rust to automatically apply symbol information from split debug info on Linux. Requirements Last tested wi

This automatically patches the RoPro extension for you, allowing you to have pro_tier for free.

RoPro Patcher This automatically patches the RoPro extension for you, allowing you to have pro_tier for free. NOTE Chrome, Brave (and possibly other b

STKLR is a tool to help you automatically link up named stuff in your rust docs!

_____ _______ _ ___ _____ / ____|__ __| |/ / | | __ \ | (___ | | | ' /| | | |__) | \___ \ | | | | | | _ / ___

Middleware/ios shortcut to setup alarms automatically based on the first class

Webuntis alarm This is a small little "middleware" / web server intended to connect to a webuntis timetable used in german schools which i wrote when

Plex webhook service to automatically update your Anilist watching list.

anifunnel Plex webhook service to automatically update your Anilist watching list. Description anifunnel is a web server that will consume incoming Pl

Automatically commit all edits to a wip branch with GPT-3 commit messages

gwipt Automatic work-in-progress commits with descriptive commit messages generated by GPT-3 Codex Never again worry about the tension between "commit

Automatically verify your [Partial]Eq/Ord invariants

Reltester Relation tester is a small testing utility for automatically checking the correctness of PartialEq, PartialOrd, Eq, and Ord implementations.

Owner
Alex Caza
Product Engineer @ Unsplash An infinite tinkerer, creator, and learner who loves turning ideas into reality. Prev: Fluent, Firstbloom, Sportlogiq.
Alex Caza
Automatically dim windows in Hyprland when switching between them.

hyprdim hyprdim is a daemon that automatically dims windows in Hyprland when switching between them. Features Easily see which window has focus, even

Donovan Glover 3 Aug 13, 2023
Use Thunk to build your Rust program that runs on old Windows platforms, support Windows XP and more!

Use Thunk to build your Rust program that runs on old platforms. Thunk uses VC-LTL5 and YY-Thunks to build programs that support old platforms. So, ho

null 6 May 21, 2023
Windows-rs - Rust for Windows

Rust for Windows The windows crate lets you call any Windows API past, present, and future using code generated on the fly directly from the metadata

Microsoft 7.7k Dec 30, 2022
Switch windows of same app with alt + ` on windows pc.

Windows Switcher Switch windows of same app with alt + ` on windows pc. 250k single file executable downloaded from Github Release. No installation re

null 172 Dec 10, 2022
Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)

is-wsl Check if the process is running inside Windows Subsystem for Linux (Bash on Windows) Inspired by sindresorhus/is-wsl and made for Rust lang. Ca

Sean Larkin 6 Jan 31, 2023
Windows Capture Simple Screen Capture for Windows 🔥

Windows Capture   Windows Capture is a highly efficient Rust library that enables you to effortlessly capture the screen using the Graphics Capture AP

null 3 Sep 24, 2023
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
A command-line tool and Docker image to automatically backup Git repositories from GitHub or anywhere

A command-line tool and Docker image to automatically backup Git repositories from GitHub or anywhere

Jake Wharton 256 Dec 27, 2022
A CLI tool which can help you automatically kill process of your choice. Useful for freeing up memory and CPU usage!

Quickiller There are always programs such as chrome that keep eating up your resources even when closed! The only way to prevent this is to kill all o

Codingsquirrel 1 Dec 8, 2021
Tracing layer that automatically creates and manages progress bars for active spans.

tracing-indicatif A tracing layer that automatically creates and manages indicatif progress bars for active spans. Progress bars are a great way to ma

Emerson Ford 95 Feb 22, 2023