doublecmd / doublecmd

Double Commander is a free cross platform open source file manager with two panels side by side.
https://doublecmd.sourceforge.io
GNU General Public License v2.0
2.64k stars 198 forks source link

Icons not found in NixOS #1681

Open harvii opened 4 months ago

harvii commented 4 months ago

Version

Double Commander Version: 1.1.14 gamma Revision: Unknown Commit: Unknown Build date: 2024/05/10 Lazarus: 3.2.0.0 FPC: 3.2.2 Platform: x86_64-Linux-qt5 OS version: NixOS 23.11 (Tapir)

Widgetset library: Qt 5.15.12, libQt5Pas 5.6.1

Description

When running doublecmd in terminal on NixOS, the below error is shown: Theme Adwaita not found.

Double Commander looks for icons in specific locations: https://github.com/doublecmd/doublecmd/blob/a404e2ffe78a4b868b306af5186cbc0d999d23e3/src/platform/unix/uunixicontheme.pas#L249 However, /usr/local/share/ and /usr/share/ don't exist on NixOS, which uses /run/current-system/sw/share instead.

Would it be possible to have Double Commander look for icons in XDG_DATA_DIRS? as this seems the recommended way: https://www.reddit.com/r/NixOS/comments/yz2dmy/what_the_nix_equivalent_of_usrshare/ix1n8kl/

The error isn't shown if the icons are copied from /run/current-system/sw/share to ~/.local/share/icons or ~/.icons .

harvii commented 3 months ago

I'm using this as a workaround for now:

(doublecmd.overrideAttrs (oldAttrs: {
  postPatch = oldAttrs.postPatch or "" + ''
    substituteInPlace src/platform/unix/uunixicontheme.pas \
      --replace '/usr/share/icons' '/run/current-system/sw/share/icons'
    substituteInPlace src/platform/upixmapmanager.pas \
      --replace '/usr/share/mime/' '/run/current-system/sw/share/mime/'
  '';
}))