Discussion:
How to send keystroke to i3 from a VirtualBox guest window?
(too old to reply)
Jose Silva
2018-02-24 17:40:25 UTC
Permalink
Hello,

This is my first post and I'm finding i3 very interesting, although I'm
still getting used to it.

So, I want to emulate the behaviour of Xfce4 in which, when I move the
mouse pointer to the screen edge, I get switched to the next workspace,
or the previous if on the left edge.

For this, I entered the config commands:

bindsym $mod+Left workspace prev
bindsym $mod+Right workspace next
exec xdotool behave_screen_edge --delay 200 left exec
/home/user/.i3/scripts/workspace_prev > /dev/null &
exec xdotool behave_screen_edge --delay 200 right exec
/home/user/.i3/scripts/workspace_next > /dev/null &

which, when I reach the screen edge, execute one of the scripts, let's
take the _next (_prev is similar):

#!/bin/sh
xdotool key --delay 50 Super+Right
eval $(xdotool getmouselocation --shell)
xdotool mousemove --sync 20 $Y # move the mouse pointer to the left edge
on the new workspace

It works nicely except with a VirtualBox guest machine which captures
the keystrokes. So I have to operate the VM not in fullscreen and modify
the first line of the script to include a call to the VM menu which
prevents it from capturing the keystroke, like this:

xdotool key --delay 50 Super_R++ Super+Right # Super_R++ is the
keystroke to call the VM menu

It works but this is very cumbersome and sluggish. Furthermore, it can't
be guaranteed that the additional keystroke doesn't negatively affect
another application when the present workspace does not contain a VM

So I tried to detect that I was in fact on the VM:

If WinActive("[CLASS:VirtualBox Machine]") Then xdotool key Super_R++

But it didn't work.

So, guessing that there are other i3 users interested on this mechanism
that I find very useful, can somebody help me on this issue, towards
making it usable an

Loading...