xdotool – xdotool Search Window of Gedit Doesn’t Work

17.10command linegeditshortcut-keysxdotool

Need to bind an F key to perform Ctrl-S in Gedit and reload page browser. Can't get xdotool to find Gedit window on Ubuntu 17.10

$ xdotool search --name "Opera" | tail -1
58720257
$ xdotool search --name "Gedit" | tail -1
$ 

Tried changing search string to "Text Editor", file name, etc. xdotool can't find only Gedit. Works for any other desktop window. It's always the active window so finding that would also work.

Best Answer

Ubuntu 17.10 by default uses Wayland instead of Xorg and Gedit runs under Wayland itself instead of the XWayland compatibility layer. xdotool doesn't work with windows running under Wayland.

As a workaround you may switch back to an Xorg session from Wayland following this Q&A: How do you switch from Wayland back to Xorg in Ubuntu 17.10?

Related Question