Get ib key hack script to work with reconnect

m4_corrections
Tyler Goodlet 2022-03-08 09:52:22 -05:00
parent 8d77d177bf
commit 4e1ab378f4
1 changed files with 22 additions and 14 deletions

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # piker: trading gear for hackers
# Copyright (C) Tyler Goodlet (in stewardship for piker0) # Copyright (C) Tyler Goodlet (in stewardship for pikers)
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
@ -49,22 +49,30 @@ for name in win_names:
# https://github.com/rr-/pyxdotool # https://github.com/rr-/pyxdotool
# https://github.com/ShaneHutter/pyxdotool # https://github.com/ShaneHutter/pyxdotool
# https://github.com/cphyc/pyxdotool # https://github.com/cphyc/pyxdotool
subprocess.call([
'xdotool',
'windowactivate', '--sync', win_id,
# move mouse to bottom left of window (where there should # TODO: only run the reconnect (2nd) kc on a detected
# be nothing to click). # disconnect?
'mousemove_relative', '--sync', str(w-4), str(h-4), for key_combo, timeout in [
('ctrl+alt+r', 12),
('ctrl+alt+f', 6)
]:
subprocess.call([
'xdotool',
'windowactivate', '--sync', win_id,
# NOTE: we may need to stick a `--retry 3` in here.. # move mouse to bottom left of window (where there should
'click', '--window', win_id, '--repeat', '3', '1', # be nothing to click).
'mousemove_relative', '--sync', str(w-4), str(h-4),
# hackzorzes # NOTE: we may need to stick a `--retry 3` in here..
'key', 'ctrl+alt+f', 'click', '--window', win_id,
], '--repeat', '3', '1',
timeout=1,
) # hackzorzes
'key', key_combo,
],
timeout=timeout,
)
# re-activate and focus original window # re-activate and focus original window
subprocess.call([ subprocess.call([