• Stars
    star
    872
  • Rank 52,322 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 5 years ago
  • Updated 6 months ago

Reviews

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

Repository Details

Script for sway and i3 to automatically switch the horizontal / vertical window split orientation

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. This may make stack and tabbed layouts behave oddly. Unfortunately, there is nothing that can be done about it – please, do not submit issues about it –, but there are two workaround that you can try.

One option is, to enable autotiling on certain workspaces or outputs only. For instance, you could configure autotiling to be enabled on odd workspaces, but not on even ones:

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

Another option you can try, is setting --limit and only use stacking or tabbing on the lowest level. A good place to start would be --limit 2. Open four windows with the third and fourth window in the same container as two. This might mimic a master-stack layout and you should now be able to switch to stacking or tabbed. Beware that the decision on how to split is still based on the height / width ratio.

Installation

The script has been packaged for the following distributions:

Packaging status

PyPI version

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
  -o [OUTPUTS ...], --outputs [OUTPUTS ...]
                        restricts autotiling to certain output; example: autotiling --output DP-1
                        HDMI-0
  -w [WORKSPACES ...], --workspaces [WORKSPACES ...]
                        restricts autotiling to certain workspaces; example: autotiling --workspaces 8
                        9
  -l LIMIT, --limit LIMIT
                        limit how often autotiling will split a container; try "2", if you like
                        master-stack layouts; default: 0 (no limit)
  -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.

More Repositories

1

nwg-shell

Installer & meta-package for the nwg-shell project: a GTK3-based shell for sway and Hyprland Wayland compositors
CSS
793
star
2

nwg-panel

GTK3-based panel for sway and Hyprland Wayland compositors
Python
583
star
3

nwg-look

GTK3 settings editor adapted to work in the wlroots environment
Go
476
star
4

nwg-launchers

GTK-based launchers: application grid, button bar, dmenu for sway and other window managers
C++
401
star
5

nwg-displays

Output management utility for sway and Hyprland.
Python
356
star
6

azote

Wallpaper manager for wlroots-based compositors and some other WMs
Python
351
star
7

nwg-drawer

Application drawer for wlroots-based Wayland compositors
Go
229
star
8

nwg-dock

GTK3-based dock for sway
Go
158
star
9

nwg-dock-hyprland

GTK3-based dock for Hyprland
Go
153
star
10

nwg-wrapper

Wrapper to display a script output or a text file content on the desktop in sway or other wlroots-based compositors
Python
135
star
11

nwg-bar

GTK3-based button bar for wlroots-based compositors
Go
115
star
12

sgtk-menu

GTK launchers for sway & other WMs w/ menu, dmenu, application grid and button bar
Python
112
star
13

tint2-executors

Collection of executors for Tint2 panel
Python
83
star
14

nwg-iso

Arch Linux ISO with nwg-shell for sway and Hyprland
CSS
76
star
15

nwg-shell-config

nwg-shell configuration utility
Python
57
star
16

nwg-menu

MenuStart plugin to nwg-panel, also capable of working standalone
Go
54
star
17

swayinfo

Some goodies for use in Sway and i3 wm
Python
48
star
18

gopsuinfo

A gopsutil-based command to display system usage info as text in panels like Waybar or icon/text in tint2 and nwg-panel executors
Go
33
star
19

psuinfo

A psutil-based command to display customizable system usage info in a single line, for Tint2 executors or CLI
Python
28
star
20

nwg-hello

GTK3-based greeter for greetd written in python
Python
26
star
21

t2ec

Package of info scripts for Tint2 or other panels
Python
17
star
22

nwg-icon-picker

GTK icon chooser with a text search option
Python
16
star
23

nwg-clipman

nwg-shell clipboard manager - a GTK3-based GUI for cliphist
Python
15
star
24

nwgocc

nwg Control Center - Go version
Go
14
star
25

obhud

Openbox HUD ia s Python script for handling laptop-specific keys and events in Openbox window manager
Python
8
star
26

azote-palettes

Create a color palette out of an image
Python
6
star
27

nwgcc

nwg Control Center
Python
6
star
28

nwg-piotr

Config files for my GitHub profile.
5
star
29

rof

Launcher script to avoid running multiple instance of the same window
Shell
5
star
30

ddcpopup

simple GUI for basic ddcutil features and a ddcutil output parser for use with bars / panels
Go
4
star
31

sway-save-outputs

Script to save current sway outputs configuration to a text file
Python
4
star
32

lightdm-nwg-greeter

A fork of LightDM Elephant Greeter, intended to replace sddm on nwg-iso.
Python
3
star
33

RamblerGPXEditor

An Openstreetmap-based visual GPX editor for Android
Java
3
star
34

squarely

A puzzle game which utilizes the python-pyglet library.
Python
3
star
35

dwl

djpohly/dwl with my selection of patches and pending pull requests applied
C
3
star
36

nwg-readme-browser

WebKitGTK-based README file browser
Python
3
star
37

obbackup

Simple graphical tool to backup/restore Openbox config files in few clicks
Python
2
star
38

EistReturns

Arcade-puzzle game
Java
2
star
39

nwg-shell-wallpapers

Selection of wallpapers contributed to the nwg-shell project
Shell
2
star
40

nwg-shell-resources

common files used by other nwg-shell components
CSS
2
star
41

river_output_switcher

automated output switcher for river Wayland compositor
Python
1
star