NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.29k stars 13.54k forks source link

No thumbnails for .kra (Krita) files #287003

Open lelgenio opened 7 months ago

lelgenio commented 7 months ago

Describe the bug

On Thunar, with the tumbler thumbnailer, .kra files have no thumbnails.

I assume this also occurs with Nautilus on Gnome. I think this works fine on dolphin because Krita has KIO integrations.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set programs.thunar.enable = true;
  2. Set programs.tumbler.enable = true;
  3. Create a .kra file in Krita.
  4. Look at the file in Thunar

Expected behavior

.kra Files should have thumbnails, just like any other image format.

Screenshots

image

Additional context

It seems like thumbnails for krita are kinda messy outside of kde.

This forum post asks the same question, people suggest the solution from this blog post.

Unfortunately the blog post's solution no longer works due to too much quoting. Removing the extra quotes fixes the issue.

PSA: You can put test things by putting the file in $HOME/.local/share/thumbnailers/kra.thumbnailer and restarting your thumbnailer.

The solution boils down to this in NixOs:

{ config, pkgs, inputs, ... }: {
  programs.thunar.enable = true;
  services.tumbler.enable = true;
  environment.systemPackages = [
    (
      pkgs.writeTextFile {
        name = "krita-thumbnails";
        text = ''
          [Thumbnailer Entry]
          TryExec=unzip
          Exec=sh -c "${pkgs.unzip}/bin/unzip -p %i preview.png > %o"
          MimeType=application/x-krita;
        '';
        destination = "/share/thumbnailers/kra.thumbnailer";
      }
    )
  ];
}

image

Notify maintainers

Krita maintainers: @abbradar @sifmelcara @nek0 Tumbler maintainers: @bobby285271 @romildo @muscaln

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
 - host os: `Linux 6.1.75, NixOS, 23.11 (Tapir), 23.11.20240131.53fbe41`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/sb3x0gk95v9h285ch8cdqv3gfjp97p1b-source`

Add a :+1: reaction to issues you find important.

nixos-discourse commented 4 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-do-i-create-thumbnailer-files/43613/4