mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
Avoid crashing the script on initial startup
This commit is contained in:
parent
19261c8cbe
commit
4587bf4d6b
1 changed files with 5 additions and 1 deletions
|
|
@ -37,7 +37,11 @@ def on_window(ipc: i3ipc.connection.Connection, event: i3ipc.events.WindowEvent)
|
|||
|
||||
if __name__ == "__main__":
|
||||
ipc = i3ipc.Connection()
|
||||
prev_focused = ipc.get_tree().find_focused().id
|
||||
focused = ipc.get_tree().find_focused()
|
||||
if focused:
|
||||
prev_focused = focused.id
|
||||
else:
|
||||
prev_focused = None
|
||||
windows = {}
|
||||
|
||||
ipc.on("window", on_window)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue