The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

how How to close window and instantly open new on the same place? [closed]

asked 2012-07-19 14:21:14 +0000

anonymous user


updated 2012-07-22 07:45:05 +0000

... with size save.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2012-07-20 11:57:40 +0000

ShadowPrince gravatar image

updated 2012-07-20 12:12:22 +0000

Sorry for anonymous question, thought that checkbox let me ask without registration.

# close window and open new at the same place
# uses i3-py, pip install i3-py
import os
import i3
import sys

def wait_for_new_window(windows):
    return i3.get_tree() == windows

if __name__ == '__main__':
    os.system('i3 split h')
    windows = i3.get_tree()
    while wait_for_new_window(windows): pass
    os.system('i3 focus left')
    os.system('i3 kill')

Thank for answer, I made that script on python, bind $mod+Shift+D to him with param dmenu_run, bind $mod+Shift+Enter to him with param terminal and use. P.S. Thanks for cool WM!

edit flag offensive delete link more


That's a sweet trick: The wait_for_new_window function. This is handy for a whole lot of ideas. Thanks for sharing :)

joepd gravatar imagejoepd ( 2012-07-21 09:46:59 +0000 )edit

answered 2012-07-20 10:25:48 +0000

joepd gravatar image

You could try and hack this, with splitting the container, create the new window, focus the previous one, and kill it. You might need to put a sleep command between the make-new-window and the focus-previous phases (or possibly a nicer hack involving parsing the window name if you can predict it reliably).

Hope this helps, I did not try it myself :)

edit flag offensive delete link more

answered 2012-07-19 15:52:09 +0000

Michael gravatar image

Not possible in i3.

edit flag offensive delete link more

Question Tools


Asked: 2012-07-19 14:21:14 +0000

Seen: 1,843 times

Last updated: Jul 22 '12