Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Nov 2014, 12:16
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
howto switch among WMs
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: 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 Exclamation


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
View user's profile Send_private_message Visit_website 
cb88


Joined: 28 Jan 2007
Posts: 1169
Location: USA

PostPosted: 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.
X86: Sager NP6110 3630QM 16GB ram, Tyan Thunder 2 2x 300Mhz
Sun: SS2 , LX , SS5 , SS10 , SS20 ,Ultra 1, Ultra 10 , T2000
Mac: Platinum Plus, SE/30
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: 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 Smile


Mark
Back to top
View user's profile Send_private_message Visit_website 
J-Bob


Joined: 09 Feb 2008
Posts: 283
Location: Canada

PostPosted: 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 Exclamation


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
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0933s ][ Queries: 12 (0.0075s) ][ GZIP on ]