LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-04-2011, 06:33 PM   #1
xtiansimon
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Rep: Reputation: 0
How do I set-up to launch my DE with ck and dbus from bash?


What I am currently trying to accomplish is to start Xfce or Fluxbox from the command line (and run level 3). I've discovered there are several other packages/apps needed to be launched with either. The normal installed setup is to boot into run level 5, where I get the login screen which has a menu to select the DE/WM of my choice. Presumably this selection also loads the other necessary apps that make any DE a usable system. For example, I've found it necessary to startx & Xfce using the following command placed in ~/.xinitrc

exec ck-launch-session dbus-launch startxfce4

The trouble is startx only works for one DE/WM at a time, and I wish to retain the option to select my DE/WM from a list of options (currently Xfce and Fluxbox).

My first thought: what is the equivalent of the above command I can run from bash prompt? If I had this, I could write an alias to put in .bashrc...
 
Old 08-05-2011, 04:18 AM   #2
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Quote:
Originally Posted by xtiansimon View Post
The trouble is startx only works for one DE/WM at a time, and I wish to retain the option to select my DE/WM from a list of options (currently Xfce and Fluxbox).
No you can have in .xinitrc something like :
Code:
select wm in Xfce Fluxbox nothing; do
    case $wm in
        Xfce) echo "exec ck-launch-session dbus-launch startxfce4";;
        Fluxbox) echo "exec ck-launch-session dbus-launch fluxbox";;
        nothing) break;;
    esac
done
Replace the 'echo' by the real command to execute.
So startx will give the choice to launch a WM or another.
 
Old 08-08-2011, 01:57 PM   #3
xtiansimon
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 0
@berbae: clever and quick. However it did not work as written. Bash scripting is not my bag--if that is what this is... Will you provide more information and I can research your solution?
 
Old 08-08-2011, 03:15 PM   #4
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
I know it doesn't work as written : I wrote the 'echo' command instead of the 'exec ...' command to be executed, just to test the choices. The working writing would be :
Code:
select wm in Xfce Fluxbox nothing; do
    case $wm in
        Xfce) exec ck-launch-session dbus-launch startxfce4;;
        Fluxbox) exec ck-launch-session dbus-launch fluxbox;;
        nothing) break;;
    esac
done
without the 'echo'.

In case of problem, post your entire .xinitrc file, and error messages after you launched startx.

Last edited by berbae; 08-08-2011 at 03:17 PM.
 
Old 08-08-2011, 11:28 PM   #5
xtiansimon
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Cool

Quote:
Originally Posted by berbae View Post
I know it doesn't work as written : I wrote the 'echo' command instead of the 'exec ...' command to be executed, just to test the choices.
Well, you know more about bash scripting than I do. (^_^)
 
Old 08-09-2011, 07:58 AM   #6
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
So does it work now ?
And if so, please mark the thread as SOLVED (and click Yes to the 'Did you find this post helpful?' question, thanks).
 
Old 08-10-2011, 08:31 AM   #7
xtiansimon
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Its not working. Instead I enter startx command. The screen blanks out from the command line as if something is happening. The command line returns with this printed,
Quote:
1) xfce
2) fluxbox
3) nothing
#?

xwindows is shutting down.
I am not presented with the opportunity to select the window manager. Am I doing something wrong? Am I supposed to pass an argument to the command startx?
 
Old 08-10-2011, 11:09 AM   #8
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
In fact that approach doesn't seem to work, sorry.
It's because the .xinitrc script is called by xinit after the X server is launched.
So it cannot be used to run an interactive bash command when the graphical environment is already started.

So you were right to say "startx only works for one DE/WM at a time".

The only way I see now is to create several .xinitrc, with different names of course, for each WM, and pass one as parameter to startx, using a new script, for example named 'startwm', which you run instead of startx :
Code:
#!/bin/bash
# script startwm, to use instead of startx
select wm in Xfce Fluxbox nothing; do
    case $wm in
        Xfce) startx $HOME/.xinitrc-xfce4;;
        Fluxbox) startx $HOME/.xinitrc-fluxbox;;
        nothing) break;;
    esac
done
with $HOME/.xinitrc-xfce4:
Code:
#!/bin/bash
...
exec ck-launch-session dbus-launch startxfce4
and $HOME/.xinitrc-fluxbox
Code:
#!/bin/bash
...
exec ck-launch-session dbus-launch fluxbox
Replace ... with other commands which are present in the original .xinitrc script.

That's something you could try. Tell me if that works.

Last edited by berbae; 08-10-2011 at 03:04 PM.
 
Old 08-17-2011, 07:47 PM   #9
xtiansimon
LQ Newbie
 
Registered: Nov 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Kudos! It does indeed work.

All worked as expected save for one bit. When I logout back to runlevel 3, I get "#?" prompt. Its a good thing you added 3, else I'd have been in a loop!

I didn't get to programming via CS, so I'm surprised by your kung-fu. The double ;; and the lack of {} is strange to me. What is this style?
 
  


Reply

Tags
fedora15, startx, xfce


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to execute dbus-launch to autolaunch D-Bus session wds Linux - Desktop 1 04-21-2012 05:39 PM
Strange error on bash launch samineru Linux - Software 7 06-21-2011 09:41 PM
Fedora Core 9 update dbus.exception & dbus.proxies & DBus.Error.AccessDenied errors trien27 Fedora 1 12-08-2008 11:23 PM
dbus-launch error HarryBoy Linux - Newbie 0 07-01-2008 11:44 AM
Bash to Auto Launch a Program???? embsupafly Linux - Software 1 07-27-2004 12:25 AM


All times are GMT -5. The time now is 09:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration