How to easily switch window manager without display manager?

I would like to switch between i3/openbox, but I can’t seem to find any simple way of doing it using the command line or tty.
I don’t want to use a display manager.
How can I achieve this? Thanks.

I would use this stanza in ~/.profile:

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

^ This would run /usr/bin/openbox-session if the log in is at TTY1 and /usr/bin/i3 if TTY2 is used.

The only caveat with this method is that it may interfere with the startup mechanisms used by the ArchLabs desktop; sadly I am unfamiliar with these mechanisms, perhaps somebody who knows better can fill you in there.

EDIT: also, I think ArchLabs favours ~/.{bash_profile,zsh_profile} instead of ~/.profile and the latter will be ignored (for the shells in question) if the former exists.

1 Like

The default ~/.xinitrc should already be set up so that you can select various window managers; there is a brief explanation of the command to run at the beginning of .xinitrc.

You will need to comment out the line that automatically start the x-session at the end of your ~/.zprofile (assuming you have not changed from the default zsh shell).