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 01 Oct 2014, 20:34
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
JWM to Fluxbox menu export
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
PaulR

Joined: 04 May 2005
Posts: 245
Location: UK

PostPosted: Mon 08 Apr 2013, 02:58    Post_subject:  JWM to Fluxbox menu export  

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.
fwmtoflux-menus.jpg
 Description   
 Filesize   29.06 KB
 Viewed   2939 Time(s)

fwmtoflux-menus.jpg

jwmtoflux.tar.gz
Description 
gz

 Download 
Filename  jwmtoflux.tar.gz 
Filesize  15.76 KB 
Downloaded  271 Time(s) 
Back to top
View user's profile Send_private_message 
darkcity


Joined: 23 May 2010
Posts: 2455
Location: near here

PostPosted: Tue 09 Apr 2013, 13:40    Post_subject:  

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

_________________
helping Wiki for help | IF SendSpace link = "dead" THEN PM me ("up file to http://meownplanet.net/")
Back to top
View user's profile Send_private_message Visit_website 
PaulR

Joined: 04 May 2005
Posts: 245
Location: UK

PostPosted: Wed 10 Apr 2013, 16:53    Post_subject:  

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. Very Happy

Paul

Thanks to forum members seaside, scsijon, sunburnt & vovchik for thier help.
menuicons.jpg
 Description   
 Filesize   70.52 KB
 Viewed   692 Time(s)

menuicons.jpg

jwmtoflux.tar.gz
Description 
gz

 Download 
Filename  jwmtoflux.tar.gz 
Filesize  17.87 KB 
Downloaded  240 Time(s) 
Back to top
View user's profile Send_private_message 
`f00


Joined: 06 Nov 2008
Posts: 809
Location: the Western Reserve

PostPosted: Wed 10 Apr 2013, 21:32    Post_subject:
Sub_title: illustrated menu
 

Good work, PaulR & friends Smile

||| 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

Edited_time_total
Back to top
View user's profile Send_private_message 
PaulR

Joined: 04 May 2005
Posts: 245
Location: UK

PostPosted: Thu 11 Apr 2013, 09:38    Post_subject:  

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

Paul
Back to top
View user's profile Send_private_message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Fri 12 Apr 2013, 20:40    Post_subject:  

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.. Very Happy

Code:

#!/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
Back to top
View user's profile Send_private_message 
PaulR

Joined: 04 May 2005
Posts: 245
Location: UK

PostPosted: Sat 13 Apr 2013, 11:04    Post_subject:  

Excellent seaside - smaller, faster, better. Result!

Paul
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
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.0603s ][ Queries: 12 (0.0043s) ][ GZIP on ]