I was looking for a solution and came across this thread. It seems to be quite stale but I am sure people still have that question.
In my case, the application remains in the tray after closing, so I that's what I am doing:
IF YOUR APPLICATION KEEPS RUNNING WHEN YOU CLOSE IT
Create a little script file that includes the following comand
Code:
#!/bin/bash
<application> & sleep 2 && wmctrl -c "<window Title>"
where
<application> is the name of the application you want to start
<window Title> is the title of the window once you start the application
For example, for linphone this was the command:
Code:
#!/bin/bash
linphone & sleep 2 && wmctrl -c "linphone"
I used 2 seconds to let the application start before minimizing it. Of course, you will need to modify that number depending on how long your application takes to start up
Save that file. For example "startupApp.sh" (NOTE, the extension is not relevant, but given that it is a bash script, it is better if you reflect it on the name)
make that file executable:
Code:
chmod a+x startupApp.sh
Now, in your window manager startup applications add that script.
If you just want to minimize the application
Either because you don't have a tray or because your application doesn't keep running when you close the window, then you may want to just minimize it. For that, you can use the xdotool command.
for example
Code:
#!/bin/bash
linphone & sleep 2 && xdotool search --onlyvisible --name "Linphone" windowminimize