1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
#!/usr/bin/install-menu
#
# Generates AfterStep menus for all registered applications.
#
compat="menu-1"
!include menu.h
compat="menu-2"
outputencoding="ISO-8859-1";
# If file $idir/$file exists, then output "MiniPixmap" line...
function get_icon($idir, $ifile)=
ifnempty(
$ifile,
ifelse(
$idir,
ifempty(
parent($ifile),
iffile(
$idir "/" $ifile,
"MiniPixmap \"" $idir "/" $ifile "\"\n"
)
),
iffile(
$ifile,
"MiniPixmap \"" $ifile "\"\n"
)
)
);
function my_ifelse($x, $y)=
ifelse($x, $x, $y);
function add_pixmap_line()=
my_ifelse(
get_icon("", icon()),
my_ifelse(
get_icon("/usr/X11R6/include/X11/pixmaps", icon()),
my_ifelse(
get_icon("/usr/X11R6/include/X11/bitmaps", icon()),
"MiniPixmap \"mini-app.xpm\"\n"
)
)
);
#
# Main functions
#
function mod($var,$com)=$var " \""
ifelse($hotkey, escfirst(title(), $hotkey, "&"), title())
"\" exec " $com " &\n"
add_pixmap_line();
function restart($var,$com)=$var " \""
ifelse($hotkey, escfirst(title(), $hotkey, "&"), title())
"\" " $com "\n"
add_pixmap_line();
function ex($com)=mod("Exec",$com);
# We need menu >= 2.1.8-1 for $basesection
genmenu=ifelse( $command,
$basesection "/" tolower(replacewith(cppesc($title), "$", "-")) "_" entryindex(),
"/"
);
rootprefix="/var/lib/afterstep/menu";
onlyrunasroot=true;
treewalk=(M);
rootsection="/Debian";
preoutput="";
# Clean-up files we may have generated in an earlier run first.
prerun="test -e \"" prefix() "\" && find \"" prefix() "\" -type f -exec rm {} \\;";
# And remove any empty directories afterwards
postrun="find \"" prefix() "\" -depth -mindepth 2 -type d -print0 | xargs -0r rmdir --ignore-fail-on-non-empty";
removemenu = "test -d \"" prefix() "\" && ("
"find \"" prefix() "\" -type f -exec rm {} \\; ;"
"find \"" prefix() "\" -depth -type d -exec rmdir {} \\; )";
supported;
asmodule= mod("Module", $command);
fvwmmodule= mod("Exec", $command);
x11fvwm= ex($command);
wm= restart("Restart",$command);
x11= ex($command);
text= ex(term());
endsupported;
mainmenutitle="";
submenutitle= "";
startmenu="";
endmenu="";
|