fufexan / dotfiles

NixOS system config & Home-Manager user config
MIT License
727 stars 41 forks source link

bibata-hyprcursor not working for me #40

Open ppenguin opened 1 month ago

ppenguin commented 1 month ago

Inspired by your dotfiles (BTW the download link here https://github.com/fufexan/dotfiles/blob/36c38db81da2f5b07a6ad25b03cafceceb8f26e3/pkgs/bibata-hyprcursor/default.nix#L13 seems to be broken), I made a modified one (see below)

However, when setting the cursor, e.g. with

> hyprctl setcursor BibataHypr-Modern-Classic 26
ok

I see in the Hyprland log:

[hc] getFullPathForThemeName: found /home/jeroen/.local/share/icons/BibataHypr-Modern-Classic
[hc] Found theme BibataHypr-Modern-Classic at /nix/store/hk18adfbwfby1b4lwlmcgwb7zsymakgg-bibata-hyprcursor-1.0/share/icons/BibataHypr-Modern-Classic

[hc] loadThemeStyle: loading for size 39
[hc] Failed reading svg: XML parse error: Error domain 1 code 73 on line 3 column 51 of data: Couldn't find end of Start Tag circle line 3

[hc] getShapesC: found 0 images for left_ptr
[hc] getShapesC: found 0 images for left_ptr
[hc] getShapesC: found 0 images for default
[hc] getShapesC: found 0 images for left_ptr
[hc] getShapesC: found 0 images for left-ptr

and the cursor does not change, though hyprctl thinks there is no problem.

In other words, it is found but the svg data (compressed in the .hcl files as I understand) cannot be loaded. BTW, I noticed that the name in the manifest is the original Bibata name, i.e. not the name of the directory, don't know if this plays a role?

The cursor package for nix (shas not yet finished):

{
  lib,
  stdenvNoCC,
  fetchurl,
  # bibata-cursors,
  variant ? "Modern-Classic",
}: let
  hcversion = "1.0";

  variants = {
    Modern-Classic = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Classic.tar.gz";
      name = "hypr_Bibata-Modern-Classic.tar.gz";
      sha256 = "sha256-+ZXnbI3bBLcb0nv2YW3eM/tK4dsraNM4UAO9BpSqfXk=";
    };
    Modern-Amber = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Amber.tar.gz";
      name = "hypr_Bibata-Modern-Amber.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Modern-Ice = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Ice.tar.gz";
      name = "hypr_Bibata-Modern-Ice.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Original-Classic = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Classic.tar.gz";
      name = "hypr_Bibata-Original-Classic.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Original-Amber = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Amber.tar.gz";
      name = "hypr_Bibata-Original-Amber.tar.gz";
      sha256 = "sha256-WTXiuRje6VJlVDayvI9GzvKYNjdgXYqKRi8t2QRanDk=";
    };
    Original-Ice = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Ice.tar.gz";
      name = "hypr_Bibata-Original-Ice.tar.gz";
      sha256 = lib.fakeSha256;
    };
  };
in
  stdenvNoCC.mkDerivation (finalAttrs: {
    pname = "bibata-hyprcursor";

    # inherit (bibata-cursors) version;
    version = hcversion;

    src = fetchurl {
      inherit (variants.${variant}) url name sha256;
    };

    installPhase = ''
      runHook preInstall

      mkdir -p $out/share/icons/BibataHypr-${variant}
      cp -r /build/manifest.hl /build/hyprcursors $out/share/icons/BibataHypr-${variant}/

      runHook postInstall
    '';

    meta = {
      description = "Open source, compact, and material designed cursor set";
      homepage = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor";
      license = lib.licenses.gpl3Only;
      platforms = lib.platforms.linux;
      maintainers = with lib.maintainers; [fufexan];
    };
  })
fufexan commented 1 month ago

https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor is not reliable, that's why I haven't used it. The svgs don't load because they're broken. If you open one in a text editor you can see that a sed call failed miserably, leaving stray { in almost all files.

About the broken URL, I'll probably upload the original theme somewhere more permanent.

fufexan commented 1 month ago

Fixed the broken url.

ppenguin commented 1 month ago

Ah, thanks, that explains it. Any tips how to get correct SVG's for the other variants?

I had customised the package like so to get complete such functionality, but obviously the actual cursor sources suffer from the issue you mentioned:

{
  lib,
  stdenvNoCC,
  fetchurl,
  # bibata-cursors,
  variant ? "Modern-Classic",
}: let
  hcversion = "1.0";

  variants = {
    Modern-Classic = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Classic.tar.gz";
      name = "hypr_Bibata-Modern-Classic.tar.gz";
      sha256 = "sha256-+ZXnbI3bBLcb0nv2YW3eM/tK4dsraNM4UAO9BpSqfXk=";
    };
    Modern-Amber = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Amber.tar.gz";
      name = "hypr_Bibata-Modern-Amber.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Modern-Ice = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Modern-Ice.tar.gz";
      name = "hypr_Bibata-Modern-Ice.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Original-Classic = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Classic.tar.gz";
      name = "hypr_Bibata-Original-Classic.tar.gz";
      sha256 = lib.fakeSha256;
    };
    Original-Amber = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Amber.tar.gz";
      name = "hypr_Bibata-Original-Amber.tar.gz";
      sha256 = "sha256-WTXiuRje6VJlVDayvI9GzvKYNjdgXYqKRi8t2QRanDk=";
    };
    Original-Ice = {
      url = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor/releases/download/${hcversion}/hypr_Bibata-Original-Ice.tar.gz";
      name = "hypr_Bibata-Original-Ice.tar.gz";
      sha256 = lib.fakeSha256;
    };
  };
in
  stdenvNoCC.mkDerivation (finalAttrs: {
    pname = "bibata-hyprcursor";

    # inherit (bibata-cursors) version;
    version = hcversion;

    src = fetchurl {
      inherit (variants.${variant}) url name sha256;
    };

    installPhase = ''
      runHook preInstall

      mkdir -p $out/share/icons/BibataHypr-${variant}
      cp -r /build/manifest.hl /build/hyprcursors $out/share/icons/BibataHypr-${variant}/

      runHook postInstall
    '';

    meta = {
      description = "Open source, compact, and material designed cursor set";
      homepage = "https://github.com/LOSEARDES77/Bibata-Cursor-hyprcursor";
      license = lib.licenses.gpl3Only;
      platforms = lib.platforms.linux;
      maintainers = with lib.maintainers; [fufexan];
    };
  })