GithubHelp home page GithubHelp logo

olemartinorg / i3-alternating-layout Goto Github PK

View Code? Open in Web Editor NEW
344.0 344.0 40.0 601 KB

Scripts to open new windows in i3wm using alternating layouts (splith/splitv) for each new window

License: MIT License

Python 100.00%

i3-alternating-layout's People

Contributors

flancian avatar gangelop avatar ifreilicht avatar jakob1379 avatar kmarius avatar mlmatlock avatar olemartinorg avatar ralino avatar susensio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

i3-alternating-layout's Issues

Update Arch dependencies

No need for xorg-util-macros as far as I can see, works fine without it, but xorg-xprop is needed or you'll get

FileNotFoundError: [Errno 2] No such file or directory: 'xprop': 'xprop'

pypi package?

Is there any reason this project available via pip?

Would you be open to a PR for this?

Arch Linux new dependency

The package that needs to be installed are:

python-i3-py
xorg-util-macros

Then you can install this no problem. I'll comment on the AUR package too

Containers shift on i3 restart

If I restart i3 after config changes. Sometimes my containers switch place. Can this be avoided?

Side note since it might be relevant: I use exec_always instead of exec because alternating_layouts.py dies at a restart with BrokenPipeError: [Errno 32] Broken pipe.

# i3 --moreversion
Binary i3 version:  4.16.1 (2019-01-27) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.16.1 (2019-01-27) (pid 1411)abort…)
Loaded i3 config: /home/user/.i3/config (Last modified: Wed 19 Jun 2019 04:52:47 PM CEST, 164 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

argument of type 'NoneType' is not iterable

Hi,

just wanted to let you know that the script crashes from time to time with the following error.

Traceback (most recent call last):
  File "/usr/local/bin/alternating_layouts.py", line 106, in <module>
    main()
  File "/usr/local/bin/alternating_layouts.py", line 99, in main
    set_layout()
  File "/usr/local/bin/alternating_layouts.py", line 38, in set_layout
    current_win = i3.filter(nodes=[], focused=True)
  File "/usr/lib/python3.8/site-packages/i3.py", line 519, in filter
    if key not in tree or tree[key] != value:
TypeError: argument of type 'NoneType' is not iterable

Despite that, great work. Thank you!

Not playing well when moving tiled windows.

This script sets the layout exactly like I wanted. But, it seems to get screwy when trying to re-arrange windows once tiled. Normal behavior of swapping two vertical windows ontop of eachother no longer works. Is there a way around this behavior?

Toggling between stacked, tabbed and split breaks

Hi,

When running i3-alternating-layout, changing from stacked to tabbed to split works. But from that point on, I can't go back to stacked or tabbed.

This is my config:

bindsym $win+t exec "notify-send Layout Tab", layout tabbed                                                  
bindsym $win+y exec "notify-send Layout Stack", layout stacking                                                                           
bindsym $win+u exec "notify-send Layout Split", layout toggle split

So in a workspace with stacked as default, doing win+t then win+u will do what it's supposed to do, but from then on, win+y doesn't work.

Can you reproduce?

Thanks!

moving containers inhibited

Unfortunately i3's functionality of moving containers with move left/right/up/down (default keybinding mod+Shift+j/k/l/ö/;/arrow-keys) is messed up by the script ...
ideas? @Airblader ?

Tip: exclude files locally

You can use .git/info/exclude to exclude files only in your local git repo instead of creating a .gitignore file.

Inconsistent behaviour when moving tiled windows

I am sometimes unable to move a focused window left or right, only up and down. Other times the focused will move two spaces instead of one. I'm running a dual monitor setup, and the issue occurs very often when trying to move a window between monitors.
Any idea how to fix this? Great script, but this is a bit issue for me.

Is this repository obsolete?

You can get an alternating layout in just two lines (see this comment):

default_orientation vertical
for_window [class="^"] split toggle

Is there something your code achieves that this doesn't?

Can't get it to work in a aarch64 LXC container

I followed the instruction in the README, installed i3ipc with no issue, have python3 installed on my device, and added the exec line in my configuration, but somehow the split orientation does not alternate. When I try to manually run the python script, the terminal just hangs. Is that expected?

cpu explodes on empty workspace

I have conky running on the desktop and when I create an empty workspace cpu usage of process python goes up to 15-25%. As soon as I open at least one container, cpu goes back to normal.
The script seems to have a problem with detecting an empty workspace?

screenshot showing wrong layout

Just a little comment:
Since c74dfc8 the screenshot is wrong.

Since the split-orientation is calculated based on width/height pressing only $mod+Return creates a different layout than the depicted one.

Random error when running in the background

Sometimes when I'm running this script it closes itself with this error:

    Traceback (most recent call last):
      File ".config/i3/scripts/alternating_layouts.py", line 109, in <module>
        main()
      File ".config/i3/scripts/alternating_layouts.py", line 102, in main
        set_layout()
      File ".config/i3/scripts/alternating_layouts.py", line 41, in set_layout
        current_win = i3.filter(nodes=[], focused=True)
      File "/usr/lib/python3.7/site-packages/i3.py", line 508, in filter
        tree = msg('get_tree')
      File "/usr/lib/python3.7/site-packages/i3.py", line 392, in msg
        response = default_socket().get(type, message)
      File "/usr/lib/python3.7/site-packages/i3.py", line 181, in get
        self.send(msg_type, payload)
      File "/usr/lib/python3.7/site-packages/i3.py", line 203, in send
        self.socket.sendall(message)
    BrokenPipeError: [Errno 32] Broken pipe

I'm running arch and followed the install guide

Multiple monitors?

Seems the primary monitor is working fine, but any other monitors seem to operate as normal. Would you have a quick way around this?

Unnecessary splits break 3 column layout

Current implementation splits on the long edge (good) but it does it too early. This breaks any possible multi column layout. This become apparent with ultrawide monitors

WITHOUT i3-alternating-layout

 -----------------------
|                       |
|                       |
|                       |
|                       |
 -----------------------

 ----------- -----------
|           |           |
|           |           |
|           |           |
|           |           |
 ----------- -----------

 ------- ------- -------
|       |       |       |
|       |       |       |
|       |       |       |
|       |       |       |
 ------- ------- -------

WITH i3-alternating-layout

 -----------------------
|                       |
|                       |
|                       |
|                       |
 -----------------------

 ----------- -----------
|           |           |
|           |           |
|           |           |
|           |           |
 ----------- -----------

# next split is what I dont like
 ----------- ----- -----
|           |     |     |
|           |     |     |
|           |     |     |
|           |     |     |
 ----------- ----- -----

 ----------- ----- -----
|           |     |     |
|           |     |_____|
|           |     |     |
|           |     |     |
 ----------- ----- -----

DESIRED behaviour


 -----------------------
|                       |
|                       |
|                       |
|                       |
 -----------------------

 ----------- -----------
|           |           |
|           |           |
|           |           |
|           |           |
 ----------- -----------

 ------- ------- -------
|       |       |       |
|       |       |       |
|       |       |       |
|       |       |       |
 ------- ------- -------

 ------- ------- -------
|       |       |       |
|       |       |_______|
|       |       |       |
|       |       |       |
 ------- ------- -------

I don't know if it is a desired behaviour, but I have found a workaround.

dependencies Arch

Hi just thought i let you know that the install instructions for arch is not working. There is no longer a package for python-i3-git and the link in the description is broken.

I got it to work with sudo pip install i3-py . While troubleshooting this i had a conversation with the maintainer of i3ipc-python in #i3@freenode, acrisci. according to acrsci i3ipc-python is a better alternative. And it is at least more convenient to install then using pip, so you might consider porting it to i3ipc-python.

Really nice script, spiraling layout should be available (and enabled) by default in i3 imo.

Doesn't honor original window orientation (Sway)

I have a minor issue when using this on sway (no problems whatsoever on i3):

  1. Open a terminal (or any application).
  2. My default is horizontal split. Open a second window, splits properly, with the vertical split on the second window (also proper).
  3. Close the second window, now the original window will split vertically.

Start with a terminal (indicator is in red):

20210314_12h28m14s_grim

Open another one:

20210314_12h28m22s_grim

Close the second one:

20210314_12h28m31s_grim

Out of date

Please update the AUR repo.

aur/alternating-layouts-git r29.507c84a-1 [+6 ~0.01] [Out-of-date: 2021-12-23] Alternating split directions for the i3-wm

tiling ratio support ?

Other tiling window managers have a concept of tiling ratio.

Currently
Windows open with a ratio of 1:1

Expected
Windows open with a ratio of a:b where a and b are configurable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.