{ lib, stdenvNoCC, librsvg, xcursorgen, hyprcursor }: # HyprChrome cursors, drawn as the "HyprChrome Cursors" design canvas # (claude.ai/artifact/Ls3fchoxzc2o9F5jFCuJBy). One 32px-grid SVG per shape in # ./hyprchrome-cursors; built as both XCursor (X11/XWayland, GTK, Steam) and # hyprcursor (SVG, so it stays sharp at any size) in a single theme dir. let name = "HyprChrome"; xcursorSizes = [ 24 32 36 48 ]; # hotspot on the 32px grid, as in the canvas; aliases are the X11/CSS names # that should resolve to this shape. shapes = { default = { hs = [ 5 3 ]; aliases = [ "left_ptr" "arrow" "top_left_arrow" "left_arrow" ]; }; pointer = { hs = [ 13 3 ]; aliases = [ "hand2" "hand1" "hand" "pointing_hand" ]; }; text = { hs = [ 16 16 ]; aliases = [ "xterm" "ibeam" "vertical-text" ]; }; crosshair = { hs = [ 16 16 ]; aliases = [ "cross" "tcross" "cross_reverse" "diamond_cross" "cell" "plus" ]; }; wait = { hs = [ 16 16 ]; aliases = [ "watch" "clock" ]; }; progress = { hs = [ 4 2 ]; aliases = [ "left_ptr_watch" "half-busy" ]; }; help = { hs = [ 4 2 ]; aliases = [ "question_arrow" "whats_this" "left_ptr_help" ]; }; context-menu = { hs = [ 4 2 ]; aliases = [ ]; }; copy = { hs = [ 4 2 ]; aliases = [ "dnd-copy" ]; }; alias = { hs = [ 4 2 ]; aliases = [ "dnd-link" "link" ]; }; move = { hs = [ 16 16 ]; aliases = [ "fleur" "all-scroll" "size_all" "dnd-move" "pointer-move" ]; }; grab = { hs = [ 16 16 ]; aliases = [ "openhand" ]; }; grabbing = { hs = [ 16 16 ]; aliases = [ "closedhand" "dnd-none" ]; }; not-allowed = { hs = [ 16 16 ]; aliases = [ "no-drop" "forbidden" "circle" "crossed_circle" "dnd-no-drop" ]; }; zoom-in = { hs = [ 13 11 ]; aliases = [ "zoom_in" ]; }; zoom-out = { hs = [ 13 11 ]; aliases = [ "zoom_out" ]; }; ew-resize = { hs = [ 16 16 ]; aliases = [ "e-resize" "w-resize" "col-resize" "sb_h_double_arrow" "h_double_arrow" "size_hor" "split_h" "left_side" "right_side" ]; }; ns-resize = { hs = [ 16 16 ]; aliases = [ "n-resize" "s-resize" "row-resize" "sb_v_double_arrow" "v_double_arrow" "double_arrow" "size_ver" "split_v" "top_side" "bottom_side" ]; }; nwse-resize = { hs = [ 16 16 ]; aliases = [ "nw-resize" "se-resize" "size_fdiag" "bd_double_arrow" "top_left_corner" "bottom_right_corner" ]; }; nesw-resize = { hs = [ 16 16 ]; aliases = [ "ne-resize" "sw-resize" "size_bdiag" "fd_double_arrow" "top_right_corner" "bottom_left_corner" ]; }; }; # same rounding hyprcursor applies to its fractional hotspots px = size: v: toString (builtins.floor (v * size / 32.0 + 0.5)); frac = v: toString (v / 32.0); buildShape = shape: { hs, aliases }: let x = lib.elemAt hs 0; y = lib.elemAt hs 1; in '' mkdir -p work/hyprcursors/${shape} cp ${shape}.svg work/hyprcursors/${shape}/ cat > work/hyprcursors/${shape}/meta.hl < ${shape}.cfg ${lib.concatMapStrings (s: '' rsvg-convert -w ${toString s} -h ${toString s} ${shape}.svg -o ${shape}-${toString s}.png echo "${toString s} ${px s x} ${px s y} ${shape}-${toString s}.png" >> ${shape}.cfg '') xcursorSizes} xcursorgen ${shape}.cfg "$theme/cursors/${shape}" ${lib.concatMapStrings (a: "ln -s ${shape} \"$theme/cursors/${a}\"\n") aliases} ''; in stdenvNoCC.mkDerivation { pname = "hyprchrome-cursors"; version = "0.1"; src = ./hyprchrome-cursors; nativeBuildInputs = [ librsvg xcursorgen hyprcursor ]; installPhase = '' runHook preInstall theme="$out/share/icons/${name}" mkdir -p "$theme/cursors" work cat > "$theme/index.theme" < work/manifest.hl <