It doesn’t say anything about this in manual. Is there a length limit for PipeRead’s '“command”?
No more so than what the underlying shell accepts as input. Which is either /bin/sh or whatever you’ve set ExecUseShell to. Note that if you have to ask this, you’re doing it wrong and you should write a script as a separate program.
– Thomas Adam
I’ll always test the script in a shell file or a terminal. Then I put it in a PipeRead command, and if it doesn’t work I test it with Echo.
Echo "Do Not Worry, This Is Just A Test Line 1;\
Do Not Worry, This Is Just A Test Line 2;\
...
Do Not Worry, This Is Just A Test Line 30"
It stops at line 25, then:
[fvwm][__execute_function]: <<ERROR>> No such command 's'
[fvwm][__execute_function]: <<ERROR>> No such command 'Do'
Then your original question doesn’t accurately relfect what you’re trying to do. Please provide an actual example of something using PipeRead and stop pasting snippets.
– Thomas Adam
DestroyMenu FvwmProgramsMenu
AddToMenu FvwmProgramsMenu "Programs%$[fvwm_icons]/places/programs.png%"
PipeRead 'app_categories=(Network AudioVideo Office Graphics Game Education Development System Settings Utility);\
menu_categories=(Internet Multimedia Office Graphics Games Education Development System Settings Utilities);\
for i in {0..9}; do\
categories_icons[i]=$(echo ${menu_categories[i]} | tr A-Z a-z);\
done;\
echo + \\"\\" Nop;\
[[ $(grep "Categories=.*${app_categories[0]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[0]}%$fvwm_icons/places/${categories_icons[0]}.png%\\" Popup InternetAppsMenu;\
[[ $(grep "Categories=.*${app_categories[1]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[1]}%$fvwm_icons/places/${categories_icons[1]}.png%\\" Popup MultimediaAppsMenu;\
[[ $(grep "Categories=.*${app_categories[2]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[2]}%$fvwm_icons/places/${categories_icons[2]}.png%\\" Popup OfficeAppsMenu;\
[[ $(grep "Categories=.*${app_categories[3]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[3]}%$fvwm_icons/places/${categories_icons[3]}.png%\\" Popup GraphicsAppsMenu;\
[[ $(grep "Categories=.*${app_categories[4]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[4]}%$fvwm_icons/places/${categories_icons[4]}.png%\\" Popup GamesAppsMenu;\
[[ $(grep "Categories=.*${app_categories[5]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[5]}%$fvwm_icons/places/${categories_icons[5]}.png%\\" Popup EducationAppsMenu;\
[[ $(grep "Categories=.*${app_categories[6]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[6]}%$fvwm_icons/places/${categories_icons[6]}.png%\\" Popup DevelopmentAppsMenu;\
[[ $(grep "Categories=.*${app_categories[7]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[7]}%$fvwm_icons/places/${categories_icons[7]}.png%\\" Popup SystemAppsMenu;\
[[ $(grep "Categories=.*${app_categories[8]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[8]}%$fvwm_icons/places/${categories_icons[8]}.png%\\" Popup SettingsAppsMenu;\
[[ $(grep "Categories=.*${app_categories[9]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \\"${menu_categories[9]}%$fvwm_icons/places/${categories_icons[9]}.png%\\" Popup UtilitiesAppsMenu'
OK, I can put all this in a for loop, but the script is longer.
Works for the first three categories, then “<> No such command”.
Yes – you’re failing.
– Thomas Adam
Here is little something for you, from Russia with love: pastebin.com/ktGaAcgw
I’m not the author, but I use this handy little thingie.
It depends on gnome-menus, but I mostly use gnome/gtk soft, so…
The only trouble is 'Sound & video" item handling. )
The author says it can be used as a pipe menu script, but as I do not install new application every week, I just run it once redirecting the output to a configuration file.
//In archlinux python stands for python3, so if your disto ships python 2 by default, change the interpreter call.
How about we don’t do this, with the overhead of python, and fix the shellscript – the solution of which is immediately obvious when you run it as a shell-script.
– Thomas Adam
How about we get things done and go watch movies or play nexuiz?
I’ve made my own programs menu generator script, using desktop entries from /usr/share/applications:
appsmenu="/home/.fvwm/files/appsmenu"
cat /dev/null > $appsmenu
app_categories=(Network AudioVideo Office Graphics Game Education Development System Settings Utility)
menu_categories=(Internet Multimedia Office Graphics Games Education Development System Settings Utilities)
for catID in {0..9}; do
categories_icons[catID]=$(echo ${menu_categories[catID]} | tr A-Z a-z)
done
echo + \"\" Nop >> $appsmenu
for catID in {0..9}; do
[[ $(grep "Categories=.*${app_categories[catID]}.*" $(find $fvwm_apps_path/*)) != "" ]] && echo + \"${menu_categories[catID]}%$fvwm_icons/places/${categories_icons[catID]}.png%\" Popup ${menu_categories[catID]}AppsMenu >> $appsmenu
done
echo >> $appsmenu
for catID in {0..9}; do
echo DestroyMenu ${menu_categories[catID]}AppsMenu >> $appsmenu
echo AddtoMenu ${menu_categories[catID]}AppsMenu \"${menu_categories[catID]}%$fvwm_icons/places/${categories_icons[catID]}.png%\" >> $appsmenu
echo "+ \"\" Nop" >> $appsmenu
for i in $(find $fvwm_apps_path/*); do
if [[ $(grep "Categories=.*${app_categories[catID]}.*" $i) != "" ]]; then
app_name=$(grep "^Name=.*" $i | sed -e "s/Name=//" -e "s/[0-9]\+\(\.\| \|$\)//g" | cut -d " " -f 1-2)
app_icon=$(grep "^Icon=.*" $i | sed -e "s/Icon=//" -e "s/.*\///")
if [[ $(echo $app_icon | grep -o "\.") == "." ]]; then
app_icon_name=$(echo $app_icon | sed -e "s/\..*$//")
app_icon_ext=$(echo $app_icon | sed -e "s/.*\.//")
else
app_icon_name=$app_icon
app_icon_ext=png
fi
if [[ $(ls -t $fvwm_apps_icons/*/32x32/*/$app_icon_name.png > /dev/null 2>&1 && echo true) == "true" ]]; then
app_icon_path=$(ls -t $fvwm_apps_icons/*/32x32/*/$app_icon_name.png | head -1)
else
if [[ $(ls $fvwm_apps_pixmaps/$app_icon_name.$app_icon_ext > /dev/null 2>&1 && echo true) == "true" ]]; then
convert -resize 32x32 $fvwm_apps_pixmaps/$app_icon_name.$app_icon_ext $fvwm_temp/$app_icon_name.png
app_icon_path=$fvwm_temp/$app_icon_name.png
else
app_icon_path=$fvwm_icons/apps/32x32/program.png
fi
fi
app_exec=$(grep "^Exec=.*" $i | sed -e "s/Exec=//" -e "s/\"//g" -e "s/\'//g" -e "s/ -caption//g" | cut -d "%" -f 1)
[[ $(grep "^NoDisplay=.*" $i | sed -e "s/NoDisplay=//") != "true" && $(grep "^Terminal=.*" $i | sed -e "s/Terminal=//") != "true" && $(grep "^OnlyShowIn" $i) == "" ]] && echo + \"$app_name%$app_icon_path%\" Exec exec $app_exec >> $appsmenu
fi
done
echo >> $appsmenu
done
Where:
fvwm_apps_path=/usr/share/applications
fvwm_apps_icons=/usr/share/icons
fvwm_apps_pixmaps=/usr/share/pixmaps
So, because I’m failing at putting it in a PipeRead command, I’ll use it as a shell script file.