# Workaround for using the Arch Linux AUR package # `softmaker-office-2024-bin` with the LXDE desktop environment. # The workaround is effectively usable for the following icon themes: # `lxde-icon-theme`, `mate-icon-theme`, `papirus-icon-theme`, and # `pop-icon-theme`. # Save the file as "softmaker-office-2024-bin.install". To use it # with the "softmaker-office-2024-bin" package, add the following # lines to the PKGBUILD: # install="${pkgname}.install" # depends+=('gtk-update-icon-cache') # A problem exists within the LXDE desktop environment. New icons # for MIME types installed within the Hicolor icon theme are # not utilized by PCManFM. PCManFM only considers icons that are # installed in the currently selected icon theme. # For this specific case, I propose a workaround that essentially # follows the procedure for installing SoftMaker Office using # the installation script `installsmoffice`. Please refer to the # `installsmoffice` script (lines 504 et seq.) located within the # "softmaker-office-2024-1234-amd64.tgz" archive. # This workaround is executed via an *.INSTALL* script following # either the installation or uninstallation process. The script # adopts a highly conservative approach regarding any modifications # made to the installed icon themes. # The workaround was successfully tested with the LXDE # desktop environment (package group `lxde`) and the packages # `lxde-icon-theme` (nuoveXT2), `mate-icon-theme` (mate, menta), # `papirus-icon-theme` (Papirus, - but does not work with Papirus-Dark # and Papirus-Light), and `pop-icon-theme` (Pop). **Limitation:** # It is not suitable for icon themes whose directory hierarchy is # not structured similarly to the Hicolor model. # Some of the aforementioned icon themes prioritize their own icons # for MIME types - such as those for Microsoft Office files. However, # this is precisely the behavior that users of an icon theme expect. post_install() { ALLTHEMES=$(find /usr/share/icons/* | \ grep 'msword\|excel\|powerpoint' | \ grep -v 'excellent' | \ grep -v 'hicolor' | \ sed -r 's/^\/usr\/share\/icons\/([^/]+)\/.+/\1/' | \ grep -v '\.' | \ sort | \ uniq) # NB: It is possible to create new directories within a icon theme # and install icons there (e.g., using the `xdg-icon-resource` # command). It cannot be ruled out that this approach will # yield a functional result. However, if directories are # not listed in the index.theme file, this constitutes a # violation - at the very least - of the "Icon Theme Specification" # . Only # in the case of Hicolor we do know exactly which directories are # available. Consequently, particular care should be exercised # when installing icons into unknown icon themes. for THEME in $ALLTHEMES ; do if [ -f "/usr/share/icons/${THEME}/index.theme" ]; then for size in 16 32 48 64 128 256 512; do if [ -d "/usr/share/icons/${THEME}/${size}x${size}/mimetypes" ] && \ [ ! -L "/usr/share/icons/${THEME}/${size}x${size}/mimetypes" ] && \ grep -q -P "^Directories=.*${size}x${size}/mimetypes,*" \ "/usr/share/icons/${THEME}/index.theme"; then ln -s "/usr/share/office2024/icons/pmd_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24.png" ln -s "/usr/share/office2024/icons/prd_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-prd24.png" ln -s "/usr/share/office2024/icons/tmd_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24.png" ln -s "/usr/share/office2024/icons/pmd_oth_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24-oth.png" ln -s "/usr/share/office2024/icons/tmd_oth_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24-oth.png" ln -s "/usr/share/office2024/icons/pmd_mso_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24-mso.png" ln -s "/usr/share/office2024/icons/prd_mso_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-prd24-mso.png" ln -s "/usr/share/office2024/icons/tmd_mso_${size}.png" \ "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24-mso.png" fi done # NB: The hook "/usr/share/libalpm/hooks/gtk-update-icon-cache.hook" # is not triggered for the directories "/usr/share/icons/*" if # the changes were made by the .INSTALL script. (Although `namcap` # claims otherwise.) gtk-update-icon-cache -q -f "/usr/share/icons/${THEME}" fi done } post_remove() { ALLTHEMES=$(find /usr/share/icons/* | \ grep 'msword\|excel\|powerpoint' | \ grep -v 'excellent' | \ grep -v 'hicolor' | \ sed -r 's/^\/usr\/share\/icons\/([^/]+)\/.+/\1/' | \ grep -v '\.' | \ sort | \ uniq) for THEME in $ALLTHEMES ; do if [ -f "/usr/share/icons/${THEME}/index.theme" ]; then for size in 16 32 48 64 128 256 512; do if [ -d "/usr/share/icons/${THEME}/${size}x${size}/mimetypes" ]; then rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-prd24.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24-oth.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24-oth.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-pmd24-mso.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-prd24-mso.png" rm -f "/usr/share/icons/${THEME}/${size}x${size}/mimetypes/application-x-tmd24-mso.png" fi done gtk-update-icon-cache -q -f "/usr/share/icons/${THEME}" fi done }