howto switch among WMs
Posted: Sat 24 Nov 2007, 00:35
no dotpup, as it is required to tweak some systemfiles.
So only a description, so you can adapt this idea on any pupplett.
WARNING:
remember that you can use "mp filename" to edit files, if X fails to start, when you made a mistake
Edit /usr/X11R7/bin/xwin
around line 17, replace
echo -n "$1" > /etc/windowmanager
with
echo -n "muppywm $1" > /etc/windowmanager
Now create a file (and set it executable!)
/usr/local/bin/muppywm
I use "ash" as shell, as it needs less resources than bash.
If you now start X with "xwin jwm", then jwm will not run directly.
Instead, the "endless loop" muppywm is the highest instance that runs.
muppywm now will run jwm as a childprocess.
So if you kill jwm from a rxvt, X will continue to run.
So all we need now, is a grafical tool to kill the running WM, and start another one.
I encountered some timing-problems, so this looks maybe a bit complex.
/usr/local/bin/muppywmchooser
If you saved (and made it executable!), you finally must add it to your startmenus.
And you can replace the old "restart wm" entries with new ones, that will run "fixmenus" when you restart one of them.
This could be needed after the installation of a dotpup.
Edit the templates in /etc/xdg/templates, then run "fixmenus" and restart your WM.
for jwm:
for icewm:
Now you have a new entry "windowmanager" in jwm and icewm, that displays a dialog with 2 buttons to choose jwm or icewm.
You could enhance it to work with fluxbox and others.
Mark
So only a description, so you can adapt this idea on any pupplett.
WARNING:
remember that you can use "mp filename" to edit files, if X fails to start, when you made a mistake
Edit /usr/X11R7/bin/xwin
around line 17, replace
echo -n "$1" > /etc/windowmanager
with
echo -n "muppywm $1" > /etc/windowmanager
Now create a file (and set it executable!)
/usr/local/bin/muppywm
Code: Select all
#!/bin/ash
$1 &
while [ 1 ]
do
sleep 10000
done
If you now start X with "xwin jwm", then jwm will not run directly.
Instead, the "endless loop" muppywm is the highest instance that runs.
muppywm now will run jwm as a childprocess.
So if you kill jwm from a rxvt, X will continue to run.
So all we need now, is a grafical tool to kill the running WM, and start another one.
I encountered some timing-problems, so this looks maybe a bit complex.
/usr/local/bin/muppywmchooser
Code: Select all
#!/bin/bash
if [ "$1" == "-restartwm" ];then
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
if [ "$pid" != "" ];then
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
mpid=$!
#jwm needs a focus-change to continue, so build and destroy a second dummy-message
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
dpid=$!
while [ "$pid" != "" ];do
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $pid
kill $dpid
done
kill $mpid
fi
icepid=`ps -ax | grep " icewm " |grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $icepid
killall icewmtray
xmessage -bg orange -center -borderless -buttons "" "rebuilding menus..." &
pid=$!
fixmenus
kill $pid
wm=`cat /etc/windowmanager | sed "s/^muppywm //"`
xmessage -timeout 3 -bg orange -center -borderless -buttons "" "starting $wm..." &
"$wm" &
exit 0
fi
xmessage -bg orange -center -title "WindowManager" -buttons Icewm:101,jwm:102 Choose your Windowmanager
a=$?
#xmessage $a
if [ "$a" == "101" ];then
echo "muppywm starticewm">/etc/windowmanager
#killall icewm
pid=`ps -ax | grep " icewm " |grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $pid
killall icewmtray
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
if [ "$pid" != "" ];then
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
mpid=$!
#jwm needs a focus-change to continue, so build and destroy a second dummy-message
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
dpid=$!
while [ "$pid" != "" ];do
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $pid
kill $dpid
done
kill $mpid
fi
xmessage -timeout 3 -bg orange -center -borderless -buttons "" "starting icewm..." &
starticewm &
exit 0
fi
if [ "$a" == "102" ];then
echo "muppywm jwm">/etc/windowmanager
pid=`ps -ax | grep " icewm " |grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $pid
killall icewmtray
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
if [ "$pid" != "" ];then
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
mpid=$!
#jwm needs a focus-change to continue, so build and destroy a second dummy-message
xmessage -bg orange -center -borderless -buttons "" "jwm shuts down, wait......" &
dpid=$!
while [ "$pid" != "" ];do
pid=`ps -ax | grep " jwm " |grep -v muppywm|grep -v grep | sed -e "s/^ *//" -e "s/ .*//"`
kill $pid
kill $dpid
done
kill $mpid
fi
xmessage -timeout 3 -bg orange -center -borderless -buttons "" "starting jwm..." &
sleep 1
jwm &
exit 0
fi
And you can replace the old "restart wm" entries with new ones, that will run "fixmenus" when you restart one of them.
This could be needed after the installation of a dotpup.
Edit the templates in /etc/xdg/templates, then run "fixmenus" and restart your WM.
for jwm:
Code: Select all
<Program label="WindowManager" icon="xapp.png">exec muppywmchooser</Program>
<Program label="Restart JWM" icon="mini-windows.xpm"> muppywmchooser -restartwm</Program>
Code: Select all
prog "WindowManager" mini-windows muppywmchooser
restart "Restart IceWM" mini-windows muppywmchooser -restartwm
You could enhance it to work with fluxbox and others.
Mark