You are not logged in.

#1 2010-09-02 15:32:05

Athunye
Member
Registered: 2009-02-26
Posts: 33

Control flow in ~/.xinitrc (SOLVED)

I am trying to make xinitrc load some apps, depending whether I run gnome or openbox.

If I am running gnome and type this in terminal, it works:

vaio@athunye, Thu Sep 02 12:23:10 
~ $  
bash >>> if [ $(pidof gnome-session) ]; then echo 'Running Gnome'; fi
Running Gnome
vaio@athunye, Thu Sep 02 12:27:10 
~ $  
bash >>> 

However, If I put this in ~/.xinitrc it just does not do anything:

#!/bin/bash

#exec ck-launch-session dbus-launch openbox-session
exec ck-launch-session dbus-launch gnome-session

sleep 11
if [ $(pidof gnome-session) ]; then
    xrdb ~/.Xdefaults
    sleep 3 && conky &
    sleep 3 && gnome-terminal --profile Irssi &
fi

I also tried putting that if block in another file and call that file form xinitrc but it
also just didn't nothing. However, if I run this other file ( ./run_apps.bash) it then works.

Any ideas ?

Last edited by Athunye (2010-09-23 10:46:34)

Offline

#2 2010-09-02 15:41:31

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Control flow in ~/.xinitrc (SOLVED)

I have a guess before the BASH + X gurus find your question: Your conditional ("if...") will not run until the "exec" line finishes. In other words, your code won't run until you exit GNOME.

If that IS the case, I'm not sure what a solution would be... Don't GNOME and OpenBox both have their own methods of automatically starting applications?

Last edited by drcouzelis (2010-09-02 15:42:13)

Offline

#3 2010-09-02 15:51:31

Athunye
Member
Registered: 2009-02-26
Posts: 33

Re: Control flow in ~/.xinitrc (SOLVED)

drcouzelis wrote:

If that IS the case, I'm not sure what a solution would be... Don't GNOME and OpenBox both have their own methods of automatically starting applications?

Yes, they do. I do let the file $HOME/.config/openbox/autostart.sh do its job.
About gnome, using "Startup Applications" does not work with conky.

I tried calling the other file before the exec command but I was not lucky.
Thanks for the reply.

Offline

#4 2010-09-02 16:08:56

humanzoo
Member
Registered: 2007-10-14
Posts: 28

Re: Control flow in ~/.xinitrc (SOLVED)

Try something like:

#exec ck-launch-session dbus-launch openbox-session &
exec ck-launch-session dbus-launch gnome-session &
PID=$!

sleep 11
if [ $(pidof gnome-session) ]; then
    xrdb ~/.Xdefaults
    sleep 3 && conky &
    sleep 3 && gnome-terminal --profile Irssi &
fi

wait $PID

Last edited by humanzoo (2010-09-02 16:09:11)

Offline

#5 2010-09-02 16:18:26

Athunye
Member
Registered: 2009-02-26
Posts: 33

Re: Control flow in ~/.xinitrc (SOLVED)

humanzoo

Your example worked like a charm. Thanks a lot.

Last edited by Athunye (2010-09-23 10:46:04)

Offline

Board footer

Powered by FluxBB