Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TomJo2000
Copy link
Member

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 enhance(main/yazi): add .desktop entry #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.

@robertkirkman
Copy link
Contributor

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?

@TomJo2000
Copy link
Member Author

TomJo2000 commented Jun 2, 2025

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.

@termux termux deleted a comment Jun 2, 2025
TomJo2000 added 2 commits June 3, 2025 14:20
Handles installing application icons for packages.
Uses the following three control variables:
- `TERMUX_PKG_ICONS` comma separated list of icon files
- `TERMUX_PKG_ICON_NAMES` 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")
@TomJo2000
Copy link
Member Author

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

Copy link
Contributor

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@TomJo2000
Copy link
Member Author

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
Copy link
Member Author

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.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants