Skip to content

Commit

Permalink
Parse argument first
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir-csp authored Feb 21, 2024
1 parent 783d587 commit cc54ef2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions layout-per-window.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ def on_window(ipc: i3ipc.connection.Connection, event: i3ipc.events.WindowEvent)


if __name__ == "__main__":
ipc = i3ipc.Connection()
focused = ipc.get_tree().find_focused()
if focused:
prev_focused = focused.id
else:
prev_focused = None
windows = {}

if len(sys.argv) == 2:
if sys.argv[1].isnumeric():
default_layout = int(sys.argv[1])
Expand All @@ -72,5 +64,13 @@ def on_window(ipc: i3ipc.connection.Connection, event: i3ipc.events.WindowEvent)
else:
default_layout = None

ipc = i3ipc.Connection()
focused = ipc.get_tree().find_focused()
if focused:
prev_focused = focused.id
else:
prev_focused = None
windows = {}

ipc.on("window", on_window)
ipc.main()

0 comments on commit cc54ef2

Please sign in to comment.