Window Mangers :: Convert fluxbox menu file to icewm



I recently became a happy convert to DSL; it made my ancient Thinkpad (233 MHz CPU and 96 MB RAM) seem like a new machine.

Anyway, I did a hard disk install and switched to icewm, which I prefer to fluxbox and which is still pretty lightweight.  I came across a script by TyphoonMentat in the deprecated extensions forum to convert fluxbox menu files to icewm, but it was a little buggy.  Here is a rewrite.  Use it like this:

Code Sample

mv .icewm/menu .icewm/menu.old
./convertmenu.pl .fluxbox/menu >.icewm/menu


Code Sample

#!/usr/bin/perl -w
# Script to convert fluxbox menu to icewm
my @stack;
my ($type, $label, $arg);

my $line = 0;
while (<>) {
  $line++;
  next if (/\s*#/);
  if (/\[(.+)\]\s*\((.+)\)\s*\{(.+)\}/) {
     $type = $1;
     $label = $2;
     $arg = $3;
  } elsif (/\[(.+)\]\s*\((.+)\)/) {
     $type = $1;
     $label = $2;
     $arg = "";
  } elsif (/\[(.+)\]/) {
     $type = $1;
     $label = "";
     $arg = "";
  } else {
     next;
  }
  if ($type eq "submenu") {
     if ($label eq "Styles") {
        push(@stack, "");
     } else {
        print("menu \"$label\" folder\ {\n");
        push(@stack, "}\n");
     }
  } elsif ($type eq "end") {
     if ($#stack >= 0) {
        print(pop(@stack));
     } else {
        print("# mismatched [end] at line $line!\n");
     }
  } elsif ($type eq "exec") {
     print("prog \"$label\" \"-\" $arg\n");
  } elsif ($type eq "begin") {
     push(@stack, "");
  }
}

I may be doing something pretty stupid here...

So i tried to follow these instructions. I entered the first line

Code Sample
mv .icewm/menu .icewm/menu.old

and got this response
Code Sample
mv: unable to rename '.icewm/menu': No such file or directory


I then had a look around and found that ice wm was in /etc/x11. So I tried
Quote
mv etc/x11/icewm/menu etc/x11/icewm/menu.old


and that didn't work either. I messeda roud a bit with '.' and '/' in case leaving them out was the problem but that did't get me anywhere.

I know that I'm probably making some really basic silly mistake thru ignorance but I'd appriciate help from anyone who can offer it.

Quote (Guest @ Nov. 19 2005,14:52)
I may be doing something pretty stupid here...

So i tried to follow these instructions. I entered the first line

Code Sample
mv .icewm/menu .icewm/menu.old

and got this response
Code Sample
mv: unable to rename '.icewm/menu': No such file or directory


I then had a look around and found that ice wm was in /etc/x11. So I tried
Quote
mv etc/x11/icewm/menu etc/x11/icewm/menu.old


and that didn't work either. I messeda roud a bit with '.' and '/' in case leaving them out was the problem but that did't get me anywhere.

I know that I'm probably making some really basic silly mistake thru ignorance but I'd appriciate help from anyone who can offer it.

Yeah. Uh... you're trying to back up something which you haven't created yet, which is absolutely pointless.
well i knew it was probably something pretty stupid!  :)

But I still don't know what i should actually do...

Wel, since you haven't installed the icewm directory yet:
Code Sample

cp -R /etc/x11/icewm/ ~/.icewm
./convertmenu.pl ~/.fluxbox/menu >~/.icewm/menu


All there is to it; the only reason
Code Sample

mv .icewm/menu .icewm/menu.old

was in there was to keep people from overwriting a customized icewm menu.

Next Page...
original here.