[Pkg-kde-talk] Icons in .menu files

Adeodato Simó asp16@alu.ua.es
Tue, 8 Mar 2005 15:15:23 +0100


Hello all,

  I've been working this morning in providing icons for .menu files,
  which is a thing both Daniel and Ben considered nice to have. (I've
  been doing it for the following modules: kdeaccessibility kdeadmin
  kdebase kdegraphics kdemultimedia kdenetwork kdeutils.)

  There are severals steps involved:

    (a) adding the icon (or icon32x32, or icon16x16) entries to the
        .menu files, e.g. in kpdf.menu: 

        section="Apps/Graphics"\
        hints="KDE"\
        title="KPDF"\
+       icon32x32="/usr/share/pixmaps/kpdf.xpm"\
+       icon16x16="/usr/share/pixmaps/kpdf-16.xpm"\
        command="/usr/bin/kpdf"

    (b) create those .xpm icons listed above from the .png ones available
        in the sources, and put them into debian/icons with the
        appropriate name, e.g:

        kpdf/cr32-app-kpdf.png -> debian/icons/kpdf.xpm
        kpdf/cr16-app-kpdf.png -> debian/icons/kpdf-16.xpm

    (c) install the icons that have been created in (b) to the location
        mentioned in (a), e.g. in kpdf.install:

+debian/icons/kpdf.xpm          /usr/share/pixmaps
+debian/icons/kpdf-16.xpm       /usr/share/pixmaps
 debian/tmp/usr/bin/kpdf
 debian/tmp/usr/lib/kde3/libkpdfpart.la
 debian/tmp/usr/lib/kde3/libkpdfpart.so

                                     * * *

  (a) is already finished as of r739. I hope that having it commited
  without the icons getting really installed doesn't break anything,
  should someone build packages in the meantime.

  About (c), I've done nothing yet, but will be fairly straightforward
  once the time arrives.

  And now the story for (b): there are more or less three steps
  involved:

    - find out where the original .png icons are
    - convert them to .xpm
    - upon new releases, check if the .xpms need an update

  The best approach for this is, IMV, to have a list of the mappings
  .png <--> .xpm somewhere (*), and have a script take care of making
  the conversion. Just invoking the script upon a new upstream release,
  and check the .xpms that have changed (think svn status, or svn diff),
  should be enough. One could also think of running the script at build
  time, but Ben said that sometimes the 'convert' program would do some
  fancy things with transparencies, and that it was best to check the
  output. I like the idea, though.

    (*) Such list can't be auto-generated, since the location of the
        .png files is not consistent, so one must not loose it.

  So, I have ready a commit that embeds that list into the appropriate
  .menu files. It's been a bit of work, but seems useful to me. The
  format will be, e.g. for kpdf.menu:

        icon32x32="/usr/share/pixmaps/kpdf.xpm"\
        icon16x16="/usr/share/pixmaps/kpdf-16.xpm"\
        command="/usr/bin/kpdf"
+
+# Icon 32x32 kpdf/cr32-app-kpdf.png kpdf.xpm
+# Icon 16x16 kpdf/cr16-app-kpdf.png kpdf-16.xpm

  Unless somebody objets to the procedure, I will commit soon, together
  with a script to parse those '^#Icon' lines and generate the .xpm
  files. Then, (c) can be done.

  Cheers,

-- 
Adeodato Simó
    EM: asp16 [ykwim] alu.ua.es | PK: DA6AE621
 
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny..."
                -- Isaac Asimov