Ubuntu – Kubuntu autostart program in a specific desktop

autostart

In the Kubuntu system settings I can specify the programs that are to be autostarted. But can I specify which desktop they are to start on? For instance, can I cause kmail to be autostarted on Desktop 1, Firefox on Desktop 2, etc.?

Best Answer

I believe what you are looking for is a terminal utility called wmctrl

It is not installed in Ubuntu by default but it can be found in the repositories:

sudo apt-get install wmctrl

You can use it to perform a number of operations - in your case it can move a window to a specific desktop after it has launched.

firefox &
wmctrl -r :ACTIVE: -t 2

The above set of commands will launch firefox and then move the active window (firefox) to desktop 2.

If firefox takes long to open its active window, you can try using a wait command before running wmctrl.

You can create a shell script with the these commands and make KDE to run it at startup in the "Autostart" utility.

Related Question