Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tile

forthebadge forthebadge

Syntax and config generator for tiling window managers.

TL;DR

If you are using i3 or Sway check out the example below.

Installation

pip install tile

Usage

  1. Create input_file using Concepts below.
  2. Try it with tile input_file
  3. Write it to i3 config using tile --write input_file
  4. Write it to Sway config using tile --write --sway input_file

Check out tile --help for more options.

Concepts

Mapping types

tile supports two types of mappings:

  1. Command bindings for WM built-in commands:
INPUT:
$mod+f -> fullscreen toggle

OUTPUT:
bindsym $mod+f fullscreen toggle
  1. Exec bindings, which are self-explanatory
INPUT:
$mod+Return => xterm

OUTPUT:
bindsym $mod+Return exec --no-startup-id xterm

Alternatives

Alternatives express the idea that the same action should be bound to multiple key-bindings.

For example:

INPUT:
$mod+h/Left -> focus left

OUTPUT:
bindsym $mod+h focus left
bindsym $mod+Left focus left

Variables

Variables are shorter way to write bindings that have a similar structure.

E.g.:

INPUT:
$mod+{f,s} -> {fullscreen,split} toggle

OUTPUT:
bindsym $mod+f fullscreen toggle
bindsym $mod+s split toggle

Range expansion

Inside variables you can write 1-10 and it will be expanded to 1,2,3....

INPUT:
$mod+{1-4} -> workspace {100-103}

OUTPUT:
bindsym $mod+1 workspace 100
bindsym $mod+2 workspace 101
bindsym $mod+3 workspace 102
bindsym $mod+4 workspace 103

Variable reference

You can reference current value of the variable using @n syntax, where n is the variable index. Every variable is numbered (starting from 0) from left to right. E.g.:

foo {bar,{foo,bar}} {0-1} ...
    ^    ^          ^
    0    1          2

Use it like this:

INPUT:
$mod+Control+Shift {8-9,0} -> move container to workspace {8-10}; workspace @1

OUTPUT:
bindsym $mod+Control+Shift 8 move container to workspace 8; workspace 8
bindsym $mod+Control+Shift 9 move container to workspace 9; workspace 9
bindsym $mod+Control+Shift 0 move container to workspace 10; workspace 10

Or to avoid repeating long sequences:

INPUT:
$mod+x -> {[instance="calculator"]} scratchpad show; @0 move position center

OUTPUT:
bindsym $mod+x [instance="calculator"] scratchpad show; [instance="calculator"] move position center

Empty value

You can use empty value inside Variable, denoted by _. E.g.

INPUT:
$mod+{_,Shift+}h/Left -> {focus,move} left

OUTPUT:
bindsym $mod+h focus left
bindsym $mod+Left focus left
bindsym $mod+Shift+h move left
bindsym $mod+Shift+Left move left

Nesting

You can use Alternatives and Variables inside Variable to create many bindings at once.

INPUT:
the {{quick,brown},{fox,dog/beast}} => {xterm,kitty} -e echo {jumps,over}

OUTPUT:
bindsym the quick exec --no-startup-id xterm -e echo jumps
bindsym the brown exec --no-startup-id xterm -e echo over
bindsym the fox exec --no-startup-id kitty -e echo jumps
bindsym the dog exec --no-startup-id kitty -e echo over
bindsym the beast exec --no-startup-id kitty -e echo over

Additional syntax

Parenthesis

By default, special characters like space, plus sign, etc. are token separators.

INPUT:
$mod+p/Print => scrot

OUTPUT:
bindsym $mod+p exec --no-startup-id scrot
bindsym $mod+Print exec --no-startup-id scrot

You can use parenthesis to modify the behavior:

INPUT:
($mod+p/Print) => scrot

OUTPUT:
bindsym $mod+p exec --no-startup-id scrot
bindsym Print exec --no-startup-id scrot

Comments

Empty lines or lines starting with # will be ignored.

INPUT:
# This is a comment

OUTPUT:

Example

INPUT:
$mod+{_,Shift+}{h/Left,j/Down,k/Up,l/Right}         -> {focus,move} {left,down,up,right}
$mod+Control+Shift+{{h/Left,k/Up},{l/Right,j/Down}} -> resize {shrink,grow} {width,height} 5px or 5ppt
$mod+{_,Shift+}{1-9,0}                              -> {_,move container to }workspace {1-10}
$mod+Control+Shift {1-9,0}                          -> move container to workspace {1-10}; workspace @1

OUTPUT:
bindsym $mod+h focus left
bindsym $mod+Left focus left
bindsym $mod+j focus down
bindsym $mod+Down focus down
bindsym $mod+k focus up
bindsym $mod+Up focus up
bindsym $mod+l focus right
bindsym $mod+Right focus right
bindsym $mod+Shift+h move left
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Right move right
bindsym $mod+Control+Shift+h resize shrink width 5px or 5ppt
bindsym $mod+Control+Shift+Left resize shrink width 5px or 5ppt
bindsym $mod+Control+Shift+k resize shrink height 5px or 5ppt
bindsym $mod+Control+Shift+Up resize shrink height 5px or 5ppt
bindsym $mod+Control+Shift+l resize grow width 5px or 5ppt
bindsym $mod+Control+Shift+Right resize grow width 5px or 5ppt
bindsym $mod+Control+Shift+j resize grow height 5px or 5ppt
bindsym $mod+Control+Shift+Down resize grow height 5px or 5ppt
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+Control+Shift 1 move container to workspace 1; workspace 1
bindsym $mod+Control+Shift 2 move container to workspace 2; workspace 2
bindsym $mod+Control+Shift 3 move container to workspace 3; workspace 3
bindsym $mod+Control+Shift 4 move container to workspace 4; workspace 4
bindsym $mod+Control+Shift 5 move container to workspace 5; workspace 5
bindsym $mod+Control+Shift 6 move container to workspace 6; workspace 6
bindsym $mod+Control+Shift 7 move container to workspace 7; workspace 7
bindsym $mod+Control+Shift 8 move container to workspace 8; workspace 8
bindsym $mod+Control+Shift 9 move container to workspace 9; workspace 9
bindsym $mod+Control+Shift 0 move container to workspace 10; workspace 10

Background

i3 is a great windows manager but its config is pretty verbose. I tried bspwm with its hotkey daemon sxhkd and I much prefer that syntax. That's why I wrote tile.

Release files for tile 1.0.0a9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tile 1.0.0a9
File Size Uploaded
tile-1.0.0a9.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tile 1.0.0a9
File Interpreter ABI Platform
tile-1.0.0a9-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / tile-1.0.0a9.tar.gz

Download URL tile-1.0.0a9.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ce1eb7bde5ea35e7f7f141dfb827b63a4349e039a75aeea494953d3cb912bfea
BLAKE2b-256 checksum
How to use checksums
bcee29f151ea905095b40bf7e0221651ab76ae65da55ce373b07b5d5e7ca1117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0b8 CPython/3.8.0 Linux/4.19.86-1-lts

Release files / tile-1.0.0a9-py3-none-any.whl

Download URL tile-1.0.0a9-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d00d34d15fbff2e9e9d826eff975115b302ddadf060e4de7eb1a5a427737827d
BLAKE2b-256 checksum
How to use checksums
93ee7090a88c2ccb1890fc9cbc3f8b0780ed445572fd957c4a0ff44b951682c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0b8 CPython/3.8.0 Linux/4.19.86-1-lts
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page