[Pkg-ROX-devel] /etc/menu-methods/rox-filer

Dennis Tomas 2tomas@informatik.uni-hamburg.de
Thu, 24 Mar 2005 11:17:30 +0100


This is a multi-part message in MIME format.
--------------030902090803020604020700
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I've made some additions to the script /etc/menu-methods/rox-filer:

1) If there is no icon for an application, or if the file $icon doesn't 
exist, the script will look for /usr/share/*$package.png or 
/usr/share/*$package.xpm and use it as icon.
2) .DirIcon is used for directory icon instead of the deprecated AppIcon.xpm
3) the Help - directory is a link to /usr/share/doc/$package
4) AppInfo.xml is created, containing tooltip $longtitle. If no 
longtitle exist, apt-cache show $package is used (grep'ing the line with 
"Description:")

An issue with 4 is that if there is more than one application in one 
.deb - package and no longtitles exist for them, the tooltip shows the 
description for the whole package, rather than for the application.
And there is a problem with special characters in AppInfo.xml. If there 
are any, the tooltip won't be shown due to incorrect-UTF-8-encoding.

I hope you can make any use of the script. It at least would be great to 
hear what you think of it.



Dennis Tomas


--------------030902090803020604020700
Content-Type: text/plain;
 name="rox-filer"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="rox-filer"

#!/usr/sbin/install-menu
#   -*- mode: shell-script; -*-
#
# Written by Jan Wagemakers, Dennis Tomas
# Thanks to Thomas Leonard for advice about "$@" and symlink /usr/share/doc
#
compat="menu-1"
!include menu.h
genmenu="roxmenu"
rootprefix="/etc/"
onlyrunasroot=true
outputencoding="LOCALE"


# Some text to go at the top of the autogenerated file.
preoutput="#!/bin/sh \n# ROX menu \n\n"

# In what order we output the menus.
treewalk="c(m)"

# How to start a new menu in the rc file.
startmenu="\n"

supported
x11= "mkdir -p \"/usr/share/apps"$section"\"\n" \
     "echo \"#!/bin/sh\" > \"/usr/share/apps"$section"/AppRun\"\n" \
     "echo \"# Generated by /etc/menu-methods/rox : do not edit \"" \
     " >> \"/usr/share/apps"$section"/AppRun\"\n" \
     "echo \""$command" \\\"\\\$@\\\" &\" >> \"/usr/share/apps"$section"/AppRun\"\n" \
     "chmod 755 \"/usr/share/apps"$section"/AppRun\"\n" \
     "icon=\""$icon"\"\n" \
     "if [ ! -e \"$icon\" -o -z \"$icon\" ]; then\n" \
     "icon=`locate \"/usr/share/*"$package".png\" | grep -n \""$package"\" | grep ^1: | cut -d: -f2`\n" \
     "fi\n" \
     "if [ ! -e \"$icon\" -o -z \"$icon\" ]; then\n" \
     "icon=`locate \"/usr/share/*"$package".xpm\" | grep -n \""$package"\" | grep ^1: | cut -d: -f2`\n" \
     "fi\n" \
     "if test -n \"$icon\"\n" \
     "then \n" \
     "cp \"$icon\" \"/usr/share/apps"$section"/.DirIcon\"\n" \
     "fi \n\n" \
     "echo \'<?xml version=\"1.0\"\?>\' > \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \'<AppInfo>\' >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "longtitle=\""$longtitle"\"\n" \
     "if [ -z \"$longtitle\" ]; then \n" \
     "longtitle=\"`apt-cache show "$package" | grep Description: | grep -n Description: | grep ^1: | cut -d: -f3 | cut -c 2-` \"\n" \ 
     "fi \n" \
     "echo \"  <Summary>$longtitle</Summary>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"  <About>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"    <Version>`apt-cache show "$package" | grep Version: | grep -n Version: | grep ^1: | cut -d: -f3 | cut -c 2-`</Version>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"  </About>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \'</AppInfo>\' >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "ln -s \"/usr/share/doc/"$package"\" \"/usr/share/apps"$section"/Help\"\n"
endsupported

endmenu= "\n"

# Command to run at end.
postrun="mkdir -p /usr/share/apps/Debian ; rm -r /usr/share/apps/Debian ; " \
        ". /etc/roxmenu ; rm /etc/roxmenu"
	



--------------030902090803020604020700--