From 1ad7e9bae2b8f392771e42b8ffbc0fa9066f259b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 30 Sep 2021 12:10:01 -0400 Subject: [PATCH] Activate/focus original window after feed reset --- snippets/ib_data_reset.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snippets/ib_data_reset.py b/snippets/ib_data_reset.py index f5d4ca39..d2a5c63d 100644 --- a/snippets/ib_data_reset.py +++ b/snippets/ib_data_reset.py @@ -25,6 +25,8 @@ import i3ipc i3 = i3ipc.Connection() t = i3.get_tree() +orig_win_id = t.find_focused().window + # for tws win_names: list[str] = [ 'Interactive Brokers', # tws running in i3 @@ -59,3 +61,10 @@ for name in win_names: # hackzorzes 'key', 'ctrl+alt+f', ]) + +# re-activate and focus original window +subprocess.call([ + 'xdotool', + 'windowactivate', '--sync', str(orig_win_id), + 'click', '--window', str(orig_win_id), '1', +])