termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

[WIP]: Add `termux_step_install_icons` to generate and install application icons.

Open TomJo2000 opened this issue 6 months ago • 5 comments

This PR adds a new build step which runs immediately after termux_step_post_make_install which generates application icons using imagemagick and termux-proot-run.

The termux_step_install_icons uses the following three new control variables:

  • TERMUX_PKG_ICONS - a comma separated list of icon files
  • TERMUX_PKG_ICON_NAMES - a comma separated list of icon names (optional)
  • TERMUX_PKG_ICON_SIZES - sizes to generate icons in (defaults to "16, 24, 32, 48, 64, 128, 256")

Additionally aosp-libs and imagemagick will be implicitly added to the build dependencies for a package if it specifies TERMUX_PKG_ICONS. This is done mostly for ease of use and convenience, since they are required for running imagemagick via termux-proot-run.

  • This PR builds on the work done in #24676 for adding icons to the yazi package. As a proof of concept I have attached commits adapting the build scripts for yazi, mpv and mpv-x to these changes. I will be adding more packages to this PR later but wanted to put it up for comment and review now.

The wiki pages for; https://github.com/termux/termux-packages/wiki/Building-packages#build-steps and https://github.com/termux/termux-packages/wiki/Creating-new-package#package-build-script-variables will need to be updated with the new build steps and control variable when this PR is merged.

TomJo2000 avatar Jun 01 '25 15:06 TomJo2000

It is an interesting idea, but unfortunately, at least the way this PR currently is, it would break the TERMUX_ON_DEVICE_BUILD=true mode of mpv.

Generating icons for mpv:/data/data/com.termux/files/home/.termux-build/_cache/proot-bin-aarch64/proot: 1: Syntax error: "(" unexpected

Wouldn't it be possible to just make termux_step_install_icons() download and run an official GNU/Linux AppImage release of ImageMagick from here https://github.com/ImageMagick/ImageMagick/releases, and only pull in the Termux imagemagick package when TERMUX_ON_DEVICE_BUILD=true mode is detected?

robertkirkman avatar Jun 01 '25 23:06 robertkirkman

It is an interesting idea, but unfortunately, at least the way this PR currently is, it would break the TERMUX_ON_DEVICE_BUILD=true mode of mpv.

Generating icons for mpv:/data/data/com.termux/files/home/.termux-build/_cache/proot-bin-aarch64/proot: 1: Syntax error: "(" unexpected

Wouldn't it be possible to just make termux_step_install_icons() download and run an official GNU/Linux AppImage release of ImageMagick from here https://github.com/ImageMagick/ImageMagick/releases, and only pull in the Termux imagemagick package when TERMUX_ON_DEVICE_BUILD=true mode is detected?

I hadn't considered the on-device codepath yet. But yes that should be taken into account. Can't we just run it without termux-proot-run for on-device builds? Seems simpler than setting up the AppImage.

TomJo2000 avatar Jun 02 '25 00:06 TomJo2000

@robertkirkman could you please verify that this is working as intended for on-device builds now when you have the time?

TomJo2000 avatar Jun 05 '25 17:06 TomJo2000

It does now, sorry I didn't mention that earlier. I thought there might be more changes coming here.

I was waiting for feedback before adding additional packages with icons to this PR.

TomJo2000 avatar Jun 05 '25 23:06 TomJo2000

I'm looking through packages that have/should have icons to package. I'll mark these off once I've determined if they need any more work.

  • [ ] qbittorrent, already install icons as part of its build.
  • [ ] inkscape, it's complicated.
  • [ ] XFCE Apps, seem to package their icons as part of the build.
  • [ ] MATE Apps, seem to package their icons as part of the build (Though not quite the standard resolutions set in the build step)
  • [ ] firefox, should be shipping icons, currently doesn't will need to investigate.
  • [ ] chromium, full standard raster range, no scalable
  • [ ] htop, ships only the scalable icon currently
  • [ ] foot, only ships the scalable and 48x48 icon currently
  • [ ] alacritty, doesn't currently ship any icon
  • [ ] kdenlive, ships a full set of icons
  • [ ] handbrake, only ships scalable icon currently
  • [ ] keepassxc, only scalable icons and two 256x256 ones.
  • [ ] vlc/vlc-qt, no scalable and incomplete rasterized icons.
  • [ ] vim, completely missing.
  • [ ] vim-gtk, only (16x16, 32x32 locolor) and (48x48 hicolor).
  • [ ] neovim, only 128x128.
  • [ ] emacs, completely missing.
  • [ ] emacs-x, scalable (2 including one .ico which is a raster image), 16, 24, 32, 48, 128.
  • [ ] helix, completely missing.
  • [ ] kakoune, completely missing (unsure if there are office icons for it, Arch doesn't package any either)
  • [ ] codeblocks, ships two mimetype icons (48x48) but no app icons.
  • [ ] audacity, scalable, 16, 22, 24, 32, 48
  • [ ] cups, completely missing.
  • [ ] fcitx5, full set except 64x64, additionally 22x22
  • [ ] git/git-gui, completely missing.
  • [x] gimp, full set plus some extra resolutions.
  • [ ] synaptic, 16 for all, 24 only for system-upgrade, 256 and scalable only for app icon.
  • [ ] syncthing, completely missing.
  • [ ] texstudio, only scalable.
  • [ ] thunderbird, not where they should be.
  • [ ] wireshark-qt, only mimetypes.

I've definitely missed some packages but this should be a good starting list to look into.

TomJo2000 avatar Jun 06 '25 01:06 TomJo2000