JWM to Fluxbox menu export

Miscellaneous tools
Post Reply
Message
Author
PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

JWM to Fluxbox menu export

#1 Post by PaulR »

I decided I'd like to use Fluxbox rather than JWM but the default install of Fluxbox doesn't have menus nicely set up so I wrote this tiny utility.

It exports menu data from .jwmrc to a new file in your ~/.fluxbox directory.

You can then cut and paste as required into ~/.fluxbox/menu to build your Fluxbox menu - a lot quicker than manually adding all those entries in a different format!

As far as I know this will work on any Puppy but I've only used it on Slacko 5.5.

Please note it does not make any changes to your original .jwmrc or menu files and has no real error checking - malformed menu entries might cause it to fall over but it seems to work fine.

You'll get a list of menu sections and programs dumped to the screen so you can see what it's found.
Attachments
fwmtoflux-menus.jpg
(29.06 KiB) Downloaded 7941 times
jwmtoflux.tar.gz
(15.76 KiB) Downloaded 621 times

User avatar
darkcity
Posts: 2534
Joined: Sun 23 May 2010, 19:16
Location: near here
Contact:

#2 Post by darkcity »

nice one, added link to Wiki
http://puppylinux.org/wikka/fluxbox

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#3 Post by PaulR »

Now imports icons for programs although Fluxbox on Slacko 5.5 doesn't seem to be compiled with support for .png hence the missing icons in the screen grab.

The BaCon source is included in the archive so if anyone wants to add icons for top level menu items or remove icon support altogether it should be a piece of cake. :D

Paul

Thanks to forum members seaside, scsijon, sunburnt & vovchik for thier help.
Attachments
menuicons.jpg
(70.52 KiB) Downloaded 1248 times
jwmtoflux.tar.gz
(17.87 KiB) Downloaded 587 times

User avatar
`f00
Posts: 807
Joined: Thu 06 Nov 2008, 19:13
Location: the Western Reserve

#4 Post by `f00 »

Good work, PaulR & friends :)

||| sidebar for illustrated menu |||

Converting .png to .xpm is an option, but (in my opinion, anyway) it may work out better to have the binary compiled with imlib2 support - last version of fluxbox I've seen with that was 1.0.0 if I recall correctly.

Have done it both ways with p431 - the all-xpm route is heavier (depending on how many conversions and if you use mostly unique icons rather than generic). Add to that some pngs just didn't convert well and looked a bit 'off' (at least with my clumsy butchering in mtpaint .. tried doing it the pnm way and there's still some gotchas, mostly with transparency and such). caplink(xpm-only)@141k

With imlib2 support, it's dead easy and everything looks right. caplink(mixed)@142k
Last edited by `f00 on Thu 11 Apr 2013, 21:29, edited 1 time in total.

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#5 Post by PaulR »

Thanks for that, I'm going to try recompiling Fluxbox (now at 1.3.5) with imlib2.

Paul

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#6 Post by seaside »

I thought it might be an interesting experiment to try converting the .jwmrc file to the Fluxbox menu file in an interpreted language and compare execution speed. Since Awk is really good with a single file, I started with that and soon got so bogged down in subroutines, that I did what I do best - switching to something else....

So, here it is as a bash script. It includes the menu separators and an icon for each category (which I'm not sure Fluxbox supports) as well as each program icon.

Anyway the speed comparison score was..
compiled jwmtoflux # real 0m14.110s
bash version # real 0m4.419s

And, if Technosaurus worked on it, he's probably cut the bash version time even more.. :D

Code: Select all

#!/bin/bash
# convert puppy linux .jwmrc to fluxbox menu style
# April 12, 2013 Seaside

while read LINE ; do

[[ "$LINE" == \</RootMenu* ]] && break

if [[ "$LINE" == *label=* || "$LINE" == \</Menu\> || "$LINE" == \<Separator* ]]; then
	name=${LINE#*label=\"} name=${name%\" icon*}
	icon=${LINE#*icon=\"} icon=${icon%%\"*}
	ex=${LINE#*>}  ex=${ex%%<*}

    [[ ! "$icon" == */* ]]  &&  icon=`find /usr -name "$icon"  -print -quit` 
 case $LINE in 
   \<Menu*) 
     flux="$flux
 [submenu] ("$name") <"$icon"> "
     ;;
     
   \<Program*) 
     flux="$flux
     [exec] ("$name") {"$ex"} <"$icon">"
     ;;
     
     \</Menu\>) 
      flux="$flux
 [end]"
 
      ;;
     \<Separator*) 
      flux="$flux
   [separator]" 
      ;;
      
 esac
 

fi

done </root/.jwmrc

echo "$flux" >fluxbox-pupmenu
Cheers,
s

PaulR
Posts: 249
Joined: Wed 04 May 2005, 18:45
Location: UK

#7 Post by PaulR »

Excellent seaside - smaller, faster, better. Result!

Paul

Post Reply