Hello everyone! I want to share a script that was originally created by @01micko , and I have only updated it for the KL environment. This script allows you to easily switch between different window managers (WM) in Linux. The switcher uses the /root/.xsession file to determine which desktop environment is currently in use and makes the change from there, rewriting that file as necessary.
How does it work?
The script checks the contents of /root/.xsession and, depending on which window manager is specified, changes it to another one of your choosing. This allows you to toggle between various desktop environments with just a single command.
Example of use:
Run the script to see the current WM.
Select the new WM you want to use.
The script will update /root/.xsession and automatically switch to the new environment.
This approach simplifies the management of multiple window managers and gives you the flexibility to customize your desktop environment according to your preferences.
You should also add these lines to the .xinitrc to launch the desired desktop environment.
Code: Select all
CURRENTWM="`cat /root/.xsession`"
if [ "$CURRENTWM" = "mate-session" ]; then
exec mate-session
elif [ "$CURRENTWM" = "startlxde" ]; then
exec startlxde
elif [ "$CURRENTWM" = "openbox-session" ]; then
exec openbox-session
elif [ "$CURRENTWM" = "bspwm" ]; then
exec bspwm
elif [ "$CURRENTWM" = "startfluxbox" ]; then
exec startfluxbox
elif [ "$CURRENTWM" = "dwm" ]; then
exec dwm
elif [ "$CURRENTWM" = "startxfce4" ]; then
exec startxfce4
elif [ "$CURRENTWM" = "spectrwm" ]; then
exec spectrwm
elif [ "$CURRENTWM" = "startkde" ]; then
exec startkde
elif [ "$CURRENTWM" = "jwm" ]; then
exec jwm
fi
.
.