Converts Windows cursors (.cur, .ani) to macOS Mousecape .cape files.
npm install -G mousecape-from-windows-cursormousecape-from-windows-cursor ./install.infimport { dirname, resolve } from "path";
import { buildMousecape, parseInstall, stringifyMousecape } from "mousecape-from-windows-cursor";
import { readFile, writeFile } from "fs/promises";
const installInfPath = "./windows-cursor/Install.inf";
const cursorsPath = dirname(installInfPath);
// parse install.inf
const install = parseInstall(await readFile(installInfPath, "utf8"));
// create { ["fileName.cur"]: { cursor: Buffer, animated?: boolean } } object
const cursors = await Promise.all(Object.entries(install)
.filter(([e]) => e == e.toLowerCase())
.map(
async ([cursor, path]) => ([
cursor, {
animated: path.endsWith(".ani"),
cursor: await readFile(resolve(cursorsPath, path))
}] as [string, { cursor: Buffer, animated?: boolean }]
)));
// create cape
const cape = await buildMousecape(Object.fromEntries(cursors), {
author: install.INF_Provider ?? "you",
capeName: install.SCHEME_NAME ?? "Unnamed"
});
// and stringify it to plist
await writeFile(resolve(cursorsPath, `./${cape.id}.cape`), stringifyMousecape(cape)).png)