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.?
2 Answers
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.

- 630
- 1
- 8
- 20
Add .desktop
files to /home/username/.config/autostart
and make sure they're marked as executables.
Here is a default syntax for a .desktop file with some of the most important entries.
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name="NAME OF THE APPLICATION"
Comment="WHAT DOES THE APP DO?"
Exec="EXECUTABLE PATH OF APPLICATION"
Hidden=false
NoDisplay=false
Terminal=false
For example :
To Autostart firefox, execute the following commands in terminal :
sudo gedit ~/.config/autostart/firefox.desktop
and copy the following content in the file (firefox.desktop) and then save it
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Firefox
Comment=Firefox Web Browser
Exec=firefox
Hidden=false
NoDisplay=false
Terminal=false
then mark it as executable by executing following command in terminal :
sudo chmod +x ~/.config/autostart/firefox.desktop
Similarly you can autostart other applications. For applications that have their binaries in /usr/bin, full path isnt required (like firefox)
Logout and login again to see the changes!

- 4,511