The time now is Sat 25 May 2013, 18:57
All times are UTC - 4 |
| Author |
Message |
MU

Joined: 24 Aug 2005 Posts: 13642 Location: Karlsruhe, Germany
|
Posted: Fri 23 Nov 2007, 20:35 Post subject:
howto switch among WMs |
|
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
| Code: | #!/bin/ash
$1 &
while [ 1 ]
do
sleep 10000
done |
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
| Code: | #!/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
|
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:
| Code: | <Program label="WindowManager" icon="xapp.png">exec muppywmchooser</Program>
<Program label="Restart JWM" icon="mini-windows.xpm"> muppywmchooser -restartwm</Program> |
for icewm:
| Code: | prog "WindowManager" mini-windows muppywmchooser
restart "Restart IceWM" mini-windows muppywmchooser -restartwm |
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
|
|
Back to top
|
|
 |
cb88

Joined: 28 Jan 2007 Posts: 1160 Location: USA
|
Posted: Sat 24 Nov 2007, 23:09 Post subject:
|
|
MU have you ever looked at murga lua? there is a script in DSL 4.0 to switch WM and it works quite well...
_________________ Taking Puppy Linux to the limit of perfection. meanwhile try "puppy pfix=duct_tape" kernel parem eater.
BeOS Max-Vectorgamma: Tyan thund 2 512 ram 2x PII 300
Vectorsigma (laptop): Gentoo Athlon II X2 2Ghz 4Gb ram radeon 4200 mesa-git
|
|
Back to top
|
|
 |
MU

Joined: 24 Aug 2005 Posts: 13642 Location: Karlsruhe, Germany
|
Posted: Sat 24 Nov 2007, 23:37 Post subject:
|
|
no, had no look.
But the solution described above works very stable on my system, and can easily be modified, as it is only some shellscripting
Mark
|
|
Back to top
|
|
 |
J-Bob

Joined: 09 Feb 2008 Posts: 283 Location: Canada
|
Posted: Tue 20 Jan 2009, 17:30 Post subject:
Re: howto switch among WMs |
|
| MU wrote: | 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
| Code: | #!/bin/ash
$1 &
while [ 1 ]
do
sleep 10000
done |
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
| Code: | #!/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
|
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:
| Code: | <Program label="WindowManager" icon="xapp.png">exec muppywmchooser</Program>
<Program label="Restart JWM" icon="mini-windows.xpm"> muppywmchooser -restartwm</Program> |
for icewm:
| Code: | prog "WindowManager" mini-windows muppywmchooser
restart "Restart IceWM" mini-windows muppywmchooser -restartwm |
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 |
Just in case you are wondering, Mark. I plan to add this to the second milestone 3.03CE, also called the second collective alpha for 3.10CE
I might do a bit of tweaking to add a bit of "Puppy" branding to it, but i don't see that being a problem.
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|