9

I'm trying to bind a switch window button on my mouse into Ubuntu. Currently I'm trying to do it with xbindkeys and xte, but do this in .xbindkeysrc only outputs a Tab and doesn't switch windows.

Current .xbindkeysrc code:

"'xte' 'keydown Alt_L' 'keydown Tab' 'keyup Tab' 'keyup Alt_L'"
   b:10

I am wondering if there is a different command I could put that would directly give instructions to switch windows.

EDIT: I also tried xdotool, here is the code using it:

 "xdotool keydown alt key Tab && sleep 1 && xdotool keyup alt"
    b:10

It didn't work either.

EDIT2: I tried the xdotool one in the command line and it worked. Is there some reason it doesn't work with xbindkeys?

  • xdotool key alt+Tab works fine on Ubuntu 12.04 – user267811 Apr 11 '14 at 11:55
5

I got it to work. Turns out that I needed to put a pause between keydown alt and key tab. I also put the xdotool code in an .sh file so I could modify it without restarting xbindkeys every time.

Working xdotool code:

xdotool keydown alt
sleep .1
xdotool key Tab key alt
| improve this answer | |
3

xte works too, if you use it like

"xte 'keydown Alt_L' 'key Tab' 'keyup Alt_L'"
  b:10
| improve this answer | |
0

It works with PitaJ's method: Add the code below into .xbindkeysrc file(replace "user123" to your username and fix the xdotool_Alt_Tab.sh file path to your file path)

"/home/user123/xdotool_Alt_Tab.sh"
b:9

Note: made xdotool_Alt_Tab.sh executable by

 $ chmod +x xdotool_Alt_Tab.sh

or right click on that file -> Properties -> Click on the Permission tab -> Check the box of "Allow executing file as program"

I found I needed to press and release that mouse button pretty quick for the Tab key to catch up in time!

| improve this answer | |
0

I use this approach to emulate a presenter console for presentation software that is missing said functionality.

This is my script:

#!/bin/sh

sleep .2
xdotool key --clearmodifiers Left
xdotool keydown --clearmodifiers alt
sleep .1
xdotool key Tab
xdotool keyup alt
sleep .2

xdotool key --clearmodifiers Left
sleep .1
xdotool keydown --clearmodifiers alt
sleep .2
xdotool key Tab
xdotool keyup alt

Create another one for the right arrow movement and assign them to shortcuts using xbindkey_config-gtk2 (gui for xbindkyes). Then simply have one window open with your slides and another with a pdf document of your notes on separate monitors. Use the assigned keybindings to move to the next slide in both of them with just a small delay.

| improve this answer | |
0

I came up with:

"xte 'keydown Alt_L' 'key Tab' 'sleep 1.5' 'keyup Alt_L'"   
  b:2

And off course, to install xte:

sudo apt-get install xautomation

Since I was looking to keep the switch window open to choose an application from the list myself, this was my final solution. Working pretty well so far.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.