Choosing between multiple DEs/WMs to launch
I have both xfce and i3wm installed on my slackware machine. I'm know there are graphical "display managers" (not sure if that's the correct term) and "login managers" that will present the DEs or WMs that are installed and let you choose the one you'd like to launch. I would prefer to make the selection from the login shell, not graphically, by running startx. Everytime I want to switch between xfce and i3wm I have to comment out one of their entries in the .xinitrc file.
I'm wondering if there is a way to choose which one I'd like to launch with a bash script inside the .xinitrc file. I'm not familiar with bash but I'm sure I could learn what would be required for this task. I was thinking something along the lines of when startx or xinit is entered, the user would be prompted to enter a number, either 1 or 2. 1 corresponding to i3 and 2 corresponding to xfce. The following is pseudo code of course, but I thought it could work like: Code:
prompt user for number Code:
echo 'HELLO XFCE' I was hoping that before I go and learn the bit of bash that's required for this task someone could tell me if I'm on the right path, or not? And, if not then tell me what I should be doing? Thanks |
I'm just guessing, but I think that would at least need a select function.
Something like: Code:
options=("xfce" "i3wm" "Quit") |
Isn't that what xwmconfig is for?
|
With just posix shell you could do something like this.
Code:
if [ $# -gt 0 ]; then |
Quote:
You can always select the runlevel when you boot; use 3 for a login shell and 4 for when you *know* that you will want a graphical environment and can then use kdm/xdm to select the environment. If you are in runlevel 3, you can nonetheless issue telinit 4 or (not tested) sudo telinit 4 to bring up kdm/xdm. It's your system, of course, and you may certainly do things as you wish. |
You didn't ask me, but I use startx too because I never really found the need for anything more. It works just fine and editing ~/.xinitrc is more than enough to start a minimal wm. :)
|
Quote:
The xwmconfig command edits .xinitrc for you, but in an ncurses interface. You can run it in runlevel 3. After selecting the WM/DE you can run startx. |
xwmconfig has the problem of wiping out any other changes that have been made to ~/.xinitrc.
|
Quote:
I use kdm to log in every time; it's easy to log out of XFCE, select KDE, and log into that. When I'm done, reverse the process. If you only use one wm, then startx is fine. |
This should work.
Caveat: I didn't try in Slackware. Code:
#!/bin/sh Needs: http://slackware.uk/slint/x86_64/sli...countsservice/ |
Thank you everyone for your replies.
@Skaendo @orbea @Didier Spaier - Thanks for the code. I'm learning my first programming language right now, which has allowed me to follow the logic of these scripts quite a bit, but I will have to study bash to understand the finer points. @montagdude @mralk3 - Thanks for info about xwmconfig. I do have dmps settings in .xinitrc for when i3 is launched that would be wiped out if I were to switch to a different de/wm. @Richard Cranium - Nice to hear from you again. Well, to be honest besides the different run levels I wasn't aware of the other options you mentioned, including being able to select different run levels upon booting (I'll look into that). Since I started using Slackware I've just left it at run level 3 and used startx, I was only using one wm at the time, though. Now that I have two, I basically just thought of a solution building on what I already knew; startx. Since all that was in my .xinitrc file to start i3 was one line: exec i3, I thought I would try to see if I could add a script to that file with a simple if-else construct and may or may not prompt the user for input. So, instead of issuing "startx" I would just type "startx i3" or "startx xfce", or after issuing "startx" I would be prompted to make a selection, which if worked, wouldn't be much trouble at all. Also, I thought it would be cool :D Thanks again for the support. It's much appreciated. |
xwmconfig does not wipe out .xinitrc - before it creates backup .xinitrc-backup. So any custom settings are safe.
|
All times are GMT -5. The time now is 08:56 PM. |