I want to automatically run a program when a user logs on their account
I know how to use rc.local, but what about automatically running something in the X environment when the user first logs in?
Are you wanting this to be an X program or from a console or terminal?
Creating a .bash_login usually works for either way.
isn't that what .xinitrc is for? I may be misunderstanding your question, but in general when the X window system starts up, it checks for the .xinitrc file in the user's home directory. It will then execute what is in that. For instance, I have this:
-- the dudeman
I think we're on the same page, linuxluser, but I don't see that hidden file in my home directory. What next?
I have the same problem, I never had a .xinitrc file in my home directory. I added one to run some commands to remap my mouse wheel so it will scroll properly, but the .xinitrc file never gets parsed (as far as I can tell). The .xinitrc file is shown below:
# (c) 2000-2002 MandrakeSoft
# $Id: xinitrc-xinitrc,v 1.2 2002/09/10 05:53:43 flepied Exp $
# Set a background here because it's not done anymore
# in Xsesion for non root users
if [ "`whoami`" != root ]; then
xsetroot -solid "#21449C"
# the following was added by CJW 2005-01-24 for wheel mouse support
/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"
$BINARY -k -p -b "67"
# end addition 2005-01-24
exec /etc/X11/Xsession $*
If I run the "/usr/X11R6/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"" in a shell everything works fine.
Note that I'm running Mandrake 9.2 and KDE with a graphical logon screen.
If anyone has any thoughts as to why .xinitrc doesn't get parsed, please let me know!
If you don't have .xinitrc then you can make it. The man pages (of startx) indicate that when the .xinitrc file exists, the session exits. You need to have everything run in the background except for the last command. That's why I had an ampersand on the end of every line except the last (which loads my window manager). If you don't, you can get a blank screen or a program unexpectantly exiting or something weird like that.
Sorry if I was unclear about that.
-- the dudeman
Graphical login managers (such as xdm, kdm, gdm) will
use the configuration file:
mv .xinitrc .xsession
|All times are GMT -5. The time now is 06:15 PM.|