Author Topic: i3 - automatic tiling?  (Read 6130 times)

0 Members and 1 Guest are viewing this topic.

Offline torvic9

  • Sr. Mitglied
  • ****
  • Posts: 253
  • Hello world!
  • Branch: stable
  • Skill: Intermediate
i3 - automatic tiling?
« on: 04. January 2016, 11:18:44 »
Title says it all, really.
Is there a way to have automatic tiling in i3? I know some other tiling WMs do this, but i3 apparently doesn't have such a feature.
It can be a tedious task to manually adjust the desired tiling with mod+v, mod+h, mod+r...
I'm looking for something like the "fibonacci" tiling mode or the binary tree tiling mode of bspwm.
i3: i7-5820K | 32 GB | GeForce GTX 960, nvidia | linux44-custom
KDE: i7-920 | 12 GB | GeForce GTS 450, nouveau | linux44
Gnome: Thinkpad X200s | linux41

Offline tanaymkis

  • Jr. Mitglied
  • **
  • Posts: 72
  • I'm new. Be nice!
  • Branch: Stable
  • Desktop: i3
  • Kernel: 3.18.22-1-MANJARO i686
  • Skill: Novice
Re: i3 - automatic tiling?
« Reply #1 on: 04. January 2016, 12:32:54 »
I am quite sure there is no way to have automatic tilling i3 , there is a reason why it is called a "manual tiler".
A google search on the topic isn't helpful either.

Offline Kelaun

  • Jr. Mitglied
  • **
  • Posts: 97
  • Branch: Stable
  • Desktop: Gnome
  • GPU Card: nVidia GTX 730m
  • GPU driver: Non-free
  • Kernel: 4.5.3-1-MANJARO x86_64
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #2 on: 04. January 2016, 12:34:29 »
The only thing I'm aware of that could resemble what you're looking for is layout saving.
http://i3wm.org/docs/layout-saving.html
Kelaun

Offline tanaymkis

  • Jr. Mitglied
  • **
  • Posts: 72
  • I'm new. Be nice!
  • Branch: Stable
  • Desktop: i3
  • Kernel: 3.18.22-1-MANJARO i686
  • Skill: Novice
Re: i3 - automatic tiling?
« Reply #3 on: 04. January 2016, 12:38:35 »
I nearly forgot all about layout saving. :P

Offline torvic9

  • Sr. Mitglied
  • ****
  • Posts: 253
  • Hello world!
  • Branch: stable
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #4 on: 04. January 2016, 13:43:50 »
That looks interesting, thanks!
i3: i7-5820K | 32 GB | GeForce GTX 960, nvidia | linux44-custom
KDE: i7-920 | 12 GB | GeForce GTS 450, nouveau | linux44
Gnome: Thinkpad X200s | linux41

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #5 on: 04. January 2016, 16:14:53 »
Another way: Scripting. I think you could replicate the pseudoautomatic rule from bspwm on i3 too. It splits the focused window in its largest dimension unless there is already a split.

something like this (requires package wmutils):

Code: [Select]
#!/bin/bash
fwid=$(pfw)
i3-ipc SUBSCRIBE I3_IPC_EVENT_WINDOW  | while read line; do
if [ <something to determine if focused container is in tabbed/stacked mode> ] ; then
wattr wh $fwid | {
read width height
if [ $width -gt $height ] ; then
<i3 command to split container horizontally>
else
<i3 command to split container vertically>
fi
}
fi

If you can get it working, this should always split your focused window in a reasonable dimension, unless it is in tabbed mode, in which case it just lets it tab. I can't think of a way to allow for normal manual tiling in i3 though. You'd probably wan't to have a keybinding to toggle this.

--------------

Other way: if you primarily use dmenu_recency to launch your apps, write a wrapper that first splits your container:

Code: [Select]
#!/bin/bash
wattr wh $(pfw) | {
read width height
if [ $width -gt $height ] ; then
<i3 command to split container horizontally>
else
<i3 command to split container vertically>
fi
}
dmenu_recency

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 - automatic tiling?
« Reply #6 on: 04. January 2016, 16:23:21 »
There's a pull request pending that allows the command "split toggle" to be used. With that merged, you might be able to do

Code: [Select]
for_window [class=".*"] split toggle

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #7 on: 05. January 2016, 05:07:06 »
Uuh, that would be much cleaner.

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 - automatic tiling?
« Reply #8 on: 05. January 2016, 07:09:50 »
The pull request was merged earlier today, so a current checkout and build of the next branch can be used for this.

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #9 on: 05. January 2016, 11:00:52 »
The pull request was merged earlier today, so a current checkout and build of the next branch can be used for this.
I'll update the i3-gaps package then :)
Are there maybe any other interesting new features we should take into account config-wise since commit rgfdbe3ce ?
Oh, I am using /github.com/Airblader/i3#branch=gaps !
« Last Edit: 05. January 2016, 11:03:23 by oberon »
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline oberon

  • Core Team
  • *****
  • Posts: 3858
  • I'm nice. Be new!
  • Branch: unstable
  • Desktop: i3, Deepin, Cinnamon
  • GPU Card: Intel ValleyView Gen7
  • GPU driver: Intel
  • Kernel: 4.1 / 4.4
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #10 on: 05. January 2016, 11:13:46 »
@Airblader, I'm a bit confused about the multiple i3-branches :P
Please let me know which source will make most sense to use for upgrading the manjaro (i3-gaps) package, thanks :)
manjaro is addictive ::)
* manjaro-i3  * manjaro-cinnamon  * manjaro-deepin

Offline Airblader

  • Jr. Mitglied
  • **
  • Posts: 93
  • I'm new. Be nice!
  • Desktop: i3-gaps
  • Skill: Advanced
Re: i3 - automatic tiling?
« Reply #11 on: 05. January 2016, 16:19:51 »
i3: master is the current release, next is the development branch

i3-gaps: gaps is the current i3 release (master) + gaps, gaps-next is the current i3 development branch (next) + gaps.

Hence, updating a package based off the gaps branch doesn't make sense until a new release happened.

Offline torvic9

  • Sr. Mitglied
  • ****
  • Posts: 253
  • Hello world!
  • Branch: stable
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #12 on: 09. January 2016, 11:52:27 »
Airblader, does the "split toggle" do the same thing as Chysosthomus script?
Because that's exactly what I'm looking for.

Edit: please correct if I'm wrong (I know next to nothing about coding with the exception of BASIC), but looking at i3 github sources, the split toggle command is used to change the splitting of already opened containers.

I'm going to try the "i3-alternating-layout" script from https://github.com/olemartinorg/i3-alternating-layout and see how it works.
« Last Edit: 09. January 2016, 12:17:11 by torvic9 »
i3: i7-5820K | 32 GB | GeForce GTX 960, nvidia | linux44-custom
KDE: i7-920 | 12 GB | GeForce GTS 450, nouveau | linux44
Gnome: Thinkpad X200s | linux41

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #13 on: 09. January 2016, 13:18:47 »
Please report your findings here.

Offline torvic9

  • Sr. Mitglied
  • ****
  • Posts: 253
  • Hello world!
  • Branch: stable
  • Skill: Intermediate
Re: i3 - automatic tiling?
« Reply #14 on: 09. January 2016, 14:36:48 »
Yes it works as intended!
You have to add
Code: [Select]
exec --no-startup-id python /path/to/alternating_layouts.py to your i3 config.

I think it would be a good idea to include it in Manjaro i3 (but disabled by default).
i3: i7-5820K | 32 GB | GeForce GTX 960, nvidia | linux44-custom
KDE: i7-920 | 12 GB | GeForce GTS 450, nouveau | linux44
Gnome: Thinkpad X200s | linux41