I have my Logitech G502 mouse with many extra buttons so I wish to be able to hold down a mouse button, use scroll wheel to go through opened windows, release mouse button to select it.

The close keyboard shortcuts I found is Alt+Esc which maps Switch windows directly. To use it, I would hold down Alt button, press Esc repeatedly until desired window is shown, release Alt. An orange frame indicates the selected window.

I have experimented with xte and button sequences but found that they are very unreliable, especially some requires delays to register correctly.

In the end, I found this post and wmctrl which I mapped the single mouse key to this script and it cycled through the windows nicely. However, the way it worked it actually focused on the window thus piling up all the windows on my desktop. I wish to be able to find and select the window first before focusing on it, similar to Alt+Esc.

How can I do that?

  • Yes but where the mouse pointer is when you press the mouse button (left button I assume) will give focus to that window and control what the scroll wheel does. The easiest method is using Alt+Tab and then using the mouse scroll wheel. On Ubuntu 16.04 Unity at least. – WinEunuuchs2Unix Apr 21 at 23:32
  • I wouldn't use the regular buttons for that. In my case I plan to use the "thumb" button. It is unassigned right now. – user1502776 Apr 21 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.