.
Aurium.Colivre.Coop.br Esse site é Legal Demais para Internet Explorer

Aurium :: ScriptShellMkicon

Últimas blogadas:

%HEADLINES{"http://softwarelivre.org/aurium/blog/feed" refresh="600" header="SoftwareLivre.org" limit="15" format=" * $title" }% %HEADLINES{"http://cirandas.net/aurium/blog/feed" refresh="600" header="Cirandas.net" limit="15" format=" * $title" }%



Intro

Português English
Esse script facilita a criação de icones no desktop (GNOME ou KDE) do usuário, dentro do padrão definido pelo FreeDesktop.org. This script helps the creation of icons in the desktop (GNOME ou KDE) of the user, using the standard defined by the FreeDesktop.org.
Criei apenas para dar uma contribuição ao projeto IEs 4 Linux, mas vi que poderia generalizar facilmente, então, aí está. I was created only to contrib to the IEs 4 Linux project, but i see that i could generalize easily, so, is that.
Veja a Especificação do arquivo de "desktop entry" do FreeDesktop.org. See the File "desktop entry" specification on the FreeDesktop.org.

The Code


file mkicon:
#!/bin/bash

# Copyright 2005 Aurelio A. Heckert <aurium@gmail.com>
# This is a free (as in freedom) software under the GNU-GPL licence
# See hire for details: http://www.gnu.org/copyleft/gpl.html
#
# This simple script is an help to create icons for the GNOME
# and KDE desktops using the specification of the desktop entry
# by the FreeDesktop group. Details on this web page:
# standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

[ "$#" = "0" ] && echo 'ERROR: mkicon need arguments' >&2

if [ "$#" = "0" -o "$1" = "--help" -o "$1" = "-h" ]; then
  echo '
To create an icon file for GNOME and KDE you must give pairs of attribute and
value, and that must be the same as defined in the desktop entry specification:
standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

The value must be inside of quotations to be only one argument to the script.

Example. Creating a icon to open an irc channel in the X-Chat:
$ mkicon \
Exec "xchat irc://irc.freenode.org/debian-br" \
Icon "/usr/share/icons/hicolor/48x48/apps/xchat.png" \
Name "#Debian-BR Channel" \
GenericName "IRC Channel" \
Comment "Brasilian Debian user channel" > channel-dbr.desktop

The file uses some other arguments but the needed is added with the default
values.
'
  if [ "$#" = "0" ]; then
    exit 1
  else
    exit 0
  fi
fi

echo '[Desktop Entry]
Version=1.0'

isAtt=1
for arg in "$@"; do
  if [ "$isAtt" = "1" ]; then
    isAtt=0
    echo -n "$arg="
    case $arg in
      Encoding)  EncodingOK=1 ;;
      Terminal)  TerminalOK=1 ;;
      Type)      TypeOK=1 ;;
      Exec)      ExecOK=1 ;;
      Name)      NameOK=1 ;;
    esac
  else
    isAtt=1
    echo "$arg"
  fi
done

# necessary arguments default values:
[ "$EncodingOK" != "1" ]  &&  echo 'Encoding=UTF-8'
[ "$TerminalOK" != "1" ]  &&  echo 'Terminal=false'
[ "$TypeOK"     != "1" ]  &&  echo 'Type=Application'
[ "$ExecOK"     != "1" ]  &&  echo 'Exec=echo "noting to do"'
[ "$NameOK"     != "1" ]  &&  echo 'Name=No Name'


Bonus!

Good Pratic Example

cd   # para entrar no home do usuário
if cd Desktop || cd desktop; then   # para entrar no diretório do desktop
  # Somente se existir um diretório de desktop, crie o icone neste
  mkicon \
  Exec "xchat irc://irc.freenode.org/debian-br" \
  Icon "/usr/share/icons/hicolor/48x48/apps/xchat.png" \
  Name "#Debian-BR Channel" \
  GenericName "IRC Channel" \
  Comment "Brasilian Debian user channel" > channel-dbr.desktop
fi

An SVG Icon

%Formata_Centro%
Get the SVG File
%Fim_Formata%

DiggThis

Topic attachments
I Attachment Action Size DateSorted ascending Who Comment
ie_wine.svgsvg ie_wine.svg manage 41 K 22 Oct 2005 - 03:58 AurelioAHeckert IEs 4 Linux Icon
Copyright © 2004 - 2019 Aurélio A. Heckert
Conteúdo licenciado sob Creative Commons by-nc-sa