You are not logged in.
I'm trying to run several commands by including them in my .xinitrc file and for some reason they don't want to work.
Is there something wrong with my .xinitrc file?
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
setkeycodes e02f 120 &
xmodmap ~/.Xmodmaprc &
xbindkeys &
# exec gnome-session
exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
# exec xterm
Last edited by Gumper (2009-11-28 19:23:45)
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline
Think there is nothing wrong with it. You could try sleeping those 3 commands for a few seconds and wait before KDE starts, maybe kde overrides those whe it initiates.
sleep 5;setkeycodes blah blah ; xbind keys.
Or you could choose for KDE to run those when it initiates.
Cheers.
Offline
try to put the whole path of the commands ex. /usr/bin/xbindkeys
Offline
in my opinion you have to put "exec" before every line. Like is done with "gnome-session" and the other commands. .xinitrc is not a normal bash file.
or better, as I see you use KDE, i think you should put xbindkeys in the start programs list of KDE. The others commands, you can put them into your .bashrc
Offline
No, exec just has to be put in front of the last command IIRC. Doesn't your .xinitrc actually work at all, e.g. does it start KDE? Is it executable? If not, try
$ chmod +x .xinitrc
Offline
.xinitrc doesn't need to be executable, and no you don't need `exec` before every command. `exec` gets used to essentially link that process to the X server, when that process exit so does the server. (man exec for a real explanation) So in most cases the WM is the most logical case to use exec.
I'm assuming those commands are not producing errors when you run them after you are in X. Try Ekimino's solution and sleep them for a few seconds or add them to KDE's autostart.
Offline
I tried the suggestion to try a "sleep". Now my file looks like this.
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
sleep 5
setkeycodes e02f 120 &
xmodmap ~/.Xmodmaprc &
xbindkeys &
# exec gnome-session
exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
# exec xterm
It still doesn't work. xbindkeys is not starting and the setkeycodes isn't doing anything either. I still get the message "unknown key pressed" in the kernel log. I'm not sure if xmodmap is doing anything either. Would a sleep before "exec startkde" work?
Prior to this I was running "xbindkeys" from kde's autostart folder and that was working, but I'm not sure how to add the other commands there. I guess I could just put those commands on a bash script and link that script in the autostart folder. It just seems cleaner to me to have them all start here in xinitrc.
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline
Are you starting X with the "startx" command?
Offline
Are you starting X with the "startx" command?
No, I'm not using the "startx" command. It starts by it's self.
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline
If you're using a login manager like gdm and kdm your .xinitrc will not get read. If you're not using a login manager please post some more details on your pre-X setup.
Offline
Appears we all overlooked the simplest solution by making assumptions :P
Offline
If you're using a login manager like gdm and kdm your .xinitrc will not get read. If you're not using a login manager please post some more details on your pre-X setup.
I'm confused. Isn't "kdm" my login manager and doesn't that start from .xinitrc?
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline
If you are using kdm it explains why your .xinitrc does nothing. As I stated above gdm and kdm does not utilize .xinitrc. I am not well versed with kdm configuration, but I think you can place a script with what you wish to autostart in ~/.kde/env/ folder. Read up on it here: http://docs.kde.org/stable/en/kdebase-runtime/faq/configure.html#id2535781'
Edit: No kdm does not start from .xinitrc. It either starts as daemon in /etc/rc.conf or from /etc/inittab.
Last edited by Ashren (2009-11-28 14:57:27)
Offline
If you are using kdm it explains why your .xinitrc does nothing. As I stated above gdm and kdm does not utilize .xinitrc. I am not well versed with kdm configuration, but I think you can place a script with what you wish to autostart in ~/.kde/env/ folder. Read up on it here: http://docs.kde.org/stable/en/kdebase-runtime/faq/configure.html#id2535781'
Edit: No kdm does not start from .xinitrc. It either starts as daemon in /etc/rc.conf or from /etc/inittab.
Thanks alot for the explanation. I do have "kdm" in my rc.conf (daemons). I believe that I put "kdm" in the .xinitrc file because the beginners guide instructed me to.
I was able to place a script in the autostart of kde, but it appears that the command "setkeycodes" needs to have root permissions. How do I do that in my script file. Here's what I have so far:
#!/bin/sh
setkeycodes e02f 120
xmodmap ~/.Xmodmaprc
xbindkeys
One other quick question. Instead of including this in the autostart folder of Kde, would it also work to put these commands in /etc/rc.local? Is one better than the other?
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline
If you place your script in /etc/rc.local it applies for all users. If you place it in ~/.kde ... it only applies for your user.
Use sudo for setkeycodes. Install sudo if you do not have it installed and add your user to the sudoers file. If you are uncertain how to do this check the wiki.
I believe that I put "kdm" in the .xinitrc file because the beginners guide instructed me to.
Are you REALLY sure about that?
Offline
If you place your script in /etc/rc.local it applies for all users. If you place it in ~/.kde ... it only applies for your user.
Use sudo for setkeycodes. Install sudo if you do not have it installed and add your user to the sudoers file. If you are uncertain how to do this check the wiki.
I believe that I put "kdm" in the .xinitrc file because the beginners guide instructed me to.
Are you REALLY sure about that?
Sorry but I'm a goober I don't have "kdm" in .xinitrc, I have "startkde". You're correct, the wiki didn't tell me to put "kdm" there. It told me to place "startkde" there.
I'll try the sudo part. Thanks for the help!
Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.
Offline