Skip to content

hlwht/mousecape-from-windows-cursor

Repository files navigation

mousecape-from-windows-cursor

Converts Windows cursors (.cur, .ani) to macOS Mousecape .cape files.

Usage (Command line)

npm install -G mousecape-from-windows-cursor
mousecape-from-windows-cursor ./install.inf

Usage (Node)

import { 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))

About

Converts Windows cursors to Mousecape .cape files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published