diff --git a/package/daniel/icewm/icewm.conf b/package/daniel/icewm/icewm.conf index 82cc4bf07..5c676da79 100644 --- a/package/daniel/icewm/icewm.conf +++ b/package/daniel/icewm/icewm.conf @@ -24,6 +24,8 @@ confopt="$confopt --with-imlib --with-cfgdir=$root/etc/X11/icewm" hook_add postmake 3 "mkdir -p $root/etc/X11/icewm ; cp -f lib/programs \ $datadir/$pkg" hook_add postinstall 3 "register_wm icewm-session IceWM /$prefix/bin/icewm" +hook_add postinstall 4 "install -m 755 -o root -g root ${confdir}/rock-menu /usr/share/icewm/" +hook_add postinstall 5 "echo 'menufile ROCK folder /usr/share/icewm/ROCK' >> /usr/share/icewm/menu" # Force same compiler version for C and C++ export CC="${CXX/[cg]++/gcc}" diff --git a/package/daniel/icewm/rock-menu b/package/daniel/icewm/rock-menu new file mode 100644 index 000000000..066b25a27 --- /dev/null +++ b/package/daniel/icewm/rock-menu @@ -0,0 +1,95 @@ +#!/bin/bash + +dir=`mktemp` +rm -rf ${dir} +mkdir -p ${dir} + +tmpfile=`mktemp` +rm -rf ${tmpfile} + +style="freedesktop" +[ "$1" == "--rock" -o -e /usr/share/icewm/rockstyle ] && style="rock" + +process_desktop(){ + file=${1} + + . ${file} + [ -z "${Exec}" ] && return + + if [ "${style}" == "freedesktop" ] ; then + Categories=${Categories//;//} + Categories=${Categories%/} + elif [ "${style}" == "rock" ] ; then + Categories="`grep '\[C\]' /var/adm/descs/${X_ROCK_Name} | head -n 1 | cut -f2 -d' '`" + fi + mkdir -p "${dir}/${Categories}" + if [ "${Terminal}" == "true" -o "${Terminal}" == "1" ] ; then + Exec="xterm -e '${Exec}'" + fi + echo "prog \"${Name}\" \"${Icon:-${Name}}\" ${Exec}" > "${dir}/${Categories}/${Name}" + unset Exec Name Icon Terminal Categories X_ROCK_Name +} + +for x in /usr/share/applications/*desktop ; do + [ ! -e ${x} ] && continue + entry=0 + + while read line ; do + [ -z "${line}" -o "${line:0:1}" == "#" ] && continue + + if [ "${line:0:1}" == "[" ] ; then + entry=$(( ${entry} + 1 )) + if [ ${entry} -gt 1 ] ; then # this is to support multiple entries in one file + [ -f ${tmpfile} ] && process_desktop ${tmpfile} + rm -f ${tmpfile} + fi + else + [ "${line:0:5}" == "Exec=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' >>${tmpfile} + [ "${line:0:5}" == "Name=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' >>${tmpfile} + [ "${line:0:5}" == "Icon=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' >>${tmpfile} + [ "${line:0:9}" == "Terminal=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' >>${tmpfile} + [ "${line:0:11}" == "Categories=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' >>${tmpfile} + [ "${line:0:12}" == "X-ROCK-Name=" ] && echo "${line}" | sed -e 's,=\(.*\)$,="\1",g' -e 's,^.*=,X_ROCK_Name=,g' >>${tmpfile} + fi + done < ${x} + [ -f ${tmpfile} ] && process_desktop ${tmpfile} + rm -f ${tmpfile} +done + +scan_file() { + for n in 1 `seq 1 1 ${2} 2>/dev/null` ; do + echo -en "\t" + done + cat "${1}" +} + +scan_dir() { + for n in `seq 1 1 ${2} 2>/dev/null` ; do + echo -en "\t" + done + echo "menu \"${1##*/}\" folder {" + + for x in "${1}"/* ; do + if [ -d "${x}" ] ; then + scan_dir "${x}" $(( ${2} + 1 )) + elif [ -f "${x}" ] ; then + scan_file "${x}" ${2} + fi + done + for n in `seq 1 1 ${2} 2>/dev/null` ; do + echo -en "\t" + done + echo "}" +} + +rm -f /usr/share/icewm/ROCK + +for x in ${dir}/* ; do + if [ -d "${x}" ] ; then + scan_dir "${x}" 0 + elif [ -f "${x}" ] ; then + scan_file "${x}" 0 + fi +done >/usr/share/icewm/ROCK + +rm -rf ${tmpfile} ${dir} diff --git a/scripts/functions b/scripts/functions index 9396c22d3..adfbe7c2f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -726,10 +726,10 @@ build_this_package() { echo -n "Install desktop file '$file': " - mkdir -p $root/usr/share/rock-registry/app + mkdir -p $root/usr/share/applications rock_substitute $file > \ - $root/usr/share/rock-registry/app/`basename $file` + $root/usr/share/applications/`basename $file` done if [ "$createdocs" = 1 ]; then