7

I am using Xephyr as a nested X server. When I am in Xephyr window and pres the key combination Control_L+Shift_L, Xephyr grabs my input (mouse, keyboard). This grab can be released with Control_R+Shift_R, as in API documentation for awesome, a highly configurable X window manager.

The problem is, these key combinations do not work reliably. Sometimes I have to press repeatedly to have any effect. This is very frustrating.

Is there any way to script these key-combinations using some tool such as xdotool? Or any other tool? I would create a script which I could run once I am trapped inside Xephyr and cannot leave.

I have tried the following and that does not work (no effect):

xdotool key Control_L+Alt_L+Shift_L
Paulo Tomé
  • 3,754
  • 6
  • 26
  • 38
Michael Boies
  • 156
  • 1
  • 6
  • 22
  • I don't really understand if you have tried `xdotool` already. According to its manual, `xdotool key Control_L+Alt_L+Shift_L` is supposed to work. – admirabilis Mar 03 '15 at 03:27
  • @Teresa e Junior - that command does not work. – Michael Boies Mar 03 '15 at 09:44
  • Are you sure you need to use `Ctrl+Alt+Shift` and not only `Ctrl+Shift`? What does Xephyr titlebar says? My version says `ctrl+shift grabs mouse and keyboard`. Where did you get Xephyr from? – Arkadiusz Drabczyk Mar 03 '15 at 16:37
  • Yes, I think that three modifiers is a bit too much, to be honest. – admirabilis Mar 03 '15 at 16:37
  • It can be. One more thing @MichaelBoies, sorry if this is a stupid question but do you press these keys together or do you release them one after another? Try pressing `ctrl+shift` at the same time, it really works reliably – Arkadiusz Drabczyk Mar 03 '15 at 16:40
  • @Arkadiusz Drabczyk - you are right. `ctrl+shift` is enough. But still, I have to press it several times. It does not woork reliably. And `dotool key Control_L+Shift_L` has no effect either. – Michael Boies Mar 03 '15 at 20:00
  • @Arkadiusz Drabczyk - pressing the keys at the same time does not work. I have to hold `ctrl` and press `shift`. I have to repeat several times before it makes any effect. – Michael Boies Mar 03 '15 at 20:03
  • That's what I meant by saying that you need to press two keys together and one after another. Ok, so to be honest I still have no idea what `ctrl+shift` doesn't work but I have a couple of ideas but it's possible that all of them are wrong and you will solve your issue faster because you know your system better: 1. run`xev` and press left `Control` and `Shift` and check whether your keyboard works correctly 2. where did you get `Xephyr` from? Try to compile it from source if you know how to do this but don't install it, just check whether it's working 3. How did you run `xdotool` script? – Arkadiusz Drabczyk Mar 03 '15 at 20:44
  • Oh, and one more thing - try to run another window manager inside Xephyr. I tested both Fluxbox and awesome and `ctrl+shift` worked. – Arkadiusz Drabczyk Mar 03 '15 at 20:47
  • @Arkadiusz Drabczyk - I am using `Xephyr` package from Debian Wheezy. – Michael Boies Mar 03 '15 at 21:25
  • Ok, how about my other questions? I am really trying to help you here. – Arkadiusz Drabczyk Mar 03 '15 at 21:26
  • @Arkadiusz Drabczyk - I appreciate your help. When I run `xev` and press ctrl and shift I see `Control_L` and `Shift_L` - as expected. I run `xdotool` from my terminal, not as a script. I cannot try another wm, I only have `LXDE` set up. – Michael Boies Mar 03 '15 at 21:34
  • Are you using `LXDE` on your primary X server, is this the one you use on a daily basis or is it the one you are running inside `Xephyr`? Try another WM inside `Xephyr`. Just pick any - I tried `fluxbox` and `awesome`. You don't to configure them, just install them, start them inside Xephyr, check whether `ctrl+shift` works and remove them. – Arkadiusz Drabczyk Mar 03 '15 at 21:41
  • @MichaelBoies: I just tried LXDE inside Xephry and `ctrl+shift` works correctly – Arkadiusz Drabczyk Mar 04 '15 at 12:02
  • @Arkadiusz Drabczyk - I am glad it works for you. For me, this key combination does not work reliably (I have to press repeatedly). Therefore I would like to have a script, which I can run. – Michael Boies Mar 04 '15 at 13:40
  • Is the same `ctrl+shifht` key combination defined as a shortcut for something in your host WM – Arkadiusz Drabczyk Mar 04 '15 at 14:02
  • do you know if Xephyr grab can be released thru other means like a specific command line or even thru dbus? I mean, you could bind some other more reliable key to release, and even perform checks with a script on a loop to make it sure the release happened. – Aquarius Power Mar 04 '15 at 22:48
  • Is on the documentation the note about that combine keys are not working on all windows managers. @ArkadiuszDrabczyk is right. Thank you for the WM names, i will try fluxbox. – m3nda May 22 '15 at 01:10
  • @MichaelBoies I would suggest you to use VNC servers with their own xstartup for each one (you don't need to break your desktop to try them). It's like your virtual X enviroment ;) and it's easy to use the viewers. I found that combine keys was not working on the default xstartup while was working on the main monitor with no prob. – m3nda May 22 '15 at 01:13

1 Answers1

6

I face the same issue. The magic trick is in the order of the keys. You have to:

  1. press and hold Ctrl
  2. press and release Shift
  3. release Ctrl

If you release the Ctrl before Shift, or use any other order, you will face the issue. Pressing those keys together at the same time makes the order random.

BTW. It doesn't depend on the WM at all. It seems to be Xephyr related.

SkyRaT
  • 311
  • 2
  • 3