1

is it possible to send the alt+tab for switch to last window with AutoKey ?

i tried without success:

keyboard.send_keys("<alt>+<shift>+<tab>")

Or forward window:

keyboard.press_key('<alt>')
keyboard.press_key('<tab>')
keyboard.release_key('<tab>')
keyboard.release_key('<alt>')

Or backward window:

keyboard.press_key('<alt>')
keyboard.press_key('<shift>')
keyboard.press_key('<tab>')
keyboard.release_key('<tab>')
keyboard.release_key('<shift>')
keyboard.release_key('<alt>')

result: no error but only moves the tab count inside the editor.

SL5net
  • 2,282
  • 4
  • 28
  • 44
  • if possible, then i could add a feature inside [github.com/sl5net/Lintalist4Linux](https://github.com/sl5net/Lintalist4Linux) – SL5net Sep 03 '20 at 20:07
  • Did you try `keyboard.send_keys("+")`? – wjandrea Sep 03 '20 at 21:44
  • @wjandrea `keyboard.send_keys("+")` has the same effect like `keyboard.send_keys("")` here with Linux Mint Version 20 and 'autokey-gtk autokey-gtk A desktop automation utility for Linux and X11.` – SL5net Sep 04 '20 at 02:17

2 Answers2

2

TL;DR: Not directly with our API.

The AutoKey API talks directly to the current active window. So, sending events targeted at the desktop (DTE) will only work if the current active window recognizes them as such and either forwards them to the DTE or emulates what they do.

However, since AutoKey scripts are written in full Python 3, if you can figure out how to do it yourself in Python, AutoKey can run it for you. And, if some other solution is available, you can run it from within an AutoKey script using the subprocess module.

Joe
  • 351
  • 2
  • 16
1

Autokey's Window class allows you to activate a window by name (via wmctrl), among other functionality. Something in that class may be what you're looking for.