Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
You mentioned crontab, which confused me now. Run GUI app on startup or everyday ? –  warl0ck Jul 30 '12 at 10:04
    
on startup. asfadsfsdf –  Hermann Ingjaldsson Jul 30 '12 at 10:06

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
i dont have a .xinitrc file in my home directory. does it work just like crontab? Also, i have a .config directory under my home directory, but no 'autostart' directory under that. So i cant see any entries there. –  Hermann Ingjaldsson Jul 30 '12 at 9:43
    
I added an example ~/.xinitrc configuration. Since you did not specify any details about your system, that is all help I can provide. It is the most generic way and does not depend on the configuration of any particular desktop enviroment or login manager. –  Marco Jul 30 '12 at 10:06
    
ok so .xinitrc can be just a normal bash file. But it doesn't work. I put 'gmail-notify &' into it, which if i type into the terminal runs the gmail utility. But even though this command is in the .xinitrc, the gmail-notify does not run on startup. –  Hermann Ingjaldsson Jul 30 '12 at 10:20
1  
1  
Ok so the latter part of this answer is the solution, the wording could just be improved a bit. One makes a .desktop file of the given gui application by right clicking it in the menu and placing an entry of it on the desktop. Then one moves that new .desktop file to ~/.config/autostart. Now that given gui app starts automatically at bootup. –  Hermann Ingjaldsson Jul 30 '12 at 11:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.