Simple Window Manager Switcher Script

Moderator: Forum moderators

Post Reply
User avatar
josejp2424
Posts: 242
Joined: Sun Jul 12, 2020 11:40 pm
Has thanked: 258 times
Been thanked: 153 times

Simple Window Manager Switcher Script

Post by josejp2424 »

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

.

Image.

Attachments
wmswitcher-kla-0.22-1-x86_64.tar.bz2
wmswitcher-kla
(63.2 KiB) Downloaded 4 times
Post Reply

Return to “KL-Dev_Work”