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'`
50 # the command to execute on plain files
53 # the terminal program to invoke
58 # you may customize this script below here.
62 echo DestroyMenu recreate
\"$MENU\"
65 echo AddToMenu
\"$MENU\" \"$MENU\" Exec
"echo cd $MENU\; $TERMINALSHELL | $SHELL"
68 echo AddToMenu
\"$MENU\" \"\" nop
70 # destroy the menu after it is popped down
71 if [ "$OPTIMIZE_SPACE" = yes ] ; then
72 echo AddToMenu
\"$MENU\" DynamicPopDownAction DestroyMenu
\"$MENU\"
75 # set the 'missing submenu function'
76 echo AddToMenu
\"$MENU\" MissingSubmenuFunction MakeMissingDirectoryMenu
78 # add directory contents
79 $LS "$MENU" 2> /dev
/null |
$SED -n '
82 s:^\(.*\)$:AddToMenu "'$MENU'" "\1" Exec '"$TERMINAL $ACTION"' "'"$MENU"'/\1":1
85 s:^\(.*\)/$:AddToMenu "'$MENU'" "\1" Popup "'"$MENU"'/\1" item +100 c:1