Skip to main content

Automatically switch the horizontal/vertical window split orientation in sway and i3

Project description

autotiling

This script uses the i3ipc-python library to switch the layout splith/splitv depending on the currently focused window dimensions. It works on both sway and i3 window managers.

Inspired by https://github.com/olemartinorg/i3-alternating-layout.

See on YouTube:

Auto-tiling in action

PLEASE DO READ THIS

The script does one thing: it checks the window height / width ratio, and executes the equivalent of either swaymsg splitv or swaymsg splith. Nothing less, nothing more. Yes, it may make stacking and tabbed layouts behave oddly. No, nothing can be done about it. If you like stacking/tabbed layouts, you may use them on workspaces with autotiling turned off (--workspaces argument). Do not submit issues about it.

For instance, you may configure autotiling to work on odd workspaces, but not on even:

### Autostart
  exec autotiling -w 1 3 5 7 9

Installation

The script has been packaged for the following distributions:

Packaging status

On Arch Linux for the latest development version you may use autotiling-git.

Installing manually:

  1. Install the python-i3ipc>=2.0.1 package (or whatever it's called in your Linux distribution);
  2. save the main.py file anywhere, rename to autotiling, make executable, move to your bin folder;
  3. add exec_always autotiling to the ~/.config/sway/config or exec_always --no-startup-id autotiling to the ~/.config/i3/config file.

Usage

$ autotiling -h
usage: autotiling [-h] [-d] [-v] [-w [WORKSPACES ...]] [-e [EVENTS ...]]

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           print debug messages to stderr
  -v, --version         display version information
  -w [WORKSPACES ...], --workspaces [WORKSPACES ...]
                        restricts autotiling to certain workspaces; example: autotiling --workspaces 8
                        9
  -e [EVENTS ...], --events [EVENTS ...]
                        list of events to trigger switching split orientation; default: WINDOW MODE

Events

Changing event subscription has already been the objective of several pull request. To avoid doing this again and again, starting from v1.6 you may specify them in the -e | --events argument. If no value given, the script will subscribe to Event.WINDOW and Event.MODE, as if it was executed with autotiling -e WINDOW MODE. See
altdesktop/i3ipc-python` for event enumeration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autotiling-1.6.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autotiling-1.6.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file autotiling-1.6.1.tar.gz.

File metadata

  • Download URL: autotiling-1.6.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for autotiling-1.6.1.tar.gz
Algorithm Hash digest
SHA256 f5a16fce96cb92b53396762c3aa02b33f75ce299d65eddce98eda8dd24f27d49
MD5 f4400da313cdfa3e6ca06ceb4d82373e
BLAKE2b-256 0315326ed10388a8031f6074b7127bf148d1f73078e7bc7e1f4e32b036c2b16a

See more details on using hashes here.

File details

Details for the file autotiling-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: autotiling-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for autotiling-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9fac0f929a4bdc65417ce6bdf3d4e2d23860562888e17ac4805f043a642e9e3
MD5 944d380228d9de953df28b47c5760cf6
BLAKE2b-256 a43495a00ea1ff51281c2dbcda8bd8e739211dd8091be7a2f45729dd56184879

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page