4 # This script demonstrates the fvwm menu DynamicPopupAction 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 --reuse --links --order 4 --name <menu name> \
8 # --exec-file vi --exec-title - --special-dirs
11 # Modification History
13 # Created on 05/06/99 by Dominik Vogt (domivogt):
15 # provides output to read in with PipeRead to build a menu
16 # containing a directory listing.
18 # You should put these lines into your fvwm configuration file to invoke
21 # AddToMenu <menu name>
22 # + DynamicPopupAction Piperead 'fvwm_make_browse_menu.sh <menu name>'
25 # configuration section
28 # the file containing the desired directory name
29 DIRFILE
="$HOME/.fvwm_browse_menu_cwd"
31 # you may use the absolute path here if you have an alias like ls="ls -F"
35 # the name of our menu
36 MENU
=`echo "$1" | $SED -e s:\"::g`
38 # the command to execute on plain files
41 # the terminal program to invoke
45 # you may customize this script below here.
48 # create a file containing the current working directory
49 if [ ! -f "$DIRFILE" ] ; then
50 echo "$HOME" > "$DIRFILE"
53 # get desired directory
54 DIR
="`cat "$DIRFILE"`"
55 if [ ! -d "$DIR" ] ; then
60 echo DestroyMenu recreate
\""$MENU"\"
63 echo AddToMenu
\""$MENU"\" \"`cat "$DIRFILE"`\" Title
67 echo AddToMenu
\""$MENU"\" \"..
\" PipeRead
\'echo \""`/bin/pwd`"\" \
> "$DIRFILE" ';' echo Menu
\\\""$MENU"\\\" WarpTitle
\'
70 echo AddToMenu
\""$MENU"\" \"\" Nop
73 echo AddToMenu
\""$MENU"\" \"~
\" PipeRead
\'echo \""$HOME"\" \
> "$DIRFILE" ';' echo Menu
\\\""$MENU"\\\" WarpTitle
\'
76 echo AddToMenu
\""$MENU"\" \"\" Nop
78 # add directory contents
79 for i
in `"$LS" "$DIR"` ; do
80 if [ -d "$DIR/$i" ] ; then
83 # put new path in $DIRFILE and invoke the menu again
84 echo AddToMenu
\""$MENU"\" \""$i/"\" PipeRead
\'echo \"`echo $DIR/$i|$SED -e s://:/:g`\" \
> "$DIRFILE" ';' echo Menu
\\\""$MENU"\\\" WarpTitle
\'
86 # something else, apply $ACTION to it
87 echo AddToMenu
\""$MENU"\" \""$i"\" Exec
$TERMINAL $ACTION \""$DIR/$i"\"