Thursday, June 28, 2012

Linux Start Application on Boot

Since being in the army I haven't had a lot of time to mess around with my personal computers.  However, I am back in the states and settled down for a bit so I decided to built myself a desktop computer.  I didn't have a lot of money, so older hardware and Linux was the route I took.

On a recommendation from a friend I researched a program called Synergy which was supposed to allow you to use a single mouse, keyboard, and clipboard across multiple computers and OSs via TCP-IP.

I cobbled together three older machines with about one gig of RAM a piece and loaded Lubuntu ( a lite version of Ubuntu Linux ) on each of them.  The Synergy program worked great and I was able to have a three monitor three machine system that felt much like one machine when using it.

Unfortunately, I ran into a small headache.  Every time I restarted a machine Synergy would shutdown.  On windows it has the option to start with the computer, but Linux is pretty much all manual configuration.  Some versions of Linux GUIs now have session managers which allow users to setup custom programs through a nice GUI app, but Lubuntu doesn't yet come with that.  After a little research I came across a website with a very nice detailed answer, which is copied below in case their site goes down.

There are two main steps:


  1. Create a text file named firefox.desktop in your ~/.config/autostart directory. (~ represents the current users home directory, typically /home/user; you will also have to click on View/Show Hidden in the File Manager to see folders starting with a period.)
  2. Fill the new file with contents.


Obviously rename the first part of the filename to whatever description best fits the program you are trying to start.  Below are 4 different examples to start up various programs, firefox and thunderbird were the examples on the site, chromium and synergy are the files I built for my needs.  Use or modify them to fit your needs.

One additional bonus, by creating this file you will also make an entry appear in the "Start menu"/Preferences/"Desktop Session Settings" program allowing you to easily toggle it on or off without having to delete and recreate the file.


[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox


[Desktop Entry]
Version=1.0
Name=Thunderbird Email Client
Comment=Email Client
GenericName=Email Client
Exec=thunderbird -%u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=thunderbird


[Desktop Entry]
Version=1.0
Name=Chromium Web Browser
Comment=Access the Internet
GenericName=Chromium
Type=Application
Exec=/usr/bin/chromium-browser %U
Terminal=false
X-MultipleArgs=false



[Desktop Entry]
Version=1.0
Name=Synergy Client
Comment=Connect to the keyboard network
GenericName=SynergyC
Type=Application
Exec=synergyc 192.168.111.114
Terminal=true
X-MultipleArgs=false