You are not logged in.
Hello, I'm having some trouble starting X at login.
I followed the instructions from the wiki involving placing a command in my .bash_profile. Everything works fine, except the shell script initializing my startup applications doesn't seem to run.
I've tried running the script before and after starting X, and running the command in my .xinitrc with no success.
My .bash_profile:
#
# ~/.bash_profile
#
# Source .bashrc if it exists
[[ -f ~/.bashrc ]] && . ~/.bashrc
# Make chromium the Default Browser
if [ -n "$DISPLAY" ]; then
BROWSER=chromium
fi
# Add ~/grive/bin to the path recursively, allowing scripts locate d there to be run without location, from http://superuser.com/questions/345294/recursively-add-directory-to-path-variable
for d in /home/david/grive/bin/*/; do
PATH+=":$d"
done
export PATH
# Create $G variable for google drive
G=/home/david/grive/
export G
# Create $GB variable for google drive bin
GB=/home/david/grive/bin
export GB
# Start X, from https://wiki.archlinux.org/index.php/Start_X_at_Login
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
# Run startup scripts
warmup &My .xinitrc:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
xmonad
# warmupAnd the shell script, named "warmup":
#!/bin/bash
# Commands to run at startup
browser &&
terminator &
irc &Any thoughts?
Offline
Doesn't xmonad have a builtin startup mechanism (a way to run things when it starts)? That would be the best way.
If not, and assuming you don't really have a "#" in front of your script when you expect it to run, try putting a '&' after xmonad in xinitrc. The way you have it now, your script won't run until xmonad exits. You could also try running your script before you call xmonad, and then call "exec xmonad"
Last edited by 2ManyDogs (2012-12-17 19:48:32)
Offline
Some pointers:
It seems unnecessary to manually source ~/.bashrc.
Isn't checking for $DISPLAY before X is started always going to fail?
In ~/.bash_profile, the line "export G" should be "export $G"; same for GB.
It would make sense to start applications that depend on a running X server either in ~/.xinitrc or your window manager of choice.
In ~/.xinitrc, the line "xmonad" should probably be "exec xmonad".
Is "browser" in your $PATH? If your intent is to call the BROWSER environment variable, it should read $BROWSER (see also point 2). The double ampersands following it should most likely not be there. && in bash is a logical AND.
I use linux and I dont understand nothing in this post.
Offline
Doesn't xmonad have a builtin startup mechanism (a way to run things when it starts)? That would be the best way.
Good thinking, thanks.
You could also try running your script before you call xmonad, and then call "exec xmonad"
That works! Greatest thanks!
It seems unnecessary to manually source ~/.bashrc.
What is the preferred way? Should I just skip it all together?
Isn't checking for $DISPLAY before X is started always going to fail?
It seems to work - as I said, I got the command from the wiki.
In ~/.bash_profile, the line "export G" should be "export $G"; same for GB.
Huh, this has worked with no problems so far.
It would make sense to start applications that depend on a running X server either in ~/.xinitrc or your window manager of choice.
[*]In ~/.xinitrc, the line "xmonad" should probably be "exec xmonad".[/*]
So I've been told, which has resolved my problem
Is "browser" in your $PATH? If your intent is to call the BROWSER environment variable, it should read $BROWSER (see also point 2). The double ampersands following it should most likely not be there. && in bash is a logical AND.
I'm not exactly sure which ampersands you're referring to - how should I go about this instead?
Offline
Good to hear you got everything working.
What is the preferred way? Should I just skip it all together?
Well, according to the wiki, ~/.bashrc is automatically sourced by all non-login interactive shells. However, I suppose it would make sense to manually source it for a login shell... although I don't know why you'd need to.
It seems to work - as I said, I got the command from the wiki.
It does say that in the wiki but I figured it'd have to be placed in something sourced after ~/.bash_profile; but, if it works, I guess that's what counts. ;)
Huh, this has worked with no problems so far.
You're totally right. $VARIABLE is for expanding the variable, but you can refer to the name (which apparently works in the case of export) without the preceding $. News to me!
I'm not exactly sure which ampersands you're referring to - how should I go about this instead?
Following "browser" in your warmup script there is &&; it's probably just a typo and you meant & to fork it.
I use linux and I dont understand nothing in this post.
Offline