I have a RPi running raspbian jessie which I use in kiosk mode: I start in /etc/rc.local

/usr/bin/xinit /opt/domotique/xinitrc > /root/xinitrc-errors 2>&1

and /opt/domotique/xinitrc is

date > /tmp/date.txt
export DISPLAY=':0'
xset s off
xset -dpms
xset s noblank
setxkbmap fr
/usr/bin/matchbox-window-manager -use_titlebar no -use_cursor no &
# wait for the window manager to start
sleep 10
rm -fr /root/.config /root/.cache
/usr/bin/firefox &
# let the browser start
sleep 10
/usr/bin/xte 'mousemove 10000 10000'
sleep 2
/usr/bin/xdotool key F11
date >> /tmp/date.txt
sleep 40000000

The idea is to start a minimal window manager, then firefox and then programatically move the mouse away and press F11 to go fullscreen.

Everything works fine, except that the F11 key is not "pressed" - I am left with firefox together with its chrome.

If I ssh to the host and run at the root prompt

export DISPLAY=':0'
/usr/bin/xdotool key F11

then firefox is correctly switched to full screen. Same if I use xte. The control file /tmp/date.txt has two date lines and there are no errors in /root/xinitrc-errors.

What could be the reason for this strange behaviour?

  • 1
    Could you try running xdotool getmouselocation and xdotool getwindowfocus, just before the key F11, to check that the mouse has moved and the right window is going to receive the input? You may also get better results by using the same tool (xte or xdotool) for both opeations, rather than mixing the two.
    – JigglyNaga
    Commented Jul 31, 2016 at 21:50
  • @JigglyNaga: that was it - the focus. Somehow the focus was not there for the F11 to be accepted and after adding a xdotool windowfocus --sync /usr/bin/xdotool search firefox | tail -1 it worked fine. Can you please turn your suggestion into an answer so that I can accept it? (it is surprising that the call over ssh works but never mind)
    – WoJ
    Commented Aug 1, 2016 at 16:51
  • You could also use wait instead of sleeping for 15 months.
    – JigglyNaga
    Commented Aug 1, 2016 at 22:26

2 Answers 2


From xdotool(1):

key [options] keystroke [keystroke ...]


--window window

Send keystrokes to a specific window id. You can use ``WINDOW STACK'' references like ``%1'' and ``%@'' here. If there is a window stack, then ``%1'' is the default, otherwise the current window is used.

In your ssh test, you had already focused the Firefox window, so it received the keypress. In the script, the xte mousemove ... left it unfocused.

You can chain xdotool search with other commands. Searching for firefox may return multiple windows. The manpage uses the example --classname Navigator, which works for the version I tested (47.0.1). Failing that, you could use xprop to find some other string specific to the relevant window.

 xdotool search --classname Navigator windowfocus key F11

In the first line of your script, can you try putting the shebang

#!/usr/bin/env bash

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .