Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use xfce4 as my desktop environment, running on a Gentoo box. I want to start the pulseaudio server when I login. In general, how do I get a script to run as soon as I login to xfce, and how do I get a script to run when I logout?

share|improve this question
up vote 6 down vote accepted

If you have root access, you can always edit the startxfce4 script. According to the documentation:

startxfce4

The startxfce4 is a convenient script to start an Xfce 4 session from the console. It will give you a session with a taskbar and a panel and with the desktop manager and window manager running.

All programs, or symbolic links to programs, in ~/Desktop/Autostart/ will be run by startxfce4 on startup.

To customize the behaviour of startxfce4, copy the file ${sysconfdir}/xfce4/xinitrc to your personal ~/.config/xfce4/ directory and edit that file. If you install from source, ${sysconfdir} defaults to /usr/local/etc; for binary packages it is often set to /etc.

With the inclusion of a session manager in Xfce 4.2, the preferred way to change startup behaviour is by using the "Save session" option in the logout dialog.

Or you can use the xfce4-autostart-editor program.

For the logout part, see the http://wiki.xfce.org/tips page for the personal logout script.

share|improve this answer
    
Thanks, I didn't realize that xfce used ~/Desktop/Autostart. – Bkkbrad Aug 22 '09 at 20:56

You may want to check out the following which enables you to play login and logout sounds in Ubuntu xfce4.

http://ubuntuforums.org/showthread.php?t=1918649

Probably the simplest solution I have seen.

share|improve this answer
1  
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Canadian Luke Sep 7 '12 at 23:26
1  
exactly, Canadian Luke, because right now, "Ubuntu Forums is down for maintenance" :-( – djb Jul 23 '13 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .