From b180fa2083e558205632352f3b4770a31a61a0da Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 23 Sep 2021 13:26:47 -0400 Subject: [PATCH] Use bottom right of window for click --- snippets/ib_data_reset.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/snippets/ib_data_reset.py b/snippets/ib_data_reset.py index 233fd186..a6f7df0c 100644 --- a/snippets/ib_data_reset.py +++ b/snippets/ib_data_reset.py @@ -29,8 +29,8 @@ t = i3.get_tree() win_name = 'Interactive Brokers' # what for gw tho? con = t.find_named(win_name)[0] -win_id = con.window -win_width = con.rect.width +win_id = str(con.window) +w, h = str(con.rect.width), str(con.rect.height) # TODO: seems to be a few libs for python but not sure # if they support all the sub commands we need, order of @@ -38,8 +38,18 @@ win_width = con.rect.width # https://github.com/rr-/pyxdotool # https://github.com/ShaneHutter/pyxdotool # https://github.com/cphyc/pyxdotool +subprocess.call([ + 'xdotool', + 'windowactivate', + '--sync', + win_id, + # move mouse to bottom left of window (where there should + # be nothing to click). + 'mousemove_relative', '--sync', w, h, -subprocess.call( - f'xdotool windowactivate --sync {win_id} mousemove_relative ' - f'--sync {win_width} 1 click 1 key ctrl+alt+f'.split(' ') -) + # NOTE: we may need to stick a `--retry 3` in here.. + 'click', '1', + + # hackzorzes + 'key', 'ctrl+alt+f', +])