# $Id$ # xdg-utils # for a complete list of known categories see: # http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry # # AudioVideo Audio Video Development Education # Game Graphics Network Office Settings System # Utility Building Debugger IDE GUIDesigner # Profiling RevisionControl Translation Calendar # ContactManagement Database Dictionary Chart # Email Finance FlowChart PDA ProjectManagement # Presentation Spreadsheet WordProcessor 2DGraphics # VectorGraphics RasterGraphics 3DGraphics Scanning # OCR Photography Viewer DesktopSettings HardwareSettings # PackageManager Dialup InstantMessaging IRCClient # FileTransfer HamRadio News P2P RemoteAccess Telephony # WebBrowser WebDevelopment Midi Mixer Sequencer Tuner # TV AudioVideoEditing Player Recorder DiscBurning # ActionGame AdventureGame ArcadeGame BoardGame # BlocksGame CardGame KidsGame LogicGame RolePlaying # Simulation SportsGame StrategyGame Art Construction # Music Languages Science Astronomy Biology Chemistry # Geology Math MedicalSoftware Physics Amusement # Archiving Electronics Emulator Engineering # FileManager TerminalEmulator Filesystem Monitor # Security Accessibility Calculator Clock TextEditor # Core KDE GNOME GTK Qt Motif Java ConsoleOnly Screensaver # TrayIcon Applet Shell sminclude mtools INHERITS="${INHERITS} xdg" # required for xdg-icon-resource in xdg.minc to update pixmaps DEPEND="${DEPEND} >= x11-apps/xdg-utils-1.1" # desktop-file-utils are needed SDEPEND="${SDEPEND} >= dev-util/desktop-file-utils-0.1" # installs a desktop icon minstall_desktop_icon() { local i local name local file local comment local exec local icon local terminal local notify local categories local vendor local all_categories local mimetypes local all_mimetypes for i in $* do case $1 in --name|-n) shift; name="$1" ;; --file|-f) shift; file="$1.desktop" ;; --comment|-m) shift; comment="$1" ;; --exec|-e) shift; exec="$1" ;; --icon|-i) shift; icon="$1" ;; --terminal|-t) terminal="true" ;; --no-notify|-y) notify="false" ;; --categories|-c) shift; categories="$1" ;; --vendor|-v) shift; vendor="$1" ;; --mimetypes|-x) shift; mimetypes="$1" ;; --source|-s) shift; source="$1" ;; esac shift done # sanity checks; abort if not given #[[ -z ${name} ]] && die "minstall_desktop_icon() \$name not given." # some sane defaults [[ -z ${name} ]] && name="${PNAME}" [[ -z ${file} ]] && file="${name}.desktop" [[ -z ${exec} ]] && exec="${name}" [[ -z ${icon} ]] && icon="${name}.png" [[ -z ${terminal} ]] && terminal="false" [[ -z ${notify} ]] && notify="true" [[ -z ${vendor} ]] && vendor="X-Magellan" # get all categories if [[ -n ${categories} ]] then for i in $(echo ${categories} | sed "s:,:\ :g") do all_categories="${all_categories} --add-category ${i}" done fi # get all mimetypes if [[ -n ${mimetypes} ]] then for i in $(echo ${mimetypes} | sed "s:,:\ :g") do all_mimetypes="${all_mimetypes} --add-mime-type ${i}" done fi echo "[Desktop Entry] Encoding=UTF-8 Name=${name} Comment=${comment} Exec=${exec} Icon=${icon} Terminal=${terminal} StartupNotify=${notify} Type=Application" > ${SRCDIR}/${file} desktop-file-install \ --vendor ${vendor} \ --delete-original \ --dir ${BINDIR}/usr/share/applications \ --add-category X-Magellan-Application \ ${all_categories} \ ${all_mimetyes} \ ${SRCDIR}/${file} \ || die } # installs already created desktop icons to application dir # minstallxdg {-s} srcname destname {/path/to} minstallxdg() { local i local file local destdir local destfile local prefix local modify="0" local comment local exec local icon local terminal local notify local categories local vendor local all_categories local mimetypes local cmdline local name for i in $* do case $1 in --srcdir|-s) prefix="${SOURCEDIR}/${PNAME}/" ;; --name|-n) shift; name="$1"; modify="1" ;; --comment|-m) shift; comment="$1"; modify="1" ;; --exec|-e) shift; exec="$1"; modify="1" ;; --icon|-i) shift; icon="$1"; modify="1" ;; --terminal|-t) terminal="true"; modify="1" ;; --no-notify|-y) notify="false"; modify="1" ;; --categories|-c) shift; categories="$1"; modify="1" ;; --vendor|-v) shift; vendor="$1"; modify="1" ;; --mimetypes|-x) shift; mimetypes="$1"; modify="1" ;; --file|-f) shift; file="$1" ;; --destination-file|-df) shift; destfile="$1" ;; --destination-dir|-d) shift; destdir="$1" ;; esac shift done [[ ! -z ${prefix} ]] && file="${prefix}${file}" [[ -z ${destfile} ]] && destfile="$(basename ${file})" [[ -z ${destdir} ]] && destdir="/usr/share/applications" [[ -z ${file} ]] && die "No xdg desktop file given" # needed directory minstalldir ${destdir} || die if [[ ${modify} = 1 ]] then [[ ! -z ${name} ]] && cmdline+=" --set-name=\"${name}\"" [[ ! -z ${comment} ]] && cmdline+=" --set-comment=\"${comment}\"" [[ ! -z ${exec} ]] && cmdline+=" --set-key=Exec --set-value=\"${exec}\"" [[ ! -z ${icon} ]] && cmdline+=" --set-icon=\"${icon}\"" [[ ! -z ${terminal} ]] && cmdline+=" --set-key=Terminal --set-value=false" [[ ! -z ${notify} ]] && cmdline+=" --set-key=StartupNotify --set-value=false" [[ ! -z ${vendor} ]] && cmdline+=" --vendor \"${vendor}\"" if [[ ! -z ${categories} ]] then # get all categories for i in $(echo ${categories} | sed "s:,:\ :g") do cmdline+=" --add-category ${i}" done fi # get all mimetypes if [[ ! -z ${mimetypes} ]] then for i in $(echo ${mimetypes} | sed "s:,:\ :g") do cmdline+=" --add-mime-type ${i}" done fi eval desktop-file-install \ --dir ${BINDIR}/${destdir} \ --add-category X-Magellan-Application \ ${cmdline} \ ${file} \ || die else # install our xdg minstallfile ${file} ${destdir}/${destfile} || die fi }