Startup – Run GUI Application on Boot

bootcronguistartup

I can run a script at boot by adding the following line to my crontab:

@reboot perl /path/script

That works fine. But the problem arises when I try to run a gui application such as gmail notify. It simply doesn't run.

How do I run a gui application on startup?

Best Answer

Cron is not the program you're after. To run GUI programs there are different approaches. Which one to choose depends on your desktop environment.

The traditional way is to hook it into your .xinitrc file before starting the window manager. A simple example .xinitrc looks as follows:

#!/bin/sh

# Play a login sound
ogg123 -q "${HOME}/Music/login.ogg" &

# Start a terminal emulator
urxvt -T Terminal &

# Start the window manager
exec awesome

Depending on the desktop environment, you can also use ~/.config/autostart/ and create a program.desktop file. Check that directory, if it already contains entries. That's the easiest way, I guess.

autostart […] defines a method for automatically starting applications during the startup of a desktop environment […]

Source: freedesktop autostart specification

Related Question