4 # This script demonstates the fvwm menu MissingSubmenuFunction functionality.
5 # You can use a more configurable fvwm-menu-directory instead.
6 # The line below almost exactly simulates this script:
7 # fvwm-menu-directory --links --order 4 --exec-file vi --dir DIR
10 # Modification History
12 # Created on 06/07/99 by Dominik Vogt (domivogt):
14 # provides output to read in with PipeRead to build a menu
15 # containing a directory listing.
17 # You should put these lines into your fvwm configuration file to invoke
20 # AddToFunc MakeMissingDirectoryMenu
21 # + i piperead 'fvwm_make_directory_menu.sh '$0
23 # And put these lines in the menu from which you want to pop up the
26 # AddToMenu SomeMenu MissingSubmenuFunction MakeMissingDirectoryMenu
27 # + "my directory item" Popup /whatever/path/you/like
29 # Note: please use absolute path names.
32 # configuration section
35 # If you want to optimize for speed, unset this variable. Warning: speed
36 # optimization takes up a lot of memory that is never free'd again while fvwm
40 # you may use the absolute path here if you have an alias like ls="ls -F"
44 # the name of our menu
45 MENU
=`echo $1 | $SED -e 's://*:/:g'`
46 PMENU
=`echo "$MENU" | $SED -e s:\"::g`
48 # the command to execute on plain files
51 # the terminal program to invoke
56 # you may customize this script below here.
60 echo DestroyMenu recreate
\""$PMENU"\"
63 echo AddToMenu
\""$PMENU"\" \""$PMENU"\" Exec
"echo cd $MENU\; $TERMINALSHELL | $SHELL"
66 echo AddToMenu
\""$PMENU"\" \"\" nop
68 # destroy the menu after it is popped down
69 if [ "$OPTIMIZE_SPACE" = yes ] ; then
70 echo AddToMenu
\""$PMENU"\" DynamicPopDownAction DestroyMenu
\""$PMENU"\"
73 # set the 'missing submenu function'
74 echo AddToMenu
\""$PMENU"\" MissingSubmenuFunction MakeMissingDirectoryMenu
76 # add directory contents
77 $LS "$MENU" 2> /dev
/null |
$SED -n '
81 s:^\(.*\)$:AddToMenu "'"$PMENU"'" "\1" Exec '"$TERMINAL $ACTION"' "'"$MENU"'/\1":1
84 s:^\(.*\)/$:AddToMenu "'"$PMENU"'" "\1" Popup "'"$PMENU"'/\1" item +100 c:1