Possible to switch between i3 and openbox without lightdm?

I’m fairly new to Linux so bear with me please.

I skipped the lightdm in the installation but installed i3wm and openbox and chose it to use openbox as default.

Is there an easy way to still swith over to i3 without having the option to logout since that just logs me in to openbox again. I guess it’s because I have no display manager installed.

Thanks.

.xinitrc obviously held one way forward, however I was looking for a simple way to toggle between the various WMs.

Thanks again.

I don’t think so, because I don’t think either openbox or i3 support window manager switching the way fvwm and fluxbox do.

You can comment out the line that automatically logs you into the window manager - that’s in your ~/.zprofile by default. You’ll still auto login to the console.

Then take a look at your ~/.xinitrc file, it’s set up for multiple window managers, and there are some comments on how to start the window manager you want.

1 Like

Without a display manager, ArchLabs runs a stanza in ~/.zprofile to autostart the openbox desktop (I think).

You can replace that with your own version; this example will launch openbox if the login is at TTY1 or an i3 desktop if logged in at TTY2:

case $(tty) in
   "/dev/tty1") exec startx $(which openbox-session);;
   "/dev/tty2") exec startx $(which i3);;
esac

Note though that this method bypasses ~/.xinitrc completely so any startup commands from that file must instead be added to the openbox & i3 autostart files.

EDIT: no, you would have to disable the console autologin as well so PackRat’s suggestion is better, I think.

You can change the line near the top of ~/.xinitrcsession=${1:-openbox} with a sed command mapped to a keybind

sed -i "/session=/ c session=$\{1:-REPLACEMENT}" $HOME/.xinitrc

After which simply logging out will have you logged back in to the new session.

As an alias which can be run when logging into console, as @PackRat said

alias starti3="sed -i '/session=/ c session=$\{1:-i3}' $HOME/.xinitrc && startx"
alias startob="sed -i '/session=/ c session=$\{1:-openbox}' $HOME/.xinitrc && startx"

Another alternative as mentioned by @Head_on_a_Stick with some slight variation, would be to edit ~/.zprofile. You can pass some arguments to startx, namely the xinitrc path and which session to launch

if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then
    exec startx ~/.xinitrc openbox
elif [[ -z $DISPLAY && $XDG_VTNR -eq 2 ]]; then
    exec startx ~/.xinitrc i3
fi

With this using Ctrl-Alt-F2 will switch you to tty2, and i3 will be started, using Ctrl-Alt-F1 will switch back to tty1 and openbox.

This could also be done with a bit more script to log yourself out and kill xinit before starting the other WM if you don’t want multiple sessions running in memory at once

2 Likes

Thank you all, it’s much appreciated.

Found this older thread when i suddenly had a similar problem. So now there’s no WM at all unless one chooses to install LightDM? I liked the one used in earlier releases, before autologin was default. Was that SLIM? Thanks.

Lightdm was the display manager we used previously

1 Like

I found an interesting theme, I think with some adjustments in the size, text and colors of the default system type the ctrl + x window should look cool.
lightdm-tty

1 Like

Thanks Nate! I guess it was just themed differently. It looked way cooler on AL than the default. Anyway, i did a test install on another laptop adding LightDM, all possible desktops, and a few others later. Works fine- though i am totally lost using tiling. It will be fun to play around with all the possibilities!

Thanks m.rogers! Sounds promising. Don’t know that I’m yet up to the task of theming LightDM, but I’ll keep this in mind for later.

1 Like

Hmmm, I think I messed up, sorry! haha :grin:
Anyway, it’s gone.

Good luck!