How to start Empathy hidden?

How to start Empathy in hidden mode in Ubuntu? If you auto-start Empathy in hidden mode, you can not open the Contacts window, even though Empathy is running in the background.

Note, this was possible in previous versions of Ubuntu using empathy -h or empathy --start-hidden. (See Bug 1179180).


Here is a workaround for this problem...

Step 1

Install xdotool...

$ sudo apt-get install xdotool

Step 2

To start empathy in hidden mode just for yourself...

$ mkdir -p ~/.config/autostart
$ cp /usr/share/applications/empathy.desktop ~/.config/autostart
$ gedit ~/.config/autostart/empathy.desktop

...OR....

To start empathy in hidden mode for all users...

$ cp /usr/share/applications/empathy.desktop /etc/xdg/autostart
$ sudo gedit /etc/xdg/autostart/empathy.desktop

Step 3

In section [Desktop Entry]

Replace...

Exec=empathy

With...

Exec=sh -c 'empathy & xdotool search --sync --onlyvisible --class "empathy" windowmove 25 25 windowunmap'

Finally, save your changes; log out and log back in. You will see the Empathy window "flash" for split-second and then it will disappear. Empathy will continue to run in the background, and you will be able to open the Empathy contacts window (from the unity indicator) whenever you want.

Note: If you don't like the command line, install xdotool using the Software Center. Then use the Startup Applications GUI from the Dash to to create a new launcher called "Empathy," and enter the following as the command: sh -c 'empathy & xdotool search --sync --onlyvisible --class "empathy" windowmove 25 25 windowunmap'.


If that workaround doesn't work try this in the Exec= line when you edit /etc/xdg/autostart/empathy.desktop (or /usr/share/applications/empathy.desktop):

sh -c 'empathy & sleep 5 && xdotool search --sync --onlyvisible --class "empathy" windowunmap'

This is similar but not the same:

  • It attempts to add a five-second pause between starting Empathy and sending simulated input to it with xdotool.
  • It also uses only the windowunmap action, rather than the preceding windowmove action which is less essential.