mikshaw


Group: Members
Posts: 4856
Joined: July 2004 |
 |
Posted: Dec. 17 2004,14:20 |
 |
Update on the icons script, It now will correctly grab the name of a terminal application. I haven't gotten "sudo" applications right yet. There could be a menu command similiar to "xterm -e sudo <command>", or it could be "sudo [su -c] xterm -e <command>", so I haven't figured out how to guess which is being used in order to grab <command>.
Code Sample | #!/bin/bash inpoot="${HOME}/.fluxbox/menu" outpoot="${HOME}/.fluxbox/icon_menu" icon_dir="${HOME}/.fluxbox/icons"
if [ -f "${outpoot}" ]; then mv -f "${outpoot}" "${outpoot}.bak" fi cat "${inpoot}" | while read line; do full_command=`echo "${line}"|awk -F { '{print $2}'|awk -F } '{print $1}'` case "${full_command}" in [aEx]term*-e*|rxvt*-e*|konsole*-e*|gnome-terminal*-e*) command_name=`echo "${full_command}"|awk -F '-e' '{print $2}'|awk '{print $1}'|awk -F / '{print $NF}'` ;; *) command_name=`echo "${full_command}"|awk '{print $1}'|awk -F / '{print $NF}'` ;; esac
icon_name="${icon_dir}/${command_name}.xpm" if [ -f "${icon_name}" ]; then echo "${line} <${icon_name}>" >> ${outpoot} else echo "${line}" >> ${outpoot} fi done
|
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|